v1
The scan_reduce step (v1): narrows a run to the scans worth inferring.
Module
Submodules
- bitfount.steps.scan_reduce.v1.config - Config for the scan reduce step (v1).
- bitfount.steps.scan_reduce.v1.result - Result for the scan reduce step (v1).
- bitfount.steps.scan_reduce.v1.task - Prefect task for the scan_reduce step.
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:latestkeeps the newest scans per group;allis 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.
Ancestors
Variables
- static
group_by : list[ScanReduceGroupKey]
- static
min_scans : int
- static
model_config
- static
num_latest : int
- static
strategy : ScanReduceStrategy
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.