> ## Documentation Index
> Fetch the complete documentation index at: https://omniloy.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Alerts and escalation

> Alert rules and the hierarchical escalation policy to the clinical team

Alerts notify the team when a questionnaire meets certain conditions. **Escalation** determines who is notified, and in what order, if no one responds.

## Alert rules

Each rule has a **severity** (`info`, `warning`, `critical`) and a **condition**. They are evaluated when the questionnaire **completes** (after scoring). Up to 10 rules per version.

Condition types:

| Condition                | Holds when…                                                                 |
| ------------------------ | --------------------------------------------------------------------------- |
| Score threshold          | the score is above/below a value, or falls within a range.                  |
| Score band               | the score falls in a specific band.                                         |
| Answer match             | a specific answer meets an operator (equals, in list, greater/less, range). |
| Composite (`and` / `or`) | several conditions are combined.                                            |

([Red flags](/olivia/en/guardrails) are a separate trigger, in real time during the call.)

## Escalation policy

<img src="https://mintcdn.com/omniloy/Q9jZm4-SeFtgd8-M/images/olivia/escalation-policy.png?fit=max&auto=format&n=Q9jZm4-SeFtgd8-M&q=85&s=98bdf961f8998e3a03512aa7c735f924" alt="Level-based escalation configuration" width="1920" height="1080" data-path="images/olivia/escalation-policy.png" />

The policy defines the notification chain. It resolves by **most-specific match** on `(protocol, group, severity)`: a policy for a specific protocol and group takes precedence over a more general one. A policy that is found but disabled means "do not escalate here".

**Levels** (up to 5). Each level has:

* `delay_minutes`: the wait since the previous event (from 1 minute up to 1 week).
* A target: a **role** (`coordinator`, `admin` = head of service, `medic`) or a specific **user**.

Escalation advances **one level per sweep** and stops when the alert is acknowledged, the chain is exhausted, or no policy is configured.

```mermaid theme={null}
flowchart TD
  A[Alert triggered] --> L1[Level 1: role or user]
  L1 -->|no ack after the wait| L2[Level 2]
  L2 -->|no ack after the wait| L3[Level 3 ... up to 5]
  L1 -. ack .-> Stop([Escalation stopped])
  L2 -. ack .-> Stop
  L3 -. ack .-> Stop
```

## Acknowledgement

Acknowledging an alert **stops escalation**. Each alert records who acknowledged it and when, and accepts a closure note. Population metrics track the alert-reviewed rate.
