L
Leaphealth - OSDocs

Alert rules and silences

Create alert rules that watch hospital measurements such as approval waits, overdue bills, walk-in waits and low stock, and use silences to pause alerts for a planned window.

An alert rule watches one measurement and raises an alert when it crosses a threshold for long enough. A silence pauses alerts for a time window, for example during planned maintenance. This page is for administrators. Staff who act on alerts should read Alerts feed.

Open Alert Rules

Go to SettingsPlatform ConfigurationAlert Rules. The screen has two tabs, Rules and Silences. Changing alert rules and silences needs the Configure permission on Settings. Without it you see "Alerting configuration is admin only", and you can still use the Alerts page.

What you can watch

Pick one of these in the Metric list. The description under the field explains each one.

Metric

What it measures

Values

Can be grouped by

hos.appointment.pending_approval_age_max

Age of the oldest appointment still pending approval, per centre

Time in seconds

centre_uuid

hos.bill.overdue_count

Issued or partially paid bills past their due date, per centre

Count

centre_uuid

hos.walk_in.queue_wait_max

Longest current wait of a waiting walk-in token, per centre and queue type

Time in seconds

centre_uuid, queue_type

hos.inventory.low_stock_margin

Quantity on hand minus the store reorder point, per store and item. Negative means below the reorder point.

Quantity

centre_uuid, store_uuid, item_uuid

hos.whatsapp.delivery_failure_rate

Share of WhatsApp notifications that failed recently, across the organisation

Ratio from 0 to 1 (0.2 is shown as 20%)

Nothing

Create a rule

Start a new rule

Administrator

Settings > Platform Configuration > Alert Rules

On the Rules tab, click New rule (or Create the first rule if there are none).

Expected result: The New rule dialog opens.

Name it

Enter a Name staff will recognise, for example "Pending approvals older than 30 min". Enter a Rule key: lowercase words separated by single hyphens, up to 64 characters, for example pending-approvals-stale. The rule key cannot be changed later.

Choose what to watch

Pick the Metric, the Aggregation, the Condition and the Threshold (see the field reference below).

Choose the timing

Set Lookback window (s), Must hold for (s) and Cooldown (s). The helper text under each field shows the time in minutes or hours.

Choose severity and grouping

Pick the Severity and, if the metric allows it, Group alerts by.

Add escalation if needed

Under Escalation, click Add escalation level for each level and enter Level 1 after (s), Level 2 after (s) and so on.

Create

Leave Rule is enabled ticked and click Create rule.

Expected result: "Rule created. It is evaluated on the next check."

If you see "That rule key is already in use.", choose another key.

Field reference

Field

What it does

Default

Aggregation

How the values in the lookback window are combined: Latest, Sum, Average, Minimum, Maximum or Count.

Latest

Condition

is above (>), is at or above (≥), is below (<), is at or below (≤), equals (=), does not equal (≠).

is above (>)

Threshold

The value to compare with, in the metric's unit. For times, enter seconds (1800 for 30 minutes).

0

Lookback window (s)

How far back values are looked at for the aggregation.

300

Must hold for (s)

How long the condition must stay true before an alert opens. 0 means it fires immediately. Unless Aggregation is Latest, the lookback window must be at least this long.

0

Cooldown (s)

After an alert from this rule is resolved, how long before the same alert can open again. 0 means it can re-fire straight away.

0

Severity

Info, Warning or Critical. Shown on the Alerts page and available to notification overrides.

Warning

Group alerts by

Split the rule into one alert per centre, store, item or queue type. Up to 5 keys. Without grouping you get one alert for the whole organisation.

None

Only evaluate samples matching

Label filters: limit the rule to one centre, store, item or queue type. Click Add label filter, pick a Label and enter its Value.

None

Escalation

Up to 5 levels. Each level sends an Alert Escalated notification if the alert is still firing that many seconds after it started. At most 24 hours.

None

Rule is enabled

Disabled rules are not checked.

On

Group by place so the right people are told

Grouping decides what each alert is about. A low-stock rule grouped by store_uuid and item_uuid gives one alert per item in each store, and lets notification rules send it to that store's staff. A walk-in wait rule grouped by centre_uuid gives one alert per centre, so each centre's alert can be sent to that centre's staff.

How escalation works

Escalation levels count from when the alert starts firing. At each level, if the alert is still Firing, LeapHealthOS sends the Alert Escalated notification with the level number. Acknowledging, silencing or resolving the alert stops the remaining levels.

Who receives escalations is set on the Alert Escalated event in SettingsPlatform ConfigurationNotification Rules. To send higher levels to more senior staff, add an override that checks escalation_level. See Notification events and recipient strategies.

Example rules

Goal

Metric

Aggregation and condition

Threshold

Timing

Group by

Approvals waiting more than 30 minutes

hos.appointment.pending_approval_age_max

Latest, is above (>)

1800

Must hold for 0

centre_uuid

Any overdue bills

hos.bill.overdue_count

Latest, is above (>)

0

Must hold for 0, Cooldown 3600

centre_uuid

Walk-in wait over 20 minutes for 5 minutes

hos.walk_in.queue_wait_max

Latest, is above (>)

1200

Must hold for 300

centre_uuid, queue_type

Stock at or below reorder point

hos.inventory.low_stock_margin

Latest, is at or below (≤)

0

Must hold for 0

store_uuid, item_uuid

WhatsApp failures above 20%

hos.whatsapp.delivery_failure_rate

Latest, is above (>)

0.2

Must hold for 600

None

For the low-stock example, also see Batches, expiry and low-stock alerts.

Manage rules

Each rule card shows the name, metric, severity, Enabled or Disabled, the condition in words and how alerts are grouped. Filter the list by Metric, Severity and State (Enabled and disabled, Enabled, Disabled).

Action

Effect

Edit

Change anything except the rule key. Click Save changes.

Disable

Asks "Disable this rule?". Every open alert from the rule is resolved. You can enable it again at any time.

Enable

The rule is checked again from the next check, about a minute later. Nothing re-opens immediately.

Delete

Asks "Delete this rule?". The rule stops raising alerts and leaves the list. Its open alerts are resolved; past alerts stay readable on the Alerts page.

Silences

A silence holds back matching alerts for a time window: a maintenance slot, a known outage, a centre that is closed for the day. While a silence is active, matching alerts that open start as Silenced and nobody is notified.

Create a silence

Start a new silence

Administrator

Settings > Platform Configuration > Alert Rules

Open the Silences tab and click New silence.

Choose what it covers

Pick a Rule (or leave "Any rule"), a Severity (or "Any severity"), and optionally add Label and Value pairs with Add label to narrow it further.

Choose the window

Set Starts at (leave empty to start now) and Ends at (one hour from now by default). Add a Reason such as "Planned maintenance".

Create it

Click Create silence.

Expected result: "Silence created. Alerts opening inside the window stay quiet."

A silence with no rule, severity or labels silences everything

If you leave all the matchers empty, LeapHealthOS asks "Silence every alert?". Confirming suppresses every alert in the organisation until the silence ends, and nobody is notified about anything.

A new silence does not change alerts that are already firing. To pause an alert that is already open, use Silence on the alert itself on the Alerts page.

End a silence

The Silences tab lists silences with what they match, their window and Active or Expired. Use State to show "Active only" or "Active and expired". Click End now to stop an active silence early and confirm "End this silence now?".

Result: "Silence ended. Held alerts return to firing on the next check." Alerts it was holding return to firing about a minute later if their condition still holds, and their notifications go out then. The silence stays in the list as history.

alertsalert rulessilencesescalationoperationsadmin

Was this page helpful?

Last updated on

On this page