Skip to main content

v1

ga_calculation record, v1 — canonical aliases.

Consumers and the record registry import from here and never touch the inner module names, mirroring steps/*/v1/__init__.py.

Module

Submodules

Classes

ORM

class ORM(**kwargs):

SQLAlchemy model for the ga_calculation cache table.

One row per (task_hash, file_id): the geographic-atrophy (with-fovea) metrics computed for a scan from the pathology-segmentation and fovea landmark predictions. task_hash covers (pod_name, datasource_name), so config values sit outside the key; each run recomputes every file and merges its row, and a changed threshold lands on the next run. 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 the sibling thickness tables).

warning

Because neither project_id nor the calc config is part of the key, two projects reading this datasource under different calc configs contend for the same row: the last background run to write wins, and the other project reads metrics computed under its counterpart's config.

The metrics live in the schemaless metrics_json blob (the flattened GAMetricsWithFovea.to_record(...) output — scalar fields, the segmentation_areas and n_scan_run_lengths mappings, and the per-pathology max_*_probability columns; the raw probability arrays are dropped on write). error carries the missing_data:* / calculation_error:* reason string for a file whose metric could not be computed; such a file is recorded with a null metrics_json and a non-null error.

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]

Record

class Record(**data: Any):

Record of a single row from the ga_calculation table.

metrics_json holds the flattened GA (with-fovea) metrics for a successful calculation and is None when the metric could not be computed for the file. error carries the missing_data:* / calculation_error:* reason string for files the calculation skipped or failed.

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.

Variables

  • static error : str | None
  • static file_id : str
  • static metrics_json : dict[str, typing.Any] | None
  • static model_config
  • static project_id : str | None
  • static run_id : str | None
  • static task_hash : str