Skip to main content

field_specs

Building the catalog of matchable fields a step advertises.

A FieldSpec is what lets a generic column_criteria entry name a column without the step hard-coding it. Specs come either from a metrics dataclass's scalar fields (field_specs_from_dataclass) or from a label universe expanded into per-label columns (the *_field_specs helpers).

Module

Functions

biomarker_area_field_specs

def biomarker_area_field_specs(    ,)> list[FieldSpec]:

FieldSpecs for every <label>_area biomarker segmentation-area column.

Areas only exist for segmentation-mask classes, and only for those quantified as a 2D area rather than a volume, so the label universe is AREA_ELIGIBLE_SEGMENTATION_LABELS. Only populated when a GA-derived scan_metrics source is configured to emit them.

Returns One SCAN-grain float FieldSpec per area-eligible segmentation label.

biomarker_prob_field_specs

def biomarker_prob_field_specs(    ,)> list[FieldSpec]:

FieldSpecs for every max_<label>_probability biomarker column.

Enumerated from ALL_BIOMARKER_PROBABILITY_LABELS (segmentation biomarkers plus model classification pathologies) so pathology biomarkers are matchable via the generic path even though they flow through the untyped max_pathology_probabilities dict.

Returns One SCAN-grain FieldSpec per biomarker label.

field_specs_from_dataclass

def field_specs_from_dataclass(    cls: type, *, grain: CriterionGrain, units: dict[str, str] | None = None,)> list[FieldSpec]:

Build FieldSpecs from a dataclass's scalar fields.

Container fields (dict/list/tuple/set) are skipped — they are not single-column matchable. Every module defining one of these dataclasses has from __future__ import annotations active, so dataclasses.fields(cls)[i].type is an unevaluated string; annotations are resolved once via typing.get_type_hints(cls) and looked up by field name instead.

Arguments

  • cls: The metrics dataclass.
  • grain: The grain to stamp on every produced FieldSpec.
  • units: Optional {field_name: unit} overrides.

Returns One FieldSpec per scalar field.

n_scan_run_field_specs

def n_scan_run_field_specs()> list[FieldSpec]:

FieldSpecs for every n_scan_run_<label> consecutive-B-scan-run column.

Run lengths only exist for the six N-scan biomarkers, so the label universe is N_SCAN_BIOMARKER_LABELS. Only populated when a GA-derived scan_metrics source is configured to emit them.

Returns One SCAN-grain integer FieldSpec per N-scan biomarker label.