Skip to main content

task

Prefect task for the scan_eligibility step.

Consumes criteria_matching's structured evaluations, derives per-scan (scan-level) eligibility with evidence, and persists it to the scan_eligibility table. Writes are scoped by task_hash; only new scans are written (upstream scopes evaluations via get_unprocessed_files). Patient identity (patients) and the patient-level verdict are the patient_level_eligibility step's job; this step does not touch patients, patient_eligibility, or the pointer.

Module

Functions

scan_eligibility_task

def scan_eligibility_task(    evaluations: list[CriteriaEvaluation],    cache: CacheProtocol,    task_hash: str,    project_id: str,    config: ScanEligibilityConfig | None = None,    run_id: str | None = None,)> ScanEligibilityResult:

Compute + persist per-scan (scan-level) eligibility.

Arguments

  • evaluations: Per-scan CriteriaEvaluations from criteria_matching (new scans only — upstream scopes them via get_unprocessed_files).
  • cache: The pod background cache to write to.
  • task_hash: Partition key; a config change lands in a fresh partition.
  • project_id: The trial (project) ID (a runtime param).
  • config: Optional step config (trial display name).
  • run_id: Optional provenance run ID.

Returns ScanEligibilityResult with the number of scan_eligibility rows written and a cache accessor scoped to this task_hash.

Raises

  • ValueError: If project_id is not supplied.