Feature ID: PM-01Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Status: π§ In Progress
Last Verified: 2026-02-18
Spec Reference: PM-01-patient-registration-demographics.md
Last Updated: 2026-02-18
Table of Contents
- Overview
- Quick Reference
- Decision Trees
- Pattern Library
- Integration Points (from Spec)
- API / Data Contracts
- Labeled Code Examples
- Event Contracts
- Security and RLS
- Common Mistakes
- Pre-Flight Checklist
- Related Docs
Overview
PM-01 provides patient registration and USCDI v3βaligned demographics, Master Patient Index (MPI) duplicate detection, AHCCCS member/CIS ID capture, and multi-site visibility. It depends on PF for tenancy, RBAC, forms, and custom fields. Downstream consumers (CL-01, PM-02, PM-03) use patient identity via PF or PM-01 data.Quick Reference
| Item | Value |
|---|---|
| Core tables | pm_patients, pm_patient_addresses, pm_emergency_contacts, pm_guarantors |
| Permission keys | pm.patients.view, pm.patients.create, pm.patients.update, pm.patients.merge |
| Primary event | patient_registered |
| Identity boundary | PF-owned pf_patient_identities shared across PM and CL integrations |
Decision Trees
Create vs merge flow
- Search for existing patient candidates (MPI checks).
- If high-confidence duplicate exists, route to merge workflow.
- Else create new patient registration record and emit
patient_registered.
Identity boundary flow
- Capture PM demographics in PM-owned tables.
- Resolve shared patient identity through PF integration boundary.
- CL consumers use PF identity link, not PM-owned FK coupling.
Pattern Library
| Pattern | Usage |
|---|---|
| Direct PF dependency | PM-01 depends on PF-01/PF-02 for tenancy and permissions |
| Platform forms abstraction | PF-08 intake forms wrap PM registration payloads |
| Cross-core contract handoff | PM-01 publishes data for CL-01 and PM-02/PM-03 consumers |
Integration Points (from Spec)
| Dependency | Pattern | Purpose |
|---|---|---|
| PF-01 (Organizations & Sites) | Direct | Multi-tenant isolation, organization_id |
| PF-02 (RBAC) | Direct | Permission checks (pm.patients.view, .create, .update, .merge) |
| PF-08 (Forms) | Platform | Patient intake forms |
| PF-16 (Custom Fields) | Direct | Extensible patient metadata (custom_fields) |
| CL-01 | Cross-core | Patient chart creation from registration; patient identity boundary |
| PM-02 | Internal PM | Insurance linked to patient |
| PM-03 | Internal PM | Appointments linked to patient |
API / Data Contracts
- Patient demographics: Tables
pm_patients,pm_patient_addresses,pm_emergency_contacts,pm_guarantors; all scoped byorganization_id; RLS via SECURITY DEFINER helpers (pm_can_access_patient,pm_can_modify_patient). - Patient identity: Per CL-01 integration, patient identity may be resolved via
pf_patient_identities(PF); PM-01 is the source of demographic data. See API_CONTRACTS.md forGET /api/v1/pm/patients/:id(or platform equivalent). - Permissions:
pm.patients.view,pm.patients.create,pm.patients.update,pm.patients.merge(PF-30).
Labeled Code Examples
Example: patient registration API shape
Example: patient_registered event payload
Event Contracts
- patient_registered: PM publishes when a new patient is registered; subscribers CL, RH (optional), PF-10. See EVENT_CONTRACTS.md for payload and timeline.
Security and RLS
- RLS on
pm_patients,pm_patient_addresses,pm_emergency_contacts,pm_guarantors; USING and WITH CHECK use SECURITY DEFINER helpers; no direct queries to RLS-protected tables (constitution Β§5.7). - UPDATE policies include WITH CHECK for organization_id (constitution Β§5.2.4).
- PHI handling: no SSN in schema; DOB + legal name + MRN for matching; encryption at rest, RBAC, audit per HIPAA and constitution Β§4.
Common Mistakes
| Mistake | Impact | Fix |
|---|---|---|
Omitting organization_id in writes | Tenant leakage risk | Include explicit tenant context in all mutations |
| Treating PM as identity source-of-truth | Boundary drift | Keep shared identity references in PF layer |
| Merge workflow without audit events | Data lineage loss | Emit merge/audit events with actor metadata |
Pre-Flight Checklist
- Validate permission keys are seeded and enforced in UI/API.
- Validate RLS helper use (
pm_can_access_patient,pm_can_modify_patient). - Validate duplicate detection and merge path behavior.
- Validate
patient_registeredevent contract and subscribers. - Validate PHI-safe logging and sanitized errors.
Related Docs
- CROSS_CORE_INTEGRATIONS.md
- CL-01-patient-chart-clinical-summary-INTEGRATION.md (patient identity boundary)
- API_CONTRACTS.md
- EVENT_CONTRACTS.md