
Workflow engines for FHIR-based systems solve specific problems. Understanding which primitive fits each problem shapes architecture.
Simple event → single-step reaction
FHIR Subscription. Best for one-step notifications, simple event-driven flows.
Multi-step clinical workflows
Camunda (BPMN-based). Best for clinical workflow diagrams and regulated environments.
Code-first multi-step
Temporal. Best for engineering-heavy teams.
FHIR-native scripting
Medplum bots, Aidbox app SDK. Best for vendor-locked event scripting.
Decision matrix
| Situation | Choice |
|---|---|
| Single-step reactive | FHIR Subscription |
| Multi-step BPMN-friendly | Camunda |
| Multi-step code-first | Temporal |
| Vendor-locked | Medplum bots / Aidbox app |
| Complex compensation | Temporal (best) |
FHIR primitives for workflow
1. **Task — work items. 2. CommunicationRequest — messaging. 3. ServiceRequest — orders. 4. CarePlan** — longitudinal care intent.
Common mistakes
1. Application code implementing workflow logic. 2. Subscription for multi-step (distributed state). 3. Workflow engine for simple events. 4. No compensation for failures. 5. State scattered across resources.
Investment considerations
1. Camunda: license + BPMN expertise. 2. Temporal: engineering learning curve. 3. Medplum bots: bundled. 4. Aidbox app: bundled. 5. Subscription: minimal but limited.
Workflow engines are worth the investment when clinical processes span days and multiple systems. Match complexity to primitive.
