Skip to main content

schema

SQLAlchemy ORM for the patient_notes cache table (v1).

Notes a site user writes about a patient for a trial. A note is either standalone or written with a review, in which case review_event_id names that patient_review_events row and the Trials app shows the two as one timeline entry. Withdrawing or replacing the review leaves its note in place.

Notes are not edited yet. The edited_by, edited_by_username and edited_at columns are reserved for if they become editable: they are always NULL today. Deleting one is a soft delete: deleted_by, deleted_by_username and deleted_at are set and the body is kept; readers filter deleted notes out.

body may contain PII and is stored plaintext, like the rest of the cache (see patients/v3/schema.py). It must never be sent off the site.

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_notes 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

PatientNote​

class PatientNote(**kwargs):

SQLAlchemy model for the patient_notes 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]
  • body : 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]
  • deleted_at : sqlalchemy.orm.base.Mapped[str | None]
  • deleted_by : sqlalchemy.orm.base.Mapped[str | None]
  • deleted_by_username : sqlalchemy.orm.base.Mapped[str | None]
  • edited_at : sqlalchemy.orm.base.Mapped[str | None]
  • edited_by : sqlalchemy.orm.base.Mapped[str | None]
  • edited_by_username : sqlalchemy.orm.base.Mapped[str | None]
  • id : sqlalchemy.orm.base.Mapped[str]
  • project_id : sqlalchemy.orm.base.Mapped[str]
  • review_event_id : sqlalchemy.orm.base.Mapped[str | None]
  • tags : sqlalchemy.orm.base.Mapped[dict[str, typing.Any] | None]