Skip to main content

task

Prefect task for the GA metrics calculation step (with fovea).

Calls the pure functions in steps.ga_calculation_with_fovea to compute GA area, lesion counts, and fovea distances for each scan.

Module

Functions

ga_calculation_with_fovea_task

def ga_calculation_with_fovea_task(    datasource: BaseSource,    config: GACalculationWithFoveaConfig,    ga_predictions: CacheAccessor,    fovea_predictions: CacheAccessor,    filenames: list[str],    cache: CacheProtocol,    task_hash: str,    project_id: str | None = None,    run_id: str | None = None,)> GACalculationWithFoveaResult:

Compute GA metrics for each file and persist them to cache.

Runs in background mode: an in-memory result does not cross the phase boundary, so the per-file metrics are persisted to the ga_calculation cache table (keyed by (task_hash, file_id), project_id provenance-only) and a downstream step reads them via the ga_calculation.cache accessor.

Arguments

  • datasource: The datasource providing DICOM metadata (slice thickness, pixel spacing) for each file.
  • config: GA calculation with fovea configuration.
  • ga_predictions: Cache accessor for GA model inference results (background step ga_inference.cache).
  • fovea_predictions: Cache accessor for fovea model inference results (background step fovea_inference.cache).
  • filenames: List of file IDs to process.
  • cache: Cache instance to persist the GA metrics into.
  • task_hash: Partition key for the ga_calculation table (see GACalculation for the key's composition).
  • project_id: Provenance only — the project that triggered this run. NOT part of the cache key: rows are keyed by (task_hash, file_id).
  • run_id: Optional provenance run ID.

Returns GACalculationWithFoveaResult carrying the number of rows persisted and a CacheAccessor scoped to this task_hash (ga_calculation.cache).