L
Leaphealth - OSDocs

Routine node

The Routine node fires repeatedly on a schedule, on events, on missed events or when a condition starts to hold, and tracks streaks, check-ins and goals.

The Routine node (code name Repeat) keeps firing for as long as it runs. Each time it fires, it starts a new branch down its outgoing connections, while the Routine itself carries on. Use it for daily check-ins, medication adherence, "no reading for 3 days" alerts and goals such as a target weight.

It is the most complex flow node. Several fields take raw seconds or expressions, so plan the routine on paper first and test it on a test patient.

When to use it

  • Something should happen again and again: every morning at 9, or every time an event arrives.
  • You want to act when an expected event does not happen, such as no glucose reading within 24 hours.
  • You want to send a check-in (a probe) on a cadence and escalate when replies are missed.
  • You want to follow a measure towards a target and act when it is reached, off track or stalled.

Configuration

Repeat when

Pick at least one way the routine repeats: Pick at least one way this routine repeats.

Field

What it does

Options and default

An event happens: Event

Fires each time this event arrives.

Catalog events, listed by name. Events of journeys themselves (journey lifecycle and linked-journey events) are not offered.

On a schedule

Fires at each moment of a recurrence. Select On a schedule to add it.

Recurrence builder. Default every day at 09:00 in the patient's timezone: Falls back to the centre's timezone, then the tenant's default timezone.

An expected event is missing: Expected event, Within (seconds)

Fires a miss when the expected event has not arrived within the window.

When a schedule is also set, the window is checked at each schedule moment, not continuously.

A condition starts to hold

Fires once each time the condition changes from false to true.

Condition builder (same fields as Skip this step when…).

Advanced

Field

What it does

Options and default

Per active medication order (group id)

Runs one copy of the routine for each active medication order in this group.

Number. Empty runs one routine for the patient.

Streaks: After, Outcome

Changes the outcome once the routine has fired a given number of times in a row. Use Add streak step.

For example after 3 → third_day.

Stop when

Ends the routine when this condition holds, with the outcome Exit condition met.

Condition builder. Required when a Monitor is set: A monitor needs a stop condition.

Monitor: Probe

Sends a check-in on a cadence. The probe is a Reach (message) or Capture (form), configured inline with the same panel as those nodes.

—, Reach, Capture.

Every (seconds)

How often the probe goes out.

Seconds. 86400 = one day.

Response window (seconds)

How long the patient has to reply before it counts as a miss.

Seconds.

When probes are missed

Streak rows for misses: after N misses in a row, use this outcome.

Default outcome for a miss is Missed once.

Goal: Measure

The patient measure to follow, by its key.

For example weight_kg.

Target

The value that counts as achieved.

Number. Reached when the latest value is at or above the target.

Deadline expression

When the goal must be met, as an expression that gives a time.

If it has passed when the routine starts, no deadline is set.

Off-track when, Off-track outcome

A condition over Measured value and Target, and the outcome name to use when it starts to hold.

Free text outcome.

Stall window (seconds)

Fires Stalled when the measure has not moved for this long.

Seconds.

If this step is already in the past

See If this step is already in the past.

Follow the journey.

A monitor also needs an event that counts as the reply: A monitor needs an event set as the reply — pick one under Event, or every cycle counts as a miss. Set it under An event happens or An expected event is missing.

Outcomes and branches

Outcome

When it fires

Routine keeps running?

Fired

A schedule moment, a matching event, or a condition starting to hold

Yes

Missed once

An expected event did not arrive in time, or a probe got no reply in its window

Yes

Goal missed

The goal deadline passed before the target was reached

No

Goal achieved

The measure reached the target

No

Off track

The Off-track when condition started to hold

Yes

Stalled

The measure has not moved for the stall window

Yes

Exit condition met

Stop when held

No

Nothing to run on

The routine runs per medication order and the patient has none

No

In the edge editor, pick these names in the Outcome list of a connection leaving the Routine. A streak row replaces the usual outcome with the name you gave it once the streak reaches the threshold. To route on a streak outcome, add a connection whose condition is Completed outcome == the name you gave it.

What happens when it runs

  • When the patient reaches the Routine, it starts waiting for its first scheduled moment and for its events. If it runs per medication order, it runs one copy per active order; with no orders it ends at once with Nothing to run on.
  • Each firing starts a new branch down the matching connections. The patient can be in several of those branches at once while the Routine keeps running.
  • Stop when is checked as the routine runs. Achieving the goal, missing the goal deadline, or the stop condition ends the Routine with that outcome.
  • If the routine runs on a schedule and no timezone is set for the patient, their centre or the tenant, the step fails.
  • A monitor probe sends its message or form each cycle. A reply resets the miss streak; no reply in the window fires Missed once (or the streak outcome).

Example

Daily glucose check-in with escalation.

  1. Repeat when: An expected event is missing; Expected event: the glucose-reading event; Within (seconds): 86400.
  2. Advanced ▸ Streaks: after 3 → three_days_missed.
  3. Stop when: a condition that marks the end of the programme, for example a field written by an earlier step that records the programme as finished.
  4. Connect Missed once to a Reach step that sends a gentle reminder.
  5. Add a connection with the condition Completed outcome == three_days_missed to an Engage step asking a nurse to call.

Tips and limitations

  • Always add a way for the routine to end (Stop when, a goal, or a Close with scope Instance elsewhere). A routine with no end keeps the run open.
  • Durations here are in seconds: 3600 is one hour, 86400 is one day, 604800 is one week.
  • Each firing starts a fresh branch, so do not join those branches back with a Gather unless you mean to.

Off-track outcome name

A connection bound to the Off track option fires only when Off-track outcome is set to off_track. If you enter any other name, route on it with a connection condition Completed outcome == your name instead.

journeysnodesroutinerepeatscheduleadherencegoals

Was this page helpful?

Last updated on

On this page