Skip to main content

schema

SQLAlchemy ORM for the patient_reviews cache table (v1).

The review currently in force for each patient and trial: a projection of the latest patient_review_events row, kept so the patient listing can join a trial's reviews in SQL rather than replaying each patient's history. It is written in the same transaction as the event it projects. A withdrawn event deletes the row, so review_status is never withdrawn here.

The site review overrides the analysis verdict (patient_eligibility.status) when both exist: a rejected review reads as ineligible. The column is named review_status, not status, so the two stay distinguishable when joined.

Keyed on (project_id, bitfount_patient_id), not task_hash — see bitfount.cache.types._review_shared.

Declares its own local Base (isolated MetaData) inheriting the shared nullable tags column.

Classes​

Base​

class Base(**kwargs: Any):

Local declarative base for patient_reviews 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

PatientReview​

class PatientReview(**kwargs):

SQLAlchemy model for the patient_reviews cache table.

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​

  • bitfount_patient_id : sqlalchemy.orm.base.Mapped[str]
  • created_at : sqlalchemy.orm.base.Mapped[str]
  • created_by : sqlalchemy.orm.base.Mapped[str]
  • created_by_username : sqlalchemy.orm.base.Mapped[str]
  • project_id : sqlalchemy.orm.base.Mapped[str]
  • review_event_id : sqlalchemy.orm.base.Mapped[str]
  • review_status : sqlalchemy.orm.base.Mapped[str]
  • tags : sqlalchemy.orm.base.Mapped[dict[str, typing.Any] | None]