Program & Enrollment — How it works
Overview
The program engine models longitudinal care programs and a patient's journey through them: program
definitions with workflows and states, patient enrollment, and state transitions with history. It is
the platform substrate the first domain plug-in (publichealth) builds program content on.
Data model & ownership
| Table | Purpose |
|---|---|
program | A program definition; data_sensitivity; concept-backed outcomes. |
program_workflow | A workflow within a program. |
program_workflow_state | States of a workflow (initial/terminal). |
patient_program | A patient's enrollment (unique open enrollment per patient+program). |
patient_state | The patient's state history (one open state per workflow). |
Key rules & invariants
- Enrollment validates the patient (in-process via demographic) and the program (active, not voided); completion validates the outcome concept (including outcomes-set membership when configured).
- A state transition closes the current open state and opens the new one; a terminal state ends workflow participation; history is append-only (one open state per workflow via a partial unique index + close-before-open flush).
- Enrollment reads are access-scope/visibility filtered (
EnrollmentAccessGuard) with a PHI-free audit carrying the program'sDataSensitivity.
API
See the API Reference. Endpoint groups under /api/v1/program: programs, workflows
and states, patient enrollment (enroll / complete-with-outcome / get / list-by-patient), and patient
state transitions, plus an access-filtered enrollment search.
Configuration & feature flags
None.
Related features
- Demographic (patients), Concept (outcomes),
Workflow (a
ProgramStateChangeHookseam lets the workflow engine react to state changes), Access control (enrollment filtering). Domain plug-ins read/write viaexchange.client.program.