Skip to main content

task

Prefect task for PDF report generation.

Uses pure functions from steps.pdf_report.functions for all data transformations and PDF rendering.

Module

Functions

pdf_report_task

def pdf_report_task(    datasource: BaseSource,    config: PDFReportConfig,    ga_metrics: dict[str, GAMetrics | GAMetricsWithFovea | str | None] | CacheAccessor,    ga_predictions: CacheAccessor,    filenames: list[str],    evaluations: list[CriteriaEvaluation],    task_id: str,)> PDFReportResult:

Generate PDF reports using composable pure functions.

For each eligible file, renders a PDF report containing patient metadata, B-scan images with segmentation overlays, and GA metrics.

Arguments

  • datasource: The datasource providing patient and scan data.
  • config: PDF report configuration (heading, text_fields, trial_name, and the total GA-area slider bounds).
  • ga_metrics: Mapping of filename → GA metrics (or None/error string).
  • ga_predictions: Cache accessor for GA model inference results (background step ga_inference.cache). Materialised once at the start of this task.
  • filenames: List of file IDs to process.
  • evaluations: The structured evaluations from criteria_matching, used to determine eligible entries.
  • task_id: Task run ID.

Returns PDFReportResult with a DataFrame mapping filenames to PDF paths.