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

# Care Management Billing Engine — Admin Guide

> Configuration and operational reference for administrators setting up care-management billing.

# Care Management Billing Engine — Admin Guide

## Configuration (pm\_module\_settings)

All PM-75 settings are stored per-organization in `pm_module_settings`:

| Column                           | Type    | Default  | Description                                                                                       |
| -------------------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------- |
| `care_mgmt_autopost_kill_switch` | boolean | false    | When true, gate-pass charges go to the manual worklist instead of auto-posting                    |
| `care_mgmt_credential_gate_mode` | text    | 'strict' | 'strict' = credential record required; 'permissive' = no credential record required (bridge mode) |

### Enabling Auto-Post

Auto-post is **OFF** by default (kill switch = true). To enable auto-posting for your organization:

```sql theme={null}
UPDATE pm_module_settings
SET care_mgmt_autopost_kill_switch = false
WHERE organization_id = '<your-org-id>';
```

When enabled, a charge is automatically created in `pm_charges` for each gate-pass evaluation.

When disabled (kill switch ON), gate-pass evaluations appear on the manual review worklist.

### Credential Gate Mode

**Strict (default):** Staff must have an explicit `pm_care_mgmt_staff_qualifications` record with `qualified = true` before they can log time against a CoCM / BHI / CCM / PCM enrollment.

**Permissive:** No credential record required. Staff can log time for any program. Use only during go-live onboarding.

To switch to permissive mode:

```sql theme={null}
UPDATE pm_module_settings
SET care_mgmt_credential_gate_mode = 'permissive'
WHERE organization_id = '<your-org-id>';
```

***

## Staff Credential Management

In strict mode, credentials are managed in `pm_care_mgmt_staff_qualifications`:

```sql theme={null}
-- Grant credential
INSERT INTO pm_care_mgmt_staff_qualifications (organization_id, staff_id, program, qualified)
VALUES ('<org-id>', '<staff-uuid>', 'cocm', true);

-- Revoke credential
UPDATE pm_care_mgmt_staff_qualifications
SET qualified = false,
    disqualify_reason = 'NPI enrollment lapsed — renew before billing'
WHERE organization_id = '<org-id>' AND staff_id = '<staff-uuid>' AND program = 'cocm';
```

The `pm_75_staff_qualified_for_code_family` RPC evaluates credentials at billing time and returns `{qualified: bool, reason: text}`.

***

## Payer Policy Configuration

Payer policies (covered codes, modifiers, override rules) are configured in:

* `pm_payers` — payer master
* `pm_payer_care_mgmt_policies` (or `pm_payer_policies`) — per-payer coverage rules for care-mgmt codes

The billing engine reads payer policy at evaluation time and includes it in the rule snapshot stored in the gate audit log.

**Important (A-5 OPEN):** CMS default thresholds (CPT 99490/99491/99492/99493 time requirements) require human verification against the current CMS fee schedule before enabling auto-post in production. See [PM-75 Compliance Signoff](../../specs/pm/reviews/PM-75-COMPLIANCE-SIGNOFF.md) item C-1.

***

## CoCM Registry Integration (SC-003)

For CoCM billing, the engine enforces that the patient has an active enrollment in the CL-54-EN-01 psychiatric registry (`pm_75_record_evaluation` with `p_gate_status = 'denied'` and `p_gate_failure_reason = 'registry_membership_missing'` when the registry is unavailable).

**When the registry is unavailable (degradation mode):**

* Gate status = `denied`, failure reason = `registry_membership_missing`
* Charge is NOT auto-posted (SC-003 compliance)
* Evaluation appears on the manual worklist with reason displayed
* Registry unavailability is captured in the rule snapshot for audit

**Resolution:** Ensure the patient is enrolled in the CL-54-EN-01 registry before billing CoCM codes.

***

## Audit Log

`pm_care_mgmt_gate_audit` is INSERT-ONLY (RLS policy USING(false) for UPDATE/DELETE). Every evaluation writes a row containing:

* `verdict` (pass / fail / void)
* `reason` (denial reason string)
* `rule_snapshot` (JSONB: code\_family\_rules + payer\_policy + credentials\_check + registry\_check)
* `created_at` (immutable timestamp)

The SC-002 invariant holds: every `pm_charges` row with `source = 'pm75_care_mgmt'` in `custom_fields` must have a matching gate-pass audit row. The integration test `SC-002` proof enforces this.

***

## Voiding a Charge

Use the `pm_75_void_care_mgmt_charge` RPC (accessible to `authenticated` and `service_role`):

```sql theme={null}
SELECT * FROM pm_75_void_care_mgmt_charge(
  p_organization_id := '<org-id>',
  p_billing_period_id := '<billing-period-uuid>',
  p_reason := 'Duplicate billing for patient; manual correction',
  p_voided_by := '<user-uuid>'  -- null for system/admin action
);
```

This atomically:

1. Sets `pm_care_mgmt_billing_periods.gate_status = 'void'`
2. Sets `pm_charges.status = 'void'` for the linked charge
3. Inserts a void audit row

***

## Security Notes

* `pm_75_record_evaluation` and `pm_75_void_care_mgmt_charge` are **SECURITY DEFINER**, REVOKE from PUBLIC and anon. Only `authenticated` and `service_role` can execute them.
* All five PM-75 tables have RLS enabled with `pm_has_org_access` and `pf_is_org_admin` guards.
* The org-guard in `pm_75_record_evaluation` raises `insufficient_privilege` if `p_organization_id` does not match the enrollment's org.

***

## Related Resources

* [Time Logging User Guide](care-management-time-logging-user-guide.md)
* [Worklist User Guide](care-management-worklist-user-guide.md)
* [PM-75 Integration Reference](../architecture/integrations/PM-75-CARE-MANAGEMENT-BILLING-INTEGRATION.md)
* [PM-75 Compliance Signoff](../../specs/pm/reviews/PM-75-COMPLIANCE-SIGNOFF.md)
