csv_report_algorithm
Algorithm for outputting results to CSV on the pod-side.
Classes
CSVReportAlgorithm
class CSVReportAlgorithm( save_path: Optional[Union[str, os.PathLike]] = None, original_cols: Optional[list[str]] = None, filter: Optional[list[ColumnFilter]] = None, **kwargs: Any,):
Algorithm for generating the CSV results reports.
Arguments
save_path
: The folder path where the csv report should be saved. The CSV report will have the same name as the taskID.original_cols
: The tabular columns from the datasource to include in the report. If not specified it will include all tabular columns from the datasource.filter
: A list ofColumnFilter
instances on which we will filter the data on. Defaults to None. If supplied, columns will be added to the output csv indicating the records that match the specified criteria. If more than oneColumnFilter
is given, and additional column will be added to the output csv indicating the datapoints that match all given criteria (as well as the individual matches)
Ancestors
- BaseAlgorithmFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Variables
- static
fields_dict : ClassVar[T_FIELDS_DICT]
Methods
modeller
def modeller( self, **kwargs: Any,) ‑> NoResultsModellerAlgorithm:
Modeller-side of the algorithm.
worker
def worker( self, **kwargs: Any,) ‑> bitfount.federated.algorithms.csv_report_algorithm._WorkerSide:
Worker-side of the algorithm.
ColumnFilter
class ColumnFilter(column: str, operator: str, value: typing.Union[str, int, float]):
Dataclass for column filtering.
Arguments
column
: The column name on which the filter will be applied. The filtering ignores capitalization or spaces for the column name.operator
: The operator for the filtering operation. E.g., "less than", ">=", "not equal", "==".value
: The value for the filter. This is allowed to be a string only forequals
ornot equal
operators, and needs to be a float or integer for all other operations.
Raises
ValueError
: If an inequality comparison operation is given with a value which cannot be converted to a float.