v2
biomarker_tabulation step v2.
Module
Submodules
- bitfount.steps.biomarker_tabulation.v2.config - Config for the biomarker_tabulation step (v2).
- bitfount.steps.biomarker_tabulation.v2.result - Result for the biomarker_tabulation step (v2).
- bitfount.steps.biomarker_tabulation.v2.task - Prefect task tabulating the metric caches, and eligibility, into a csv_report_df.
Functions
task_fn
def task_fn( datasource: BaseSource, config: BiomarkerTabulationConfig, ga_metrics: CacheAccessor, fluid_metrics: CacheAccessor, cst_metrics: CacheAccessor, gcc_metrics: CacheAccessor, lesion_metrics: CacheAccessor, filenames: list[str], evaluations: list[CriteriaEvaluation] | None = None,) ‑> BiomarkerTabulationResult:Merge, derive and filter the five metric caches into a csv_report_df.
Arguments
datasource: The datasource. Used only to pick the eligibility grain; the cache rows are already keyed by the datasource filenames.config: Selection config (biomarker_groups/biomarker_names).ga_metrics: Cache accessor for the backgroundga_calculationstep.fluid_metrics: Cache accessor for the backgroundfluid_calculationstep.cst_metrics: Cache accessor for the backgroundcst_calculationstep.gcc_metrics: Cache accessor for the backgroundgcc_calculationstep.lesion_metrics: Cache accessor for the backgroundlesion_calculationstep.filenames: The selected filenames; every one is guaranteed a row (as an all-NA row when a calculation skipped/failed the file), mirroring the v8 protocol's_fill_missing_metricsbackfill.evaluations:criteria_matching's evaluations, orNonewhen the template has no criteria step. When given, the eligibility projection is left-merged on so one CSV carries both the biomarker columns and the verdict.
Returns
BiomarkerTabulationResult carrying the tabulated csv_report_df with
TECHNICAL column names plus the filename column.
Classes
Config
class Config(**data: Any):Config selecting which biomarker columns land in the CSV report.
The biomarker filter operates on the TECHNICAL (internal) column names;
display renaming happens downstream in the csv_report step. The one
exception is the eligibility failure-reason text, which is baked during
tabulation (before csv_report renames anything) and so needs the display
map here — see rename_columns.
Arguments
biomarker_groups: Biomarker group names to include (empty ⇒ all groups).biomarker_names: Individual technical column names to include (empty ⇒ none beyond the selected groups).rename_columns: Display-name map used only for the eligibility failure-reason strings, so the projected reasons match the CSV report's display columns. Has no effect on the biomarker column selection, which stays technical.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Variables
- static
biomarker_groups : list[str]
- static
biomarker_names : list[str]
- static
model_config
- static
rename_columns : dict[str, str]
Result
class Result(**data: Any):Container for the tabulated biomarker csv_report_df.
The DataFrame keeps TECHNICAL column names plus the filename column, so the
downstream csv_report step can merge it onto freshly-read source data and
apply display renaming.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self is explicitly positional-only to allow self as a field name.