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

# CDS Rules

> Admin list and editor for Clinical Decision Support rules, showing rule type, trigger event, severity, and hard-stop status for each rule.

The CDS Rules screen is an admin management page at `/cl/cds-rules` that lists all configured Clinical Decision Support rules for the current organisation and allows users with the `cl.cds_rules.manage` permission to create, edit, and delete rules.

## Overview

The screen displays a card titled "Active Rules (N)" listing all non-deleted rules from `cl_cds_rules` for the current organisation, ordered alphabetically by rule name. Each row shows the rule name, rule type and trigger event labels, severity badge, optional "Hard Stop" badge, and active/inactive badge. Users with `cl.cds_rules.manage` see "Edit" and delete (trash icon) buttons per row, plus a "New Rule" button in the page header. Creating or editing a rule opens a modal dialog with a structured form covering: rule name, rule type, trigger event, severity, hard-stop toggle, active toggle, dynamic condition parameters (vary by rule type), and alert action fields (type, title, message, optional recommendation). Deleting a rule opens a confirmation dialog.

## Who it's for

* Viewing the rule list: requires the `cl.cds_rules.view` permission.
* Creating, editing, and deleting rules: additionally requires `cl.cds_rules.manage`.

## Before you start

* The `cl.cds_rules.view` permission must be assigned to your role to access this page.
* The `cl.cds_rules.manage` permission is required to create, edit, or delete rules.

## Steps

<Steps>
  <Step title="Open the CDS Rules page">Navigate to `/cl/cds-rules`. The page loads all active (non-deleted) rules for your organisation.</Step>
  <Step title="Review existing rules">Each row in the "Active Rules" card shows the rule name, type/trigger sub-line, severity badge, Hard Stop badge (if applicable), and Active/Inactive status.</Step>
  <Step title="Create a new rule (manage permission required)">Click "New Rule" to open the rule form dialog. Fill in Rule Name, Rule Type, Trigger Event, Severity, and optionally Hard Stop and Active flags.</Step>
  <Step title="Configure condition parameters">The Condition Parameters section is dynamic. For Drug Interaction or Drug Allergy rules enter Drug/Class A (and Drug/Class B for interactions). For Medication Monitoring rules enter a Lab Test LOINC code and Days Overdue. For Documentation Gap rules enter Note Type and Max Hours Overdue. Quality Measure rules have no configurable parameters in the current build.</Step>
  <Step title="Configure the alert action">Choose action type (Alert, Block, or Suggest), enter a Display Title, a Message shown to clinicians, and an optional Recommendation. Then click "Create Rule" (or "Update Rule" when editing).</Step>
  <Step title="Edit an existing rule">Click "Edit" on any rule row to re-open the form pre-populated with that rule's values. Change fields as needed and click "Update Rule".</Step>
  <Step title="Delete a rule">Click the trash icon on a rule row. A confirmation dialog shows the rule name and asks you to confirm; click "Delete" to permanently remove the rule.</Step>
</Steps>

## Key concepts

<Tooltip tip="CDS — Clinical Decision Support rules that fire alerts in clinical workflows when configurable trigger conditions are met.">CDS</Tooltip> rule types and trigger events as defined in code:

**Rule types:**

| Code                    | Display label         |
| ----------------------- | --------------------- |
| `drug_interaction`      | Drug Interaction      |
| `drug_allergy`          | Drug Allergy          |
| `medication_monitoring` | Medication Monitoring |
| `documentation_gap`     | Documentation Gap     |
| `quality_measure`       | Quality Measure       |

**Trigger events:**

| Code                  | Display label       |
| --------------------- | ------------------- |
| `medication_add`      | Medication Add      |
| `prescription_submit` | Prescription Submit |
| `chart_open`          | Chart Open          |
| `assessment_complete` | Assessment Complete |

**Severity levels:** `critical`, `major`, `moderate`, `minor`, `info`. Critical and major render as destructive badges; moderate as default; minor as secondary; info as outline.

**Action types:** `alert`, `block`, `suggest`.

<AccordionGroup>
  <Accordion title="Empty state">
    When no rules exist the card body shows a warning icon with "No CDS rules configured — Create rules to enable drug interaction, allergy, and monitoring alerts."
  </Accordion>

  <Accordion title="Error state">
    If the query fails, a destructive text message is shown with the sanitised error.
  </Accordion>

  <Accordion title="Loading state">
    Three skeleton rows are displayed while the rule list loads.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Clinical" icon="stethoscope" href="/cl/overview">
    Overview of the Clinical core.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/cl.tsx
  * src/cores/cl/pages/CdsRulesListPage.tsx
  * src/cores/cl/hooks/useCdsRules.ts
  * src/cores/cl/types/cds.ts
</Accordion>
