model
Pydantic records for the scan_metadata cache table (v1).
NormalizedScanFields holds exactly the vendor-normalized, per-scan columns
derivable from a single _process_file record — it is the return type of the
runtime's normalization shim (runtimes/scan_metadata/functions.py).
ScanMetadataRecord extends it with the primary-key and control/provenance
columns, so the shared column list is declared once and inherited (the runtime
depends on the cache layer, never the reverse).
Hand-declared to mirror the ORM (schema.py). Following the gcc/cst
convention, the record holds a real datetime for the fields this runtime
controls (processed_at); the store .isoformat()s them on write and
datetime.fromisoformat()s on read. scan_datetime stays a string because
its upstream form varies by vendor (a private-eye normalized string vs. a DICOM
timestamp) and forcing a parse would be brittle.
Classes
NormalizedScanFields
class NormalizedScanFields(**data: Any):The vendor-normalized per-scan fields produced by the shim.
Every field is optional: any attribute with no source on the record's
vendor path is left None. This is only the vendor field mapping — the
series_index (identity/positioning) and file_path (PK) are the
collection task's concern and live on ScanMetadataRecord, not here.
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.
Subclasses
Variables
- static
date_of_birth : str | None
- static
dimensions_mm_depth : float | None
- static
dimensions_mm_height : float | None
- static
dimensions_mm_width : float | None
- static
first_name : str | None
- static
fixation : str | None
- static
gender : str | None
- static
last_name : str | None
- static
laterality : str | None
- static
manufacturer : str | None
- static
model_config
- static
num_bscans : int | None
- static
patient_key : str | None
- static
protocol : str | None
- static
resolutions_mm_depth : float | None
- static
resolutions_mm_height : float | None
- static
resolutions_mm_width : float | None
- static
scan_datetime : str | None
- static
scanner_model : str | None
- static
series_description : str | None
- static
size_height : int | None
- static
size_width : int | None
- static
slo_dimensions_mm_height : float | None
- static
slo_dimensions_mm_width : float | None
- static
slo_size_height : int | None
- static
slo_size_width : int | None
ScanMetadataRecord
class ScanMetadataRecord(**data: Any):Record of a single stored row from the scan_metadata table (one per scan).
Extends NormalizedScanFields with the composite primary key
(file_path, series_index) and the control/provenance columns.
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
dataset_identifier : str | None
- static
file_path : str
- static
model_config
- static
processed_at : datetime.datetime
- static
reason : str | None
- static
run_id : str | None
- static
series_index : int
- static
source_file_hash : str | None
- static
tags : dict[str, typing.Any] | None