# Creating Routing Rules

## Step 1: Go to Routing Rules page

1. In the nav bar, go to **Clinical** → **Routing Rules**
2. Click '**+ Create New Rule**'

<figure><img src="/files/ANMCIpU3jpywLuhD3PqS" alt=""><figcaption></figcaption></figure>

## Step 2: Fill out rule details

<figure><img src="/files/siPWyisH5jsTLcjdLY4w" alt="" width="563"><figcaption></figcaption></figure>

1. Fill out required fields:

* **Name**: Enter a descriptive rule name (e.g. "Emergency Department Critical Alerts")
* **Criticality type**: Select a criticality type of either 'Critical' or 'Unexpected'&#x20;
  * **Only Radiology** results filtered as 'Unexpected' will follow the **Unexpected** routing rule
* **Specialties:** Choose at least one (You can also select "All Specialties" for a catch-all. See recommendation below.)
* **Locations:** Choose relevant locations (You can also select "All Specialties" for a catch-all. See recommendation below.)
* **Interval Before Next Escalation:** Set number of minutes (max 60 minutes) before escalation from P1 → P2, and P2 → P3

{% hint style="success" %}

### Recommended: Configure a 'catch-all' rule for Unexpected and Critical criticality type&#x20;

Setting up a catch-all rule ensures that no results are missed, even when a result has an unknown specialty or location. This ensures that all Critical and Unexpected results will still auto escalate via SMS to clinicians.

**How to set up?**&#x20;

* Create a new rule with '**Critical**' criticality type and select '**All Specialties**' and '**All Locations**'. Configure the escalation rule according to your institution's workflow&#x20;
* Create another new rule with '**Unexpected**' criticality type and select '**All Specialties**' and '**All Locations**'. Configure the escalation rule according to your institution's workflow&#x20;
  {% endhint %}

2. **Configure office hours for 'Mon - Fri', 'Sat', and 'Sun & PH':**
   * **Match shifts**: Start and end timings should align with start and end of shifts
   * **If there are no office hours for Sun\&PH**: Set start and end time to be the same, and tick the "Use the same rules as During Office Hours" checkbox

<details>

<summary>Example: Office hour configuration</summary>

* **Standard clinic:** Mon - Fri 8:00 AM to 5:00 PM
* **Emergency dept:** All days same start/end times (24/7)
* **Outpatient only:** Mon - Fri 9:00 AM to 6:00 PM, weekends off

</details>

## Step 3: Configure escalation logic

<figure><img src="/files/oQ64DPohq5f9uembdt2m" alt=""><figcaption></figcaption></figure>

Set the escalation logic for during and after office hours. You can escalate based on:&#x20;

* **Roles**
  * **Ordering Doctor (OD)**: This field is retrieved from result's HL7 message (OBR 16.1 for LIS, ORC 12.1 for Beaker/RIS)
  * **Attending Doctor (AD)**: This field is retrieved from ADT HL7 message based on the [AD retrieval logic](/features/routing-rules/getting-started.md#how-patient-locations-and-specialties-are-obtained)
* **Contacts**
  * Specific individuals/shared phones from Directory (e.g., Specialists who need alerts for all critical results from certain specialties, ED phones)
* **Rosters**
  * Escalate based on selected columns and rows of an On-Call or Team Roster
* **AD Team Rosters**
  * This finds the incoming AD's team and alerts a specific role that was configured in the rules within that team

<details>

<summary>Example: AD Team Roster</summary>

**Using the routing rule below as an example**

1. Rooster will first identify the **monthly roster name** and **role** specified in the routing rule
2. Rooster will locate the incoming AD (e.g. Dr Eric Wong) and the team they belong to (e.g. KTPH ASU)
3. Rooster will escalate the result to the doctor assigned to the specified role within the same team (e.g. Dr Clem rostered under the HO role)

<figure><img src="/files/toLiiczjaF32nHydOqlX" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/Gy3jAhopRF45RH94gIwg" alt="" width="563"><figcaption></figcaption></figure>

</details>

## Step 4: After office hours escalation

* Critical alerts are first escalated to P1, then P2, and lastly P3.
* If still not picked up, they’ll be escalated to the call centre for manual intervention.
* All users in each escalation level will be notified at the same time
* If you have the same escalation logic for during and after office hours, tick '**Use the same rules as "During Office Hours"**'

<figure><img src="/files/oyjxqwgPZkRff7yNHPWl" alt=""><figcaption><p>Tick '<strong>Use the same rules as "During Office Hours"</strong>'</p></figcaption></figure>

{% hint style="success" %}

#### Tip: Duplicate your Routing Rule for Unexpected Criticality Type&#x20;

You can create a duplicate routing rule with the **same patient location and specialty**, but with a **different criticality type**.

To do this:

1. Go to the routing rule.
2. Select the three dots (...) menu.
3. Choose Duplicate routing rule.
   {% endhint %}

## Special options

<details>

<summary>Send alerts only during office hours</summary>

Result alerts can now be configured to send only during office hours. Alerts generated outside office hours will be scheduled and sent when office hours resume.&#x20;

**E.g:** If the office hours of your routing rule are from 8 am to 5 pm. All critical results created at 5 pm onwards will be queued and scheduled to be triggered at 8 am the next working day.&#x20;

{% hint style="success" %}

#### Unexpected radiology results (e.g AY/ R1U) can be scheduled to be sent during office hours only.&#x20;

For set up:&#x20;

* Select 'Unexpected' criticality type&#x20;
* Check the 'Send alerts during office hours only' option
  {% endhint %}

</details>

<details>

<summary><strong>Skip Manual Intervention</strong> – Automatic case closure</summary>

<figure><img src="/files/TI0PuxtfXONqZJ9mrFXh" alt="" width="375"><figcaption></figcaption></figure>

Sample routing rule to skip manual intervention:

<figure><img src="/files/B55Y5mZgsyb8reZbHAjM" alt=""><figcaption></figcaption></figure>

How escalations will look like:&#x20;

<figure><img src="/files/TQgHemMYXE6GDtIXJTYe" alt=""><figcaption></figcaption></figure>

**What this checkbox does:**

* Case automatically closes after all escalation levels are complete (P1 → P2 → P3)
* Not escalation to contact centre staff

**When to use:**

* **R1U results:** Urgent but don't require contact centre follow-up
* **Information-only findings:** Results that don't need human follow-up

{% hint style="danger" %}

#### **Use this option carefully**

No staff will manually follow up if an alert fails.
{% endhint %}

</details>

<details>

<summary><strong>Skip notification to doctors on leave</strong></summary>

<figure><img src="/files/7J8kges9S4pfYIR65xXv" alt="" width="563"><figcaption><p>Toggle the setting 'ON' or 'OFF'. It is <strong>enabled by default</strong>. </p></figcaption></figure>

**Purpose:** Automatically skip notifying ordering/attending doctors who are on leave, if a critical result is triggered

**Conditions for skipping (ALL must be met):**

* Doctor is OD or AD for this critical result
* Doctor assigned to leave roster with "Full day" leave status
* Leave period overlaps with routing rule's office hours
  * **Example**: If a doctor is on leave on 5 May, and a critical result arrives on 6 May 7:30am (before office hours), they will still be skipped as the system treats the trigger time as part of 5 May.

{% hint style="warning" %}

### For routing rules that only include OD/AD and skip manual intervention

Note: If both OD and AD are on leave, no clinician will be notified and the result will be closed automatically.
{% endhint %}

</details>

## FAQ <a href="#optional-step-4-skip-manual-intervention" id="optional-step-4-skip-manual-intervention"></a>

<details>

<summary>"Conflicts with other routing rules" error </summary>

You will not be able to save your routing rule if its location/specialty/criticality type overlaps with that of another existing rule.&#x20;

Either update the new rule's location/specialty/criticality type, or change the conflicting rule's configuration based on use case.

</details>

<details>

<summary>Scenarios for scheduling of alerts during office hours only (Special cases)</summary>

**Q1: What happens if an alert is generated right before office hours end?**

As long as the initial alert is generated during office hours, we will complete the full escalation flow even if subsequent escalations happen outside office hours.

*Example: Office hours end at 5 PM, and an unexpected result is detected at 4:59 PM. P1 will be alerted, but if P1 doesn't respond within the escalation interval (e.g., 10 minutes), P2 will still be alerted at 5:09 PM.*

**Q2: What happens if there are no office hours in the next 5 days?**

If no office hours are scheduled in the next 5 days, the alert will be sent immediately, without waiting for office hours to resume.

**Q3: What happens if patient location or specialty changes before a scheduled alert is sent?**

Rooster will find a new routing rule that best matches the updated patient information and use that for escalation. However, the alert timing will still follow the original routing rule's office hours schedule.

**Q3.1: What if the new routing rule has different office hours than the original?**

The alert timing will still be based on the **original routing rule's office hours.** If the alert timing is outside office hours of the new routing rule, the escalation used depends on the new routing rule's escalation and configuration:

* **Case 1:** New routing rule has 'send only during office hours' configured
  * Uses the new routing rule's **during office hours** escalation
* **Case 2:** New routing rule does **not** have 'send only during office hours' configured

  * Uses the new routing rule's **outside office hours** escalation

**Q4: What happens if my contact is disabled after the result has been scheduled?**&#x20;

If a contact is disabled after scheduling, Rooster will skip that contact during escalation and continue with the next step in the flow.

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.rooster.gov.sg/features/routing-rules/creating-routing-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
