Mazecare Logo
Getting Started

Workflow Definitions Setup

Configure clinical care pipelines using visual state machines that govern how Episodes of Care progress from intake to discharge.

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

  1. Log in to the Mazecare Console using an Administrator account.
  2. Navigate to Settings → Workflow Definitions (/settings/workflow-definitions).
  3. The table lists all existing workflows. You can search, sort, and filter them.
  4. Click + New Workflow Definition to create a new Workflow Definition.

Step 2: Choose a Creation Method

A creation modal opens with three options:

  1. 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").
  2. Press Enter. The system creates a blank workflow and opens the visual editor.
  3. The AI Assistant sidebar generates the complete workflow with states, transitions, and layout.
  4. Review the draft on the canvas, then click Accept to save or Undo to start over.
  5. 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:

TemplateDescription
General PractitionerStandard outpatient GP flow: Registration → Check-in → Triage → Queue → Consultation → Prescription → Discharge.
Patient IntakeMulti-line intake flow with consultation, discharge, and inpatient bed lines. Includes sub-workflow support for WhatsApp notifications.
WhatsApp QuestionnaireWhatsApp-based pre-visit questionnaire for collecting patient information before their appointment.

A two-step wizard guides you:

  1. Select Template: Choose your template card.
  2. 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

  1. Click Create from scratch to start with a blank canvas.
  2. 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:

  1. Add States: Click Add State to place a new stage on the canvas (e.g., Registration, Triage, Consultation, Billing, Completed).
  2. Connect Transitions: Drag from one state's connection handle to another to create a transition arrow.
  3. 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).
  4. 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).
  5. 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.

  1. Navigate to the Detail tab of your Workflow Definition.
  2. 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.
  3. Click Save to persist your context.

Step 5: Bind to Episodes of Care

Once your workflow is ready:

  1. When clinical staff create a new Episode of Care for a patient, they select your Workflow Definition from the dropdown list.
  2. The Episode's Workflow tab displays a live visualization of the patient's current position in the workflow.
  3. Available transitions appear as action buttons. Staff click these to advance the patient through each stage.
  4. All configured automation actions (queue tickets, encounters, invoices, notifications) fire automatically as the patient progresses.
Important
Ensure that all context variables (especially API credentials and entity IDs) are correctly configured before using the workflow in live operations. Missing context values will cause automated actions to fail silently.
Copyright © 2026