holoscan::CsvDataExporter
holoscan::CsvDataExporter
A class to support exporting Holoscan application data in CSV format for Holoscan Federated Analytics.
The directory will be created with the app name in the data root directory if it is not present already. Inside the application directory, a directory with the current timestamp will be created.
The output file name can be specified using the environment variable HOLOSCAN_ANALYTICS_DATA_FILE_NAME. If not specified, the output file named data.csv will be created inside the timestamp directory. The column names are added to the output file as a first row.
Using this class mainly involves two steps:
- Create
CsvDataExporterobject specifying app name and columns. - Call
export_data()method to add a single row to the output file.
Example:
Example
Inherits from: holoscan::DataExporter (public)
Constructors
CsvDataExporter
The constructor creates required directories and CSV file with the specified names.
Parameters
The application name.
The column names list which will be added to the CSV file as a first row.
Destructor
~CsvDataExporter
Methods
export_data
Exports given data to a CSV file.
Each call to the function will add one more row to the csv file.
Parameters
The data to be written to the CSV file.
output_file_name
Returns output file name.
columns
Returns the column names.
app_name
Return the application name.
data_directory
Returns a data directory name.
cleanup_data_directory
Remove the data directory and its contents.
write_row
Write one row to a CSV file.
Each call to the function will just add one more row to the csv file.
Parameters
The data to be written to the CSV file. The number of strings passed should be same as the number of columns in CSV file.
Static methods
get_analytics_data_file_name_env
Get the value of analytics output file name environment variable HOLOSCAN_ANALYTICS_DATA_FILE_NAME.
Returns: A string if the environment variable is set else it returns error code.
get_analytics_data_directory_env
Get the value of analytics data directory environment variable HOLOSCAN_ANALYTICS_DATA_DIRECTORY.
Returns: A string if the environment variable is set else it returns error code.