Skip to main content

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

TablePurpose
programA program definition; data_sensitivity; concept-backed outcomes.
program_workflowA workflow within a program.
program_workflow_stateStates of a workflow (initial/terminal).
patient_programA patient's enrollment (unique open enrollment per patient+program).
patient_stateThe 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's DataSensitivity.

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.

  • Demographic (patients), Concept (outcomes), Workflow (a ProgramStateChangeHook seam lets the workflow engine react to state changes), Access control (enrollment filtering). Domain plug-ins read/write via exchange.client.program.