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

# Patient Registration: Jurisdiction-Aware Identifiers — Admin Guide

> Feature: PM-01-EN-02 Audience: Billing managers, system administrators Last Updated: 2026-04-05

**Feature:** PM-01-EN-02\
**Audience:** Billing managers, system administrators\
**Last Updated:** 2026-04-05

***

## Configuration

### Jurisdiction Profile (PF-96)

Identifier labels and format validation are driven by the organization's jurisdiction profile. To configure:

1. Navigate to **Settings → Organization → Jurisdiction Profile**.
2. Under **Billing Rules**, set:
   * `member_id_label` — Display name for the member ID field (e.g., "AHCCCS Member ID").
   * `member_id_format` — Regex pattern for validation (e.g., `^\d{10}$`). Leave empty for free-text.
   * `state_system_id_label` — Display name for the state system ID field (e.g., "AHCCCS CIS ID").

### Feature Flag: Alias-First Identifiers

The `pm_alias_first_identifiers` feature flag controls whether the UI displays generic alias fields (`medicaid_member_id`, `state_system_id`) with fallback to legacy Arizona-specific fields.

* **Disabled (default):** UI displays legacy field values (`ahcccs_member_id`, `ahcccs_cis_id`).
* **Enabled:** UI displays generic values first, falling back to legacy values if the generic field is empty.

To enable: Navigate to **Settings → Feature Flags** and enable `pm_alias_first_identifiers` for your organization.

## Data Synchronization

Database triggers maintain bidirectional sync between generic and legacy fields:

* Writing to `medicaid_member_id` auto-populates `ahcccs_member_id` (and vice versa).
* Writing to `state_system_id` auto-populates `ahcccs_cis_id` (and vice versa).
* If both generic and legacy values are provided on the same write and they differ, the **generic alias is authoritative** and a conflict audit entry is logged to `pf_audit_logs`.

## Reconciliation

To check for any patients where the backfill may have missed records:

```sql theme={null}
-- Should return 0 rows if backfill completed successfully
SELECT id, first_name, last_name, ahcccs_cis_id, state_system_id
FROM pm_patients
WHERE ahcccs_cis_id IS NOT NULL
  AND state_system_id IS NULL
  AND organization_id = '<your-org-id>';
```

To check for sync conflicts logged during the migration window:

```sql theme={null}
SELECT *
FROM pf_audit_logs
WHERE module = 'pm'
  AND action = 'identifier_conflict_resolved'
  AND organization_id = '<your-org-id>'
ORDER BY created_at DESC;
```

## Rollback

To disable jurisdiction-aware identifiers and revert to legacy behavior:

1. Disable the `pm_alias_first_identifiers` feature flag.
2. UI will revert to showing legacy field values. Labels remain profile-driven (from PF-96 jurisdiction profile) regardless of flag state — they do not revert to hardcoded values.
3. Database triggers remain active (no data loss) — they continue syncing values bidirectionally.
