Complex workflow, independent of specialty
This adult oncology sample shows how to coordinate care across diagnostic, multidisciplinary, pharmacy, treatment-record, and follow-up processes, including diabetes and renal comorbidity review. Clinicians record the decisions and authorisations; the workflow organises their reviews and requires supporting clinical records.
Download the oncology workflow JSON — a sample draft with 21 stages, 26 transitions, and two paths to try. Connect it to your own templates, forms, queues, and roles before starting an instance.
Workflow editor
How the workflow runs
| Process | Stages and behavior |
|---|---|
| Episode intake | Referral review opens three independent tasks: diagnostic review, staging review, and diabetes/renal/comorbidity review. |
| Multidisciplinary review | The MDT task waits for all three reviews. It then opens parallel consent, pharmacy, and supportive-care review tasks. |
| Readiness decision | All three readiness reviews must finish. An explicit decision selects proceed or hold. Hold requires a reassessment record. |
| Cycle 1 authorisation and record | Either readiness route rejoins at a clinician authorisation task. Administration documentation opens only after authorisation. |
| Post-cycle and complication review | An explicit decision selects complication or no_complication. The complication route requires management and reassessment documentation. |
| Cycle 2 | Either complication route rejoins at a fresh review, followed by separate clinician authorisation and administration documentation. |
| Next care and closure | Response review leads to a follow-up plan and explicit episode closure. |
join_policy: "all" makes required parallel reviews wait for one another. join_policy: "any" is used at the two mutually exclusive branch rejoins: treatment_authorisation and cycle2_review. Resolving a hold still leads through the same clinician authorisation step as the proceed route.
Every stage requires a supporting clinical composition and clinician_reviewed: true. Decision stages also require a decision field with one of the allowed values. Authorisation and administration-record stages require additional acknowledgements alongside their clinical records.
Import and bind the clinical scenario
The download is a WorkflowDefinitionCreate payload for POST /workflows/definitions. Its definition.binding_requirements lists the clinical record and queue needed for each stage. Use it as a configuration checklist. Every stage declares requires_clinical_evidence: true, so launch requires template/form bindings for all stages and a patient for the instance. This requirement also applies after the draft is activated.
- Review the draft and set its tenant, organisation, and environment using your local identifiers.
- Import the draft, then retrieve its actual definition, version, and stage identifiers from
GET /workflows/definitions. - Resolve each capture contract to an active template and, where needed, a published form. Create its stage binding with
POST /workflows/stage-form-bindings, using the actual stage and template/form identifiers and composition category. - Configure each stage's queue and authorised roles, matching the example's queue names to your local queues.
- Review and activate an accepted version through the definition update operation. Re-read the new version’s stage identifiers; definition edits create new versions.
- Start an instance for a test patient and encounter using
POST /workflows/instances/planned, then work through the queues and tasks.
At launch, the instance retains its workflow version and each stage’s queue and required form/template versions. These requirements stay fixed for that instance when a newer version is published. To change form bindings after instances have started, create a new workflow version for subsequent instances.
Link clinical records
Complete each task with stored composition version IDs in outcome_data.composition_version_ids. Each required binding needs a current active complete composition version for the workflow patient, tenant, and encounter, and the EHR when pinned. It must match the task’s required template and template version. A form binding also requires the corresponding stored form provenance.
Use composition version IDs rather than form or uploaded-document IDs. Deleted, superseded, incomplete, mismatched, other-patient, and other-encounter records are rejected. The task links to the submitted versions after all completion checks pass.
The task also checks its required outcome values and expression conditions. Unsupported completion rules are rejected. CQL bindings are not executed as clinical checks by this workflow runtime.
Try both paths
| Replay path | Decisions | Expected skipped stages |
|---|---|---|
proceed_without_complication | Readiness: proceed; complication review: no_complication. | hold_resolution, complication_management. |
hold_then_complication | Readiness: hold; complication review: complication. | None. |
The JSON’s definition.validation_paths records both sets of decisions. Start a separate test instance for each path. Only intake should open initially. After intake, complete the parallel reviews in any order and check that their shared next stage waits for every required review. Follow the selected route at each decision; skipped stages should stay closed, and each branch rejoin should open once.
Use sample clinical records created with the bound template/form versions for the same test patient and encounter. Also try a missing decision or an unsuitable record, such as one for another test patient or a superseded version. Completion should be rejected, leaving the task and later stages unchanged. Repeating a successful completion should not create duplicate tasks.
Failure and recovery
When completion is rejected, use the returned reason to correct the acknowledgement, decision, access, or clinical record. For a deleted or superseded record, submit a current complete composition version matching the task’s required template version and clinical context.
A hold keeps its reassessment task open until its requirements are met. A failed task blocks dependent stages. To recover a failed stage, review its event history, record the reason, and use the super-administrator forced requeue operation. The task must still meet its completion requirements. Completed or cancelled planned stages cannot be reopened, including by force.
If the workflow, clinical bindings, patient/encounter context, or required template version must change, create an approved new version or a reviewed replacement instance as appropriate. Keep the original instance and its record history. A closed encounter cannot advance. Running instances are not migrated automatically.
Scope and limits
The runtime supports a finite graph with no loops. Cycle 1 and cycle 2 are separate stages in this example. Indefinite cycles, compensation, and automatic retries are not supported.
Configure and review the clinical meaning, templates, units, source mappings, permissions, and queue ownership for your service before operational use. Treatment protocols remain part of local clinical practice.
To add clinical graphs, configure their observation sources, measurement times, units, provenance, and patient/encounter scope. See Clinical Graphing and Data Evidence, Workflow Orchestration and Enforcement, Workflow Foundation Bindings, and Templates and Form Designer.