> ## 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.

# RCM Rules

> Configure, simulate, and monitor automated revenue cycle decision rules via a 4-tab hub at /pm/rcm-rules.

The RCM Rules hub page provides a centralized interface for managing Revenue Cycle Automation rules at the route `/pm/rcm-rules`.

## Overview

The RCM Rules hub is a 4-tab page — **Active Rules**, **Templates**, **Simulation History**, and **Execution Log** — for managing automated revenue cycle decision rules. Users with the appropriate create permission can author new rules from scratch or start from a built-in template. Active rules display rule name, type, trigger, priority, active/inactive status, and last execution timestamp. Rules can be individually edited, simulated, activated/deactivated, or deleted from a per-row action menu.

The **Templates** tab exposes built-in rule templates as cards showing the rule type, a description, and counts of conditions and actions. Selecting "Use Template" pre-fills the rule editor sheet. The **Simulation History** and **Execution Log** tabs display records from `pm_rcm_automation_rules` execution data, rendered as sortable tables with timestamps, rule names, action taken, target entity, and result badge.

## Who it's for

Requires permission: `pm.rcm-rules.view`

Additional permissions control individual actions:

* `pm.rcm-rules.create` — create new rules and use templates
* `pm.rcm-rules.edit` — edit existing rules
* `pm.rcm-rules.delete` — soft-delete rules
* `pm.rcm-rules.activate` — activate or deactivate rules
* `pm.rcm-rules.simulate` — run simulations

## Before you start

* You must hold `pm.rcm-rules.view` to access this page.
* At least one rule must exist before the Active Rules tab shows table rows; otherwise an empty state prompts you to create the first rule.

## Steps

<Steps>
  <Step title="Navigate to RCM Rules">
    Go to `/pm/rcm-rules`. The page opens on the **Active Rules** tab by default. The active tab persists in the URL query parameter `tab`.
  </Step>

  <Step title="Create a rule or use a template">
    Click **Create Rule** in the page header (requires `pm.rcm-rules.create`) to open a blank rule editor sheet, or switch to the **Templates** tab and click **Use Template** on any built-in template card to pre-fill the editor.
  </Step>

  <Step title="Configure rule conditions and actions">
    In the `RcmRuleEditorSheet`, set the rule name, type, trigger type, priority, description, conditions, and actions. Save to persist the rule in the `pm_rcm_automation_rules` table.
  </Step>

  <Step title="Activate or deactivate a rule">
    From the Active Rules table, open a rule's action menu (gear icon) and select **Activate** or **Deactivate** (requires `pm.rcm-rules.activate`). A confirmation dialog (`RcmActivationDialog`) is shown before the status change is applied.
  </Step>

  <Step title="Run a simulation">
    From the Active Rules table, open a rule's action menu and select **Simulate** (requires `pm.rcm-rules.simulate`). The simulation is triggered via `useTriggerRcmSimulation`. Results appear in the `RcmSimulationResultsDialog` and are recorded in Simulation History.
  </Step>

  <Step title="Review execution history">
    Switch to the **Execution Log** tab to see the 50 most recent rule executions. Each row shows timestamp, rule name, action taken, a truncated target entity ID, and a result badge (applied / error / other).
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Empty states">
    * **Active Rules (empty):** "No automation rules yet — Create your first rule or start from a template."
    * **Simulation History (empty):** "No simulations yet — Run a simulation from the Active Rules tab to preview rule impact."
    * **Execution Log (empty):** "No executions yet — Rules will execute on their next scheduled run."
  </Accordion>
</AccordionGroup>

**Rule priority** is a numeric field on each rule that determines rule execution order.

**Simulation** runs `useTriggerRcmSimulation` which calls `mutateAsync({ ruleId })`. Simulation records are filtered from the execution log using `executionType: 'simulation'`.

## Related

<Columns cols={2}>
  <Card title="Practice Management" icon="briefcase" href="/pm/overview">
    Overview of the Practice Management 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/pm.tsx
  * src/cores/pm/pages/rcm/RcmRulesHubPage.tsx
  * src/cores/pm/hooks/rcm-automation/index.ts
  * src/platform/permissions/constants.ts
</Accordion>
