Skip to main content

schema

SQLAlchemy ORM for the gcc_calculation 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.

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 gcc_calculation 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.

Subclasses

Variables

  • static metadata
  • static registry

GCCCalculation

class GCCCalculation(**kwargs):

SQLAlchemy model for the gcc_calculation cache table.

One row per (task_hash, file_id): the Ganglion Cell Complex asymmetry / glaucoma-staging metrics computed for a scan from retinal-layer segmentation and macula landmark predictions. GCC is a deterministic function of the scan and the model output (and the config, which folds into task_hash) — NOT of the project — so project_id is provenance only and excluded from the key, letting two projects on the same datasource share rows (mirrors model_inferences, fluid_calculation and cst_calculation).

A row is either a full result or a reason, never a partial object: metrics_json holds the GCCMetrics fields (the scalar fields plus the macula_coordinates tuple) for a computed file, and is null when the file could not be computed — in which case error carries the reason (missing_data:<fields> for absent inputs, calculation_error:<detail> for compute failures). The two columns are mutually exclusive.

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.

Variables

  • error : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • file_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • last_accessed_at : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • metrics_json : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • processed_at : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • project_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • run_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • tags : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • task_hash : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]