Purpose
A workflow defines stages, transitions, queue routing, task ownership, required forms, and completion criteria. openEHR templates define the clinical content recorded during those stages.
Users work from assigned tasks in the correct patient and encounter context. Submitted compositions must satisfy the stage’s completion rules, and each transition records the actor, role, and time.
Tested planned-workflow runtime
Start with the 21-stage adult oncology validation example for a downloadable process, parallel reviews, explicit decisions, evidence requirements, authoring screenshot, and recovery checks. The planned runtime described here supports a finite directed acyclic graph; repeated cycles require distinct stage keys or a separately reviewed instance.
POST /workflows/instances/planned pins the workflow version and snapshots every stage’s queue and template/form evidence versions at launch. Tasks open when their incoming edges and preconditions permit them. Parallel reviews use join_policy: "all"; mutually exclusive branch rejoins use join_policy: "any". The scheduler creates eligible tasks after explicit task completion. A decision stage does not independently diagnose, calculate clinical clearance, prescribe, or administer treatment.
Stages marked requires_clinical_evidence: true cannot launch without a patient and real template/form bindings. Completion requires current active complete composition versions in outcome_data.composition_version_ids, matching the pinned clinical contract and patient/tenant/encounter context. Outcome acknowledgements and supported conditions are additional checks; a form UUID, uploaded document ID, or unchecked flag is not clinical evidence.
| Supported control | Planned-runtime meaning |
|---|---|
preconditions; transition conditions | Lists of supported openEHR_EL expressions evaluated before a stage or route becomes eligible. |
required_outcome_fields, required_outcome_values, completion_conditions | Explicit completion inputs and expression checks. Conditions use the supplied outcome, for example outcome.decision = 'proceed'. |
allowed_role_keys | Restrictions checked against the authenticated actor’s roles. |
join_policy, requires_clinical_evidence | Declared all/any joins and mandatory governed evidence bindings. |
Binding workspace_module, task_type, foundation_projection | Studio or projection metadata retained for separate integrations. The configured integration must carry out the operational action. |
Use canonical rule lists in new definitions. For stage authoring, guard, condition, and precondition aliases normalize to preconditions; postcondition normalizes to completion_conditions. Transition aliases normalize to transition conditions. Stage keys accept stage_key or key; transition endpoints accept from_stage_key/to_stage_key, from_state/to_state, or from/to. Separate stage-form binding requests should use the canonical completion-rule keys shown above.
Unsupported completion rules such as required_fields, advance_when, and arbitrary CQL bindings fail explicitly in this planned runtime. Template constraints validate clinical composition content; supported workflow conditions validate process inputs. Workflow-wide conditions, implicit dependency rules, arbitrary overrides, loops, automatic retries, and compensation are not supplied by declaring extra JSON fields.
Requeue returns an eligible task to ready in its existing queue, clears its assignment, and preserves its clinical context and evidence contract. It does not transfer the task to another queue or perform clinical re-triage. A failed planned stage requires an explicit super-administrator forced requeue for recovery. Completed or cancelled planned stages cannot be reopened, including by force; force cannot bypass clinical completion requirements.
Core Workflow Objects
| Object | Purpose | Production expectation |
|---|---|---|
| Workflow definition | Named process such as registration, medication dispense, birth, death, transfer, laboratory, or discharge. | Uses a stable key, domain, status, owner, and versioned definition. |
| Workflow version | Immutable version of the definition that owns stages and transitions. | Active clinical instances reference a version so changes do not rewrite historical workflow behavior. |
| Workflow stage | Required process state such as triage, verify order, dispense, newborn assessment, or discharge review. | Each stage has a key, type, owner or queue, expected role, and completion evidence. |
| Previous-stage link | Authoring shortcut that links a stage to the stage that must precede it. | AMCDR generates transitions from these links so local teams can build linear, branched, queue-based, or decision-based pathways from scratch. |
| Workflow transition | Allowed movement from one stage to another. | Planned transitions use validated condition lists and explicit joins; supported authoring aliases normalize to those lists. |
| Workflow instance | Runtime occurrence of a definition for a patient, visit, encounter, order, referral, birth event, or death case. | Instances carry patient, visit, encounter, tenant, organisation, facility, and source context. |
| Workflow task | Actionable item routed to a user, role, queue, or service lane. | Tasks support open, assign, complete, fail, requeue, event history, priority, due time, and audit. |
| Task queue | Operational worklist such as triage, pharmacy, laboratory, registration review, MPI review, priority queue, or billing. | Queues define assignment mode, eligible roles, service key, owner, ticket prefix, priority rank, and routing policy. |
| Stage form binding | Connection between a workflow stage and an approved form or openEHR template. | Required stages specify the form, template, composition type, completion rules, and foundation projections. |
| Artifact link | Evidence that connects a workflow instance or task to a composition, document, order, result, referral, or external resource. | Completion must leave evidence that can be reviewed, queried, audited, and monitored. |
Stage Linking And Queue Routing
The Worklists screen keeps workflow configuration within one Workflow kernel workspace. Its Workflow definitions, Workflow stages, and Queue routing policy tabs share the same in-progress draft, so switching tabs does not lose changes. Only the selected editor is displayed, and its content scrolls inside the available workspace height to avoid an excessively long application page. On wider screens, the Workflow definitions register and definition editor use separate columns and independent scrolling so the selected definition cannot cover its editable fields.
Workflow stages are configurable. A deployment can start with seeded outpatient, inpatient, emergency, neonatal, and vaccination examples, or create a new workflow from an empty definition. In the authoring workspace, each non-starting stage can select its previous stage. AMCDR uses those previous-stage links to produce the transition graph. Existing explicit branches, joins, and conditions are preserved while editing stage details or display order; more complex routing is configured through the transition editor. Planned workflows remain acyclic.
| Configuration item | What it controls | Example |
|---|---|---|
| Previous stage | Defines the stage that must be completed before the current stage can begin. | Triage assessment follows triage queue. |
| Queue stage | Places the patient, order, referral, or task into an operational queue. | Patient enters Emergency Triage Queue. |
| Decision stage | Records an explicit decision; transition conditions select the next route after successful task completion. | A clinician records proceed or hold in a readiness review. |
| Requeue | Returns an eligible task to ready in the same queue, preserving its context and evidence contract. | An authorised recovery action returns a failed review task to its original worklist. |
| Ticket prefix | Generates reusable queue numbers by service lane. | E0234 for emergency, OP0001 for outpatient, IP0001 for inpatient. |
Queue numbers are operational identifiers. They may be reused according to local numbering policy and must not replace patient identifiers, MRNs, EHR IDs, or clinical document identifiers.
Transfer Queues
A transfer creates work for the sending service, receiving service, transport staff, and sometimes an external facility. Transfer queues track those responsibilities alongside the patient’s movement.
| Transfer queue | Purpose | Example owner |
|---|---|---|
| Internal transfer queue | Routes a patient between departments, wards, rooms, beds, theatres, imaging, ICU, maternity, or neonatal units within the same organisation. | Receiving ward, ICU team, theatre desk, radiology department. |
| External outgoing transfer queue | Tracks patients, referrals, transfer requests, and handover packages being sent from this facility to another facility or partner service. | Referral coordination team, ambulance desk, sending clinician, source facility transfer desk. |
| External incoming transfer queue | Tracks patients referred or transferred into this facility from an external hospital, clinic, programme, or connected AMCDR instance. | Receiving facility, emergency department, specialist clinic, admissions team, receiving facility transfer desk. |
| Acceptance queue | Supports accept, reject, request information, schedule arrival, or escalate transfer decisions. | Receiving consultant, bed manager, referral desk. |
| Arrival queue | Holds accepted inbound transfers until registration, arrival confirmation, encounter creation, and receiving assessment are complete. | Registration, triage, receiving nurse, receiving clinician. |
Outgoing transfers and incoming transfers are separate but linked workflow directions. An outgoing transfer starts from the sending facility and tracks referral package preparation, destination selection, acceptance status, transport, and handoff. An incoming transfer starts at the receiving facility and tracks referral review, MPI matching, acceptance, arrival confirmation, receiving encounter creation, and handoff into the local care pathway.
When AMCDR deployments are networked, an external facility can send a transfer request, referral package, or FHIR-based notification into the receiving AMCDR instance. The receiving instance creates an external incoming transfer queue item, links it to the incoming patient identity or MPI candidate, and requires an acceptance decision before the patient is merged into a local visit or encounter workflow.
For the full operational transfer model, use Transfers and Networked Referrals.
{
"transfer_type": "external_outgoing",
"source_facility": "Sending Hospital A",
"destination_facility": "Partner Hospital B",
"queue_name": "External Transfer Coordination",
"owner_type": "facility",
"owner_display": "Sending Hospital A - Transfer Desk",
"status": "awaiting_destination_acceptance",
"priority": "urgent",
"reason": "higher level of care",
"linked_referral_package": "document-reference-id"
}
{
"transfer_type": "external_inbound",
"source_facility": "Partner Hospital A",
"destination_facility": "Receiving Hospital B",
"queue_name": "Inbound Referral Review",
"owner_type": "facility",
"owner_display": "Receiving Hospital B - Referral Desk",
"status": "awaiting_acceptance",
"priority": "urgent",
"reason": "higher level of care",
"linked_patient_state": "mpi-review-required"
}
Inbound transfer acceptance can create or select the local patient, open the receiving visit and encounter, assign the patient to the correct service queue, and preserve the external referral package as linked clinical evidence. Rejection, information request, cancellation, arrival, and handoff are all auditable transfer lifecycle events.
For networked AMCDR deployments, the sending platform can create and submit the outgoing referral or transfer, export the referral package as FHIR or openEHR-linked evidence, and notify the destination. The receiving platform can create or locate the corresponding referral record, mark it received, accept or reject it, then start the receiving workflow after MPI review and local context creation.
Sending AMCDR instance:
POST /care-coordination/referrals
POST /care-coordination/referrals/{referral_id}/submit
GET /care-coordination/referrals/{referral_id}/fhir
GET /care-coordination/referrals/{referral_id}/openehr
Receiving AMCDR instance:
POST /care-coordination/referrals
POST /care-coordination/referrals/{referral_id}/receive
POST /care-coordination/referrals/{referral_id}/accept
POST /care-coordination/referrals/{referral_id}/reject
POST /care-coordination/referrals/{referral_id}/start
POST /care-coordination/referrals/{referral_id}/complete
The receiving organisation controls identity matching, protected-record access, acceptance, local visit and encounter creation, queue assignment, and audit. Use signed partner notifications and authorised pull APIs where available.
Emergency Triage And Priority Queues
Emergency workflows can link triage assessment to queue routing. The triage form is bound to the triage assessment stage, the captured clinical facts are evaluated by the configured acuity policy, and the patient is routed to the correct priority queue.
Registration
-> Encounter created
-> Patient enters triage queue
-> Nurse records triage variables
-> System calculates acuity category
-> Patient is moved into priority queue
-> Consultation / investigation / treatment / discharge
A triage assessment commonly captures blood pressure, pulse, respiratory rate, temperature, SpO2, pain score, consciousness level, presenting complaint, age risk, and danger signs. The operational projection can store calculated acuity, nurse override acuity, final acuity, and reason for override as workflow facts linked to the encounter.
{
"encounter_id": "encounter-id",
"triage_assessment": {
"vital_signs": "composition-uid",
"presenting_complaint": "shortness of breath",
"danger_signs": ["severe_respiratory_distress"],
"calculated_acuity": "red",
"nurse_override_acuity": null,
"final_acuity": "red",
"reason_for_override": null
},
"queue_assignment": {
"queue_type": "clinical_priority",
"queue_name": "Red Queue",
"priority_rank": 1,
"ticket_number": "E0234",
"assigned_at": "2026-06-14T09:20:00Z",
"status": "waiting"
}
}
Priority queues are sorted by clinical urgency first, then queue policy: Red, Orange, Yellow, Green, and Blue. A simple rule can state: if SpO2 is below 90%, unconsciousness is true, or severe respiratory distress is present, route to Red. Local deployments can extend those rules and allow authorised nurse override with a documented reason.
How To Create A Workflow
- Define the workflow purpose, domain, owner service, patient or encounter scope, and expected outcome.
- Define stages with stable stage keys, user-facing names, stage types, owners, queues, eligible roles, and required evidence.
- Define explicit transition edges, supported condition lists, all/any joins, and a reviewed failure-recovery process. Represent each repeated cycle with separate stage keys.
- Create task queues and routing policy for each stage that needs human or service work.
- Publish the clinical templates and forms that collect the required evidence for each stage.
- Create stage-form bindings and completion rules so submitted compositions can satisfy workflow requirements.
- Validate the workflow in a test environment by creating instances, opening tasks, completing tasks, and checking event history.
- Activate the workflow only after access policies, queues, forms, dashboards, and failure handling are ready.
Workflow Definition API
Workflow definitions are managed through the workflow API. The API stores the definition, version, stages, transitions, and validation result as governed configuration.
GET /workflows/definitions
POST /workflows/definitions
PUT /workflows/definitions/{definition_id}
DELETE /workflows/definitions/{definition_id}
{
"key": "clinical-review-example",
"name": "Clinical review and follow-up example",
"workflow_domain": "clinical",
"status": "draft",
"definition": {
"purpose": "Synthetic process example; bind local clinical templates/forms and queues before launch."
},
"stages": [
{
"stage_key": "assessment_review",
"name": "Assessment review",
"stage_type": "task",
"definition": {
"requires_clinical_evidence": true,
"required_outcome_values": {
"reviewed": true
}
}
},
{
"stage_key": "followup_review",
"name": "Follow-up review",
"stage_type": "task",
"definition": {
"requires_clinical_evidence": true,
"required_outcome_values": {
"plan_recorded": true
}
}
}
],
"transitions": [
{
"transition_key": "assessment-to-followup",
"from_stage_key": "assessment_review",
"to_stage_key": "followup_review",
"definition": {
"conditions": [
"outcome.reviewed = true"
]
}
}
]
}
Import this draft, then bind its stages to your templates, forms, and queues before launch. A symbolic queue_key needs a matching queue identifier. The oncology example lists the mapping required for each stage.
Binding A Workflow To Forms And Templates
Stage-form bindings define which form or template is required for a workflow stage and its supported completion rules. Bindings can also retain foundation projection declarations for separate operational integrations. The planned-task evidence validator does not execute those effects merely because the declarations are present; follow the linked foundation integration guide for each implemented action.
Separately configured form/runtime integrations can use foundation projection inputs for actions such as identity resolution, encounter creation, referral processing, or worklist routing. Their declarations belong under completion_rules.foundation_projection.workflow_inputs; a top-level binding workflow_inputs key is not a supported planned-task completion rule. See Workflow Foundation Bindings for that integration boundary.
GET /workflows/stage-form-bindings
POST /workflows/stage-form-bindings
The following is a schematic binding request: replace the bracketed values with real database UUIDs. template_id is a UUID, not a template key. required_composition_type matches the composition category, such as event or persistent; payload formats such as FLAT are not composition categories.
{
"workflow_stage_id": "<actual-stage-uuid>",
"template_id": "<actual-template-uuid>",
"form_definition_id": "<actual-published-form-definition-uuid>",
"required_composition_type": "event",
"completion_rules": {
"required_outcome_fields": [
"reviewer_note"
],
"required_outcome_values": {
"clinician_reviewed": true
},
"completion_conditions": [
"outcome.clinician_reviewed = true"
]
}
}
How A Workflow Is Followed
- A workflow instance is created from an active definition and version.
- The runtime creates the first task or planned task with patient, visit, encounter, order, referral, or event context.
- The task is routed to the configured queue, role, user, or service lane.
- A user opens, claims, assigns, completes, fails, or requeues the task from the worklist.
- The required form is opened from the task or encounter context, not as a detached generic form.
- The clinical submission is validated against its template. Task completion separately supplies its persisted composition version ID for the pinned evidence checks.
- The planned runtime validates explicit outcome requirements, supported conditions, actor roles, and required composition evidence before recording task completion. Separate foundation integrations have their own execution and audit paths.
- Transition conditions and all/any joins determine which downstream tasks are created after successful completion.
- Task creation, assignment, completion, failure, recovery, and linked evidence are recorded for review. Privileged recovery does not bypass clinical evidence or reopen a completed/cancelled planned stage.
POST /workflows/instances/planned
GET /workflows/tasks/active
GET /workflows/tasks/notification-summary
PATCH /workflows/tasks/{task_id}/open
PATCH /workflows/tasks/{task_id}/complete
PATCH /workflows/tasks/{task_id}/fail
PATCH /workflows/tasks/{task_id}/requeue
GET /workflows/tasks/{task_id}/events
GET /workflows/tasks/notification-summary is the lightweight application-shell contract. It returns payload-free counts for personally assigned work and authorized identity-steward reviews after tenant, queue, role, and membership filtering. The shell polls this summary rather than downloading the complete active worklist.
How AMCDR Enforces A Workflow
| Mechanism | What it enforces |
|---|---|
| Route policy and RBAC | Only authorised users, memberships, roles, and services can act on workflow tasks. |
| Task queues | Work appears in the correct operational queue instead of relying on manual navigation. |
| Assignment mode | Tasks can be user-owned, role-owned, service-owned, or queue-owned according to policy. |
| Transition guards | Stages advance only when required conditions are satisfied. |
| Stage-form bindings | Required forms and templates are attached to the stage that owns the work. |
| Completion rules | The planned task requires declared outcome fields/values, supported expression conditions, and matching persisted composition evidence. Template validation governs clinical field constraints. |
| Clinical safety and CDS | Medication, neonatal, laboratory, and other rules can create tasks, warnings, or stop conditions. |
| Audit and provenance | Task events, permitted recovery actions, composition-version artifact links, and completion results retain reviewable provenance. |
Workflow Examples
| Workflow | Typical stages | Required evidence |
|---|---|---|
| Registration | Resolve client, registration type, demographics, relationships, coverage, operational context, review. | Patient identifier, EHR identifier, MPI outcome, coverage, visit or encounter decision, registration acknowledgement. |
| Emergency department | Registration, encounter created, triage queue, triage assessment, acuity calculation, priority queue assignment, consultation, investigation, treatment, discharge. | Temporary or resolved identity, triage composition, calculated acuity, final acuity, queue assignment, encounter context, disposition, reconciliation event. |
| Outpatient | Registration, outpatient queue, vitals or triage, consultation, investigation, treatment or pharmacy, close visit. | Patient/EHR, visit, encounter, clinical forms, orders, treatment record, discharge or checkout evidence. |
| Inpatient | Admission, allocation, ward care, investigation, treatment, transfer, discharge. | Admission evidence, resource allocation, ward/procedure records, transfer events, discharge summary. |
| Maternity | Antenatal review, maternity triage, risk assessment, labour or delivery, postnatal review, discharge or follow-up. | Maternal patient/EHR, pregnancy episode, maternity encounter, optional maternity variables, risk flags, birth workflow handoff where applicable. |
| Medication | Order, safety review, dispense, administer, monitor, reconcile. | Medication order, CDS result, dispense record, administration record, adverse event or reconciliation where applicable. |
| Birth | Birth event, newborns, mother relationship, MPI reconciliation, review. | Mother link, newborn patient and EHR, birth details, Apgar, birth weight, sibling links for multiples. |
| Neonatal | Delivery event, newborn identity, neonatal assessment, NICU or routine care, daily review, discharge or follow-up. | Newborn patient/EHR, mother-child link, neonatal assessment, optional neonatal variables, NICU/routine care records, discharge/follow-up plan. |
| Vaccination | Registration, eligibility check, vaccination, observation, discharge. | Eligibility assessment, consent where required, vaccine administration, observation outcome, follow-up advice. |
| Transfer | Request, package, receiving review, accept or reject, movement, handoff close. | Transfer request, summary, receiving decision, movement event, linked records. |
| Death | Known patient death, unknown deceased, humanitarian case, identity reconciliation, review. | Death details, certifier, cause, place, identity status, death documentation composition. |
Maternity workflows use optional variables selected by the hospital deployment. Common examples include gestational age, fetal movement, vaginal bleeding, contractions, ruptured membranes, abdominal pain, blood pressure or pre-eclampsia signs, seizures, fetal heart rate, and previous C-section or obstetric risk history. These variables can be added to foundation projections only when a local form, queue rule, risk policy, or report needs them.
Optional stage variables are selected by the hospital deployment. For neonatal workflows, variables such as birth weight, oxygen saturation, jaundice, feeding difficulty, seizures, and prematurity can be added to the projection only when a local form, queue rule, or report needs them. Once selected, the variable is removed from the available binding list so it is not mapped twice.
Workflow And openEHR
Clinical observations, evaluations, instructions, actions, and documents are stored as openEHR compositions. Workflow records track their process state, responsibilities, and associated events.
| Workflow concern | openEHR concern |
|---|---|
| Who must do the next step? | Which clinical template captures the content? |
| Which stage is active? | Which composition stores the observation, action, evaluation, instruction, or document? |
| Can this task be completed? | Does the submitted composition satisfy template constraints? |
| Should the patient move to the next queue? | Which template fields project into encounter, movement, resource, or reporting state? |
| What audit evidence proves the workflow was followed? | Which versioned composition and lifecycle events prove the clinical record? |
Monitoring And Audit
Production deployments should monitor active tasks by queue, overdue tasks, failed tasks, stage duration, transition denial, override rate, workflow completion rate, and stale workflow instances. Clinical metric dashboards can expose governed aggregate workflow indicators such as births, newborns, NICU admissions, emergency arrivals, medication safety interventions, and discharge completion.
Production Checklist
- Each active workflow has a stable key, domain, owner, version, stages, transitions, and status.
- Each active stage has an owner, queue or assignment policy, eligible roles, and required evidence.
- Required stages are bound to approved forms, templates, and completion rules.
- Transition guards are configured for safety-sensitive workflow movement.
- Queues are visible in Worklists and have the correct role membership.
- Instances carry patient, visit, encounter, facility, and source context where applicable.
- Task transitions require an authenticated actor and are written to event history.
- Completion links the task to the clinical composition or operational artifact that proves the work.
- Overdue, failed, blocked, and stale tasks are visible in monitoring and operational reports.
- Workflow definitions are versioned and never silently rewrite historical instances.
Related Guides
- Clinical Workflow Validation: Oncology Example for the tested planned runtime, downloadable 21-stage scenario, evidence requirements, and recovery limits.
- Workflow Foundation Bindings for field-to-foundation projection rules.
- Clinical Fact and Guideline Guardrail Workflows for template-derived facts, CDS decisions, alerts, and workflow task creation.
- End-to-End Clinical Workflow Guide for the full production sequence.
- Templates and Form Designer for template-led form design.
- Platform Monitoring for workflow and runtime monitoring.