csv_report_generation_ophth_algorithm
Algorithm for outputting results to CSV on the pod-side.
Classes
CSVReportGeneratorAlgorithm
class CSVReportGeneratorAlgorithm( save_path: Optional[Union[str, os.PathLike]] = None, trial_name: Optional[str] = None, rename_columns: Optional[Mapping[str, str]] = None, original_cols: Optional[list[str]] = None, filter: Optional[list[ColumnFilter]] = None, match_patient_visit: Optional[MatchPatientVisit] = None, matched_csv_path: Optional[Union[str, os.PathLike]] = None, produce_matched_only: bool = True, csv_extensions: Optional[list[str]] = None, produce_trial_notes_csv: bool = False, sorting_columns: Optional[dict[str, DFSortType]] = None, **kwargs: Any,):
Algorithm for generating the CSV results reports.
Ancestors
- CSVReportGeneratorOphthalmologyAlgorithm
- BaseAlgorithmFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Methods
modeller
def modeller( self, **kwargs: Any,) ‑> NoResultsModellerAlgorithm:
Inherited from:
CSVReportGeneratorOphthalmologyAlgorithm.modeller :
Modeller-side of the algorithm.
worker
def worker( self, **kwargs: Any,) ‑> bitfount.federated.algorithms.ophthalmology.csv_report_generation_ophth_algorithm._WorkerSide:
Inherited from:
CSVReportGeneratorOphthalmologyAlgorithm.worker :
Worker-side of the algorithm.
CSVReportGeneratorOphthalmologyAlgorithm
class CSVReportGeneratorOphthalmologyAlgorithm( save_path: Optional[Union[str, os.PathLike]] = None, trial_name: Optional[str] = None, rename_columns: Optional[Mapping[str, str]] = None, original_cols: Optional[list[str]] = None, filter: Optional[list[ColumnFilter]] = None, match_patient_visit: Optional[MatchPatientVisit] = None, matched_csv_path: Optional[Union[str, os.PathLike]] = None, produce_matched_only: bool = True, csv_extensions: Optional[list[str]] = None, produce_trial_notes_csv: bool = False, sorting_columns: Optional[dict[str, DFSortType]] = None, **kwargs: Any,):
Algorithm for generating the CSV results reports.
Arguments
save_path
: The folder path where the csv report should be saved.trial_name
: The name of the trial for the csv report. If provided, the CSV will be saved as "trial_name"-prescreening-patients-"date".csv. Defaults to None.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.rename_columns
: A dictionary of columns to rename. Defaults to None.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)match_patient_visit
: Used for matching the same patient visit.matched_csv_path
: Path to save the matched patients CSV to, if requested. Defaults tosave_path
(i.e. overwrites the non-matched CSV) ifproduce_matched_only
is True. Otherwise, will create a file based off of thesave_path
argument.produce_matched_only
: If True, only the matched CSV will be generated at the end of the run. If False, both the non-matched and matched CSV will be generated.produce_trial_notes_csv
: If True, a CSV file containing the trial notes will be generated at the end of the run. Defaults to False.csv_extensions
: List of named CSV extension functions that will be applied to the output CSV just before saving to file.sorting_columns
: A dictionary of columns to sort the output CSV by. The keys are column names the values are either 'asc' or 'desc'. Defaults to None.
Ancestors
- BaseAlgorithmFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Subclasses
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.ophthalmology.csv_report_generation_ophth_algorithm._WorkerSide:
Worker-side of the algorithm.
MatchPatientVisit
class MatchPatientVisit( cols_to_match: list[str], divergent_col: str, date_time_col: str, how: DFMergeType = 'outer',):
Dataclass for matching patient visits.
Allows matching of different scans and results for the same patient visit. Only two records can be matched for the same patient visit.
Arguments
cols_to_match
: List of columns on which to match.divergent_col
: Column containing the divergent strings for the same patient. E.g. the column indicating whether the scan was performed on the left or right eye.date_time_col
: The column indicating the date of the patient visit.
Variables
- static
cols_to_match : list
- static
date_time_col : str
- static
divergent_col : str
- static
how : Literal['inner', 'outer', 'left', 'right']