Skip to main content

model

Pydantic record for the patient_eligibility cache table (v2).

Classes​

PatientEligibilityRecord​

class PatientEligibilityRecord(**data: Any):

Stored rolled-up per-patient eligibility record (one per patient, trial).

Attributes

  • task_hash: Partition key (config-change isolation).
  • bitfount_patient_id: The Bitfount patient ID (part of the composite key).
  • project_id: The trial (project) ID (part of the composite key).
  • status: Rolled-up patient verdict.
  • evidence: Coherent rollup evidence (scan-level criteria all from the determining scan), shaped {"criteria": {criterion: entry}} where each entry is CriterionEvidence-shaped (see bitfount.cache.types._eligibility_shared).
  • determined_by_scan: The scan that determined the verdict, if any.
  • created_date: When the rollup was created.
  • processed_at: When this row was written.
  • run_id: Provenance — the run ID.
  • tags: Arbitrary flat metadata.
  • eligibility_score: The criteria_tree's resolved root score (see the v2 schema module docstring), or a status-derived fallback for a trial with no ranked branch; None only for a row written before this column existed. A ranking signal only, entirely separate from status.

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 determined_by_scan : str | None
  • static eligibility_score : float | None
  • static model_config
  • static project_id : str
  • static run_id : str | None
  • static status : bitfount.cache.types._eligibility_shared.EligibilityStatus
  • static task_hash : str

ScoredProject​

class ScoredProject(**data: Any):

One project a patient has a verdict for, with its ranking score.

Returned by projects_for_patient_by_status/projects_for_patients_by_status — a narrower read than PatientEligibilityRecord (just the two columns the patient-list/summary endpoints need), so those queries select only what they serve rather than materialising a full row per project.

Carries no status of its own: those queries group by it, so the verdict is the key each of these sits under rather than a field here.

Attributes

  • project_id: The trial (project) ID.
  • eligibility_score: See PatientEligibilityRecord.eligibility_score.

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 eligibility_score : float | None
  • static model_config
  • static project_id : str