Skip to main content

v1

The scan_reduce step (v1): narrows a run to the scans worth inferring.

Module​

Submodules​

Functions​

task_fn​

def task_fn(    cache: CacheProtocol,    config: ScanReduceConfig,    filenames: list[str],    task_hash: str | None = None,    run_id: str | None = None,) ‑> ScanReduceResult:

Reduce filenames to the scans worth inferring.

Arguments

  • cache: The pod's background cache, holding the scan rows.
  • config: The reduction to apply.
  • filenames: The run's current selection, wired from $file_metadata.cache.
  • task_hash: Provenance only, for the telemetry event.
  • run_id: Provenance only, for the telemetry event.

Returns ScanReduceResult with the selected filenames, sorted.

Classes​

Config​

class Config(**data: Any):

Config for the scan reduce step.

Attributes

  • strategy: latest keeps the newest scans per group; all is the identity reduction, which lets a template carry the step while a trial opts out of reducing at all.
  • num_latest: How many scans to keep per group. A ceiling, not a quota.
  • group_by: What to subdivide a patient by — nothing (latest N per patient), their laterality (latest N per eye), or their protocol.
  • min_scans: How many selected scans a patient must hold to be inferred at all. 1, the default, keeps every patient.

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 min_scans : int
  • static model_config
  • static num_latest : int

Result​

class Result(**data: Any):

The reduced file selection.

Not a CacheBackedResult: the step writes no rows. The selection is consumed by the executor, which rescopes the run to it before waves are planned, rather than by a downstream step reading a cache partition.

Attributes

  • filenames: The files worth inferring, sorted.

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 filenames : list[str]
  • static model_config