schema
SQLAlchemy ORM for the scan_metadata cache table (v1).
Each version package declares its own local Base (its own MetaData) so that
multiple versions of the same table can coexist in one process without a
__tablename__ collision. Base carries the shared nullable tags column and
every ORM in this version inherits it directly (mirrors file_metadata).
Grain and key
One row per scan — a single acquisition series within an ophthalmology file
(the private-eye pipeline loops N series per file; DICOM/Zeiss produce one
series per file). The composite primary key is (file_path, series_index).
Unlike file_metadata's (task_hash, file_path) key, there is no
task_hash: scan metadata is file-intrinsic (the same file always yields
the same metadata regardless of task), and file_path is stored absolute
(str(normalize_path(fp))) so it is globally unique within a per-pod cache DB.
PHI at rest
The patient columns (first_name, last_name, date_of_birth, patient_key,
gender) are stored plaintext, unlike scan_eligibility which encrypts.
This is consistent with the plaintext, file-intrinsic file_metadata table
(whose file_path PK already leaks patient identity anyway).
Adding a column to a new version is an additive migration (see
migrations.py): add a nullable mapped_column in the new version's schema and
a corresponding upgrade step — never rename/drop/retype in place.
Classes
Base
class Base(**kwargs: Any):Local declarative base for scan_metadata v1.
Owns an isolated MetaData (so it never collides with another version of
this table) and inherits the shared columns from types/schema.py's Base.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and
values in kwargs.
Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.
Ancestors
Subclasses
ScanMetadata
class ScanMetadata(**kwargs):SQLAlchemy model for the scan_metadata cache table.
Stores vendor-normalized, header-only per-scan metadata (laterality, geometry, patient demographics, device) extracted from ophthalmology files without any pixel decode or model inference. One row per acquisition series.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and
values in kwargs.
Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.
Ancestors
Variables
-
dataset_identifier : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
date_of_birth : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
dimensions_mm_depth : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
dimensions_mm_height : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
dimensions_mm_width : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
file_path : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
first_name : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
fixation : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
gender : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
last_name : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
laterality : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
manufacturer : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
num_bscans : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
patient_key : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
processed_at : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
protocol : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
reason : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
resolutions_mm_depth : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
resolutions_mm_height : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
resolutions_mm_width : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
run_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
scan_datetime : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
scanner_model : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
series_description : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
series_index : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
size_height : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
size_width : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
slo_dimensions_mm_height : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
slo_dimensions_mm_width : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
slo_size_height : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
slo_size_width : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
source_file_hash : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
tags : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]