Technical

Data model

What the tables are, what they hold, and the few invariants you need to know.

Identity

  • User · Organization · OrganizationMembership
  • PatientProfile — the PHI anchor; every PHI-bearing row carries patient_profile_id
  • CaregiverAccess (scope READ|WRITE) · ClinicianAccess

Disease state

  • CancerType (reference) · CancerStage (reference)
  • Diagnosis — open cancer_type / subtype / histology, stage + staging_system, hormone-receptor status, smoking history
  • Biomarker — free-text marker (gene or name), status enum incl. EQUIVOCAL / NOT_TESTED

Treatment & observations

  • Treatment + TreatmentCycle (response, side_effects, reason_stopped)
  • Medication — patient-entered, no dosing
  • SymptomEntry, LabResult, ImagingStudy (with optional DocumentUpload link)
  • PathologyReport, GenomicsReport

Records & timeline

  • DocumentUpload — links to timeline event / diagnosis / treatment; review_flag
  • TimelineEvent — single writer in services/timeline.py
  • Appointment, DoctorQuestion, ClinicianSummary

Consent / audit / research

  • ConsentRecord — append-only history
  • AuditLog — append-only, indexes actor + entity + patient
  • ResearchExport — created by admin

Reserved (later phases)

TumorStateAssessment, ResearchHypothesis, EvidenceCard, DataSource, DataSet, DataSetVersion, DataIngestionJob, EvidenceLink, IdentifierMapping, plus the public-data tables (PublicCellLine, PublicDrug, PublicDrugResponse, PublicDrugCombination, PublicTrial).

Note

Alembic is the source of truth. DEV_AUTO_CREATE_TABLES is off; the only way to evolve the schema is alembic revision --autogenerate followed by upgrade head.