Workflow Definitions Setup
Workflow Definitions are visual state machines that automate your clinic's patient journey. Each workflow defines the states (stages like Registration, Triage, Consultation) and transitions (the allowed paths between stages) that govern an Episode of Care from start to finish.
When a receptionist creates an Episode of Care for a patient, they select a Workflow Definition. The system then enforces the correct clinical sequence, automatically fires actions (like creating queue tickets or encounters), and prevents premature steps.
Detailed Step-by-Step Configuration
Step 1: Access the Workflow Definitions Dashboard
- Log in to the Mazecare Console using an Administrator account.
- Navigate to Settings → Workflow Definitions (
/settings/workflow-definitions). - The table lists all existing workflows. You can search, sort, and filter them.
- Click + New Workflow Definition to create a new Workflow Definition.
Step 2: Choose a Creation Method
A creation modal opens with three options:
Option A: AI-Powered Generation (Recommended)
- Type a natural language description of your desired workflow in the AI prompt field (e.g., "Create a GP outpatient flow with registration, triage, consultation, prescription, and checkout").
- Press Enter. The system creates a blank workflow and opens the visual editor.
- The AI Assistant sidebar generates the complete workflow with states, transitions, and layout.
- Review the draft on the canvas, then click Accept to save or Undo to start over.
- You can refine the workflow by sending follow-up prompts (e.g., "Add a pharmacy dispensing step after consultation").
Option B: Create from Template
Select one of three pre-built templates. Each generates a complete, production-ready workflow with pre-configured states, transitions, and automation actions:
| Template | Description |
|---|---|
| General Practitioner | Standard outpatient GP flow: Registration → Check-in → Triage → Queue → Consultation → Prescription → Discharge. |
| Patient Intake | Multi-line intake flow with consultation, discharge, and inpatient bed lines. Includes sub-workflow support for WhatsApp notifications. |
| WhatsApp Questionnaire | WhatsApp-based pre-visit questionnaire for collecting patient information before their appointment. |
A two-step wizard guides you:
- Select Template: Choose your template card.
- Configure Context: Fill in the required context variables for the selected template (e.g., Company, Consultation Item, Queue Lines, API credentials). These variables parameterize the workflow's automation actions.
Click Create to generate the full workflow.
Option C: Create from Scratch
- Click Create from scratch to start with a blank canvas.
- You will manually build the workflow using the visual editor (see Step 3).
Step 3: Design States and Transitions (Visual Editor)
The editor page features a full-screen visual canvas powered by a node-based flow editor:
- Add States: Click Add State to place a new stage on the canvas (e.g., Registration, Triage, Consultation, Billing, Completed).
- Connect Transitions: Drag from one state's connection handle to another to create a transition arrow.
- Configure State Properties: Click any state node to open its side panel:
- Set the state Name.
- Mark it as Initial (starting point) or Final (endpoint that completes the workflow).
- Add Entry/Exit Actions — automated HTTP calls that fire when the workflow enters or leaves this state (e.g., create an encounter, generate an invoice).
- Configure Transition Properties: Click any transition edge to open its panel:
- Set the transition Name (e.g., "Start Triage", "Complete Consultation").
- Add Conditions that must be met before the transition is allowed (e.g., require an encounter to be signed before transitioning to Billing).
- Save your workflow with Cmd+S (Mac) or Ctrl+S (Windows).
Step 4: Configure Context Variables
Context variables are key-value pairs that parameterize your workflow's automation actions. They allow the same template to work across different configurations.
- Navigate to the Detail tab of your Workflow Definition.
- In the Contextsection, add or edit key-value pairs:
- Authentication:
clientId,clientSecret— API credentials for automated actions. - Entity References:
consultationItemId,consultationUnitEntityId— IDs linking to your clinic's specific services and resources. - Queue Configuration:
consultLineId,dischargeLineId— IDs linking to your QMS Lines.
- Authentication:
- Click Save to persist your context.
Step 5: Bind to Episodes of Care
Once your workflow is ready:
- When clinical staff create a new Episode of Care for a patient, they select your Workflow Definition from the dropdown list.
- The Episode's Workflow tab displays a live visualization of the patient's current position in the workflow.
- Available transitions appear as action buttons. Staff click these to advance the patient through each stage.
- All configured automation actions (queue tickets, encounters, invoices, notifications) fire automatically as the patient progresses.