v3
ehr_data record, v3 — canonical aliases.
Adds the observation_codes_json column to v2. Consumers and the record
registry import from here and never touch the inner module names, mirroring
steps/*/v1/__init__.py.
Module
Submodules
- bitfount.cache.types.ehr_data.v3.migrations - Autogenerated migration for
ehr_datav2 -> v3. - bitfount.cache.types.ehr_data.v3.model - Pydantic record for the
ehr_datacache table (v3). - bitfount.cache.types.ehr_data.v3.schema - SQLAlchemy ORM for the
ehr_datacache table (v3). - bitfount.cache.types.ehr_data.v3.store - CRUD for the
ehr_datarecord (v3).
Functions
downgrade
def downgrade(op: Operations) ‑> None:Migrate ehr_data v3 -> v2 (see the module docstring).
upgrade
def upgrade(op: Operations) ‑> None:Migrate ehr_data v2 -> v3 (see the module docstring).
Classes
ORM
class ORM(**kwargs):SQLAlchemy model for the ehr_data cache table.
The primary key is (task_hash, bitfount_patient_id). Writes go
through session.merge, which overwrites every column on a
primary-key match.
task_hash is a per-step Merkle hash over the step's own config, not
just the pod and datasource — see bitfount.flows.dag.hashing for the
full computation. Two ehr_query steps with different
fetch_appointments/observation_codes/observation_categories
settings get different task_hash values, so they do not share a row.
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
-
bitfount_patient_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
cell_numbers : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
condition_codes_json : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
country : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
date_of_birth : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
ehr_patient_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
emails : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
error : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
family_name : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
file_ids_json : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
gender : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
given_name : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
home_numbers : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
last_accessed_at : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
mailing_address : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
medical_record_number : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
next_appointment : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
observation_codes_json : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
patient_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
patient_metadata_json : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
postal_code : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
previous_appointments_json : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
previous_encounters_json : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
procedure_codes_json : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
processed_at : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
-
row_number : 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):Stored EHR data record for a single patient.
The background flow extracts patient demographic and code data from the
EHR datasource and stores it here. The interactive flow applies code
filters against the stored diagnosis_codes, condition_codes, and
procedure_codes lists to determine EHR eligibility.
file_ids_json holds all imaging file IDs associated with this patient
in the batch. Multiple files for the same patient are accumulated into the
list before the row is written, so no file ID is ever silently overwritten.
It is None for EHR-only tasks that have no associated imaging files.
error is non-None when EHR extraction failed for this patient.
run_id is the UUID of the run that produced this record (for provenance).
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
bitfount_patient_id : str
- static
cell_numbers : list[str]
- static
condition_codes_json : list[dict[str, str | None | datetime.datetime | dict[str, str]]] | None
- static
country : str | None
- static
date_of_birth : str | datetime.date | None
- static
ehr_patient_id : str
- static
emails : list[str]
- static
error : str | None
- static
family_name : str | None
- static
file_ids_json : list[str] | None
- static
gender : str | None
- static
given_name : str | None
- static
home_numbers : list[str]
- static
last_accessed_at : datetime.datetime | None
- static
mailing_address : str | None
- static
medical_record_number : list[str] | None
- static
model_config
- static
next_appointment : str | None
- static
observation_codes_json : list[dict[str, str | None | datetime.datetime | float | bool | int | dict[str, typing.Any]]] | None
- static
patient_id : str | None
- static
patient_metadata_json : dict[str, typing.Any] | None
- static
postal_code : str | None
- static
previous_appointments_json : list[typing.Any] | None
- static
previous_encounters_json : list[typing.Any] | None
- static
procedure_codes_json : list[dict[str, str | None | datetime.datetime | dict[str, str]]] | None
- static
processed_at : datetime.datetime
- static
row_number : int | None
- static
run_id : str | None
- static
tags : dict[str, typing.Any] | None
- static
task_hash : str