RCMbox Docs

Overview

A workflow is a YAML file that describes a billing process as a tree of activities. The engine loads the YAML at runtime from the config project, walks the activity tree, and calls each activity's main function in order.

Minimal example

id: hello
name: Hello

input:
  patientId: string

rootChildren: [fetch-patient]

activities:
  - id: fetch-patient
    script: "@aidbox-billing/fhir/search"
    params:
      url: Patient
      params:
        _id: $input.patientId
    children: [save-result]

  - id: save-result
    script: ./activities/hello/save-result.ts
    params:
      bundle: $activities.fetch-patient.output.bundle

Top-level fields

FieldRequiredDescription
idyesUnique identifier. Must match the filename (without .yaml).
nameyesHuman-readable label shown in the UI.
descriptionnoMarkdown description shown in the UI.
inputnoMap of paramName: type documenting expected input.
rootChildrenyesList of activity IDs to execute first.
activitiesyesList of all activity definitions in the workflow.

Activity fields

FieldRequiredDescription
idyesUnique within the workflow. Used to reference outputs via $activities.id.output.
namenoDisplay name shown in the UI canvas.
scriptyes*Path to the activity script. @aidbox-billing/... for built-in, ./activities/... for project-specific.
paramsnoMap of parameter names to values (literal or $-expression).
childrennoIDs of activities to run after this one completes.
applicabilitynoList of expressions — activity only runs if all are truthy.
retriesnoNumber of retry attempts on failure (default: 0).
timeoutnoActivity timeout as a duration string (e.g. "30s", "5m"). Default: "30s".

* childWorkflow can be used instead of script to invoke a sub-workflow by ID.

Execution model

The engine walks the tree starting from rootChildren. For each activity:

  1. Evaluate applicability — skip the activity (and its subtree) if any expression is falsy.
  2. Resolve params — substitute $input.* and $activities.*.output.* expressions.
  3. Import and call the activity's main(params) function.
  4. Store the output as activities[id].output.
  5. Run children in order.

Execution is sequential within a branch. When an activity has multiple children, those children form independent branches that run concurrently.

Last updated: