Skip to main content

task

Prefect task tabulating the metric caches, and eligibility, into a csv_report_df.

v2 differs from v1 in two inputs, both of which change what reaches the report rather than how it is built:

  • lesion_metrics, the lesion_calculation cache. Required, which is why this is a new version rather than a widened v1: a stored flow spec pinning v1 cannot suddenly need an input it never declared.
  • evaluations, optional, from criteria_matching. csv_report accepts exactly one csv_report_df, and tabulate_criteria_outcomes builds its frame from evaluations ALONE, so a template wanting biomarker columns and eligibility columns in one CSV has no way to get both. Merging the eligibility projection here is that way; the projection itself is still evaluations_to_csv_report_df, so the two routes cannot drift.

Everything else mirrors v1: read each background step's per-file metrics from its cache, assemble via assemble_scan_frame (GA as base, the rest left-merged on the filename column with collision coalescing), derive the drusen and segmentation-area columns, then apply the biomarker group/name filter. Column names remain TECHNICAL — display renaming is csv_report's job. The one exception is the eligibility failure-reason text, which is baked here and so takes the display map from the config rather than waiting for csv_report's header-only rename (which cannot reach cell text).

Module

Functions

biomarker_tabulation_task

def biomarker_tabulation_task(    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 background ga_calculation step.
  • fluid_metrics: Cache accessor for the background fluid_calculation step.
  • cst_metrics: Cache accessor for the background cst_calculation step.
  • gcc_metrics: Cache accessor for the background gcc_calculation step.
  • lesion_metrics: Cache accessor for the background lesion_calculation step.
  • 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_metrics backfill.
  • evaluations: criteria_matching's evaluations, or None when 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.