Version: 2.0.0Documentation 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: ✅ Implemented
Last Updated: 2026-02-22
Last Verified: 2026-02-22
Spec: PM-08 Claims Management & Submission
Constitution Reference: Section 1.2 (Core Independence), Section 1.3 (Integration Patterns)
Overview
PM-08 owns claim generation from charges (837P/837I), pre-submission scrubbing, submission via clearinghouse or direct payer, status tracking, denial management (CARC/RARC), and secondary/tertiary and void/replacement claims. Key tables:pm_claims, pm_claim_linesRLS: Full CRUD policies on both tables (tenant-isolated via
organization_id). DELETE restricted to org_admin.Scrubbing engine:
src/cores/pm/utils/claim-scrubbing.ts — validates NPI, diagnosis codes, service dates, filing deadline, line-level CPT/units/POS.Event publisher:
src/cores/pm/hooks/useClaimMutation.ts
Integration Points
| Dependency | Pattern | Status | Purpose |
|---|---|---|---|
| PM-07 | Data (FK) | ✅ Implemented | Approved charges → claim lines; pm_claim_lines.charge_id → pm_charges.id |
| PM-09 | Data (FK, mutation) | ✅ Implemented | ERA payments posted against claims; status updated to paid/denied |
| PM-15 | Data / API | 📋 Planned | Clearinghouse transmission; clearinghouse_trace_id round-trip |
| PM-02 | Data (query) | ✅ Implemented | Eligibility check before submission; latest pm_eligibility_checks for patient+payer |
| PM-10 | Data (query) | ✅ Implemented | Authorization verification in scrubbing; active auth for service type |
| PF-70 | Platform | ✅ Implemented | Code library (CPT/ICD-10/HCPCS) for validation via @/platform/codes |
Event Contracts
claim_submitted (PM-08 → PM-15, PF-10, PF-04)
Status: ✅ ImplementedLast Verified: 2026-02-22
Channel:
cl_pm_eventsPublisher:
src/cores/pm/hooks/useClaimMutation.ts (via publishEvent)DB registration:
fw_workflow_events row exists (owning_core: pm, category: operational)
Published when a claim transitions to submitted status.
| Consumer | Pattern | Status | Behavior |
|---|---|---|---|
| PM-15 | Event subscription | 📋 Planned | Initiates clearinghouse 837P/I transmission |
| PF-10 | Notification | ✅ Implemented | Notifies billing manager of submission |
| PF-04 | Audit | ✅ Implemented | Audit log entry with claim_id and user |
claim_status_changed (PM-08 → PM-11, PF-10, FA)
Status: ✅ ImplementedLast Verified: 2026-02-22
Channel:
cl_pm_eventsPublisher:
src/cores/pm/hooks/useClaimMutation.ts (via publishEvent)DB registration:
fw_workflow_events row exists (owning_core: pm, category: operational)
Published on any claim status transition.
| Consumer | Pattern | Status | Behavior |
|---|---|---|---|
| PM-11 | Dashboard query | ✅ Implemented | Revenue cycle metrics (denial rate, clean claim %) |
| PF-10 | Notification | ✅ Implemented | Denial notifications to assigned biller |
| FA | GL posting | 📋 Planned | Journal entries on paid status (future integration) |
Data Contracts
PM-07 → PM-08: Approved Charges Query
Status: ✅ ImplementedLast Verified: 2026-02-22 PM-08 generates claims from approved, unlinked charges:
pm_claim_lines row:
| pm_charges column | pm_claim_lines column |
|---|---|
id | charge_id (FK) |
cpt_code | cpt_code |
units | units |
modifiers | modifiers |
place_of_service | place_of_service |
amount | charge_amount |
service_date | service_date |
diagnosis_codes[0..3] | diagnosis_pointers (1-indexed array) |
claim_id is back-populated.
PM-08 → PM-09: Claims for Payment Posting
Status: ✅ ImplementedLast Verified: 2026-02-22 PM-09 reads claims and lines to post ERA payments:
pm_claims columns via .update():
| Column | Type | Description |
|---|---|---|
status | text | → paid, denied, or stays accepted for partial |
paid_amount | numeric | Total paid by payer |
adjustment_amount | numeric | Contractual adjustments (CO group) |
patient_responsibility | numeric | Patient balance (PR group) |
denial_codes | jsonb | Array of DenialCode objects |
adjudicated_at | timestamptz | Date of adjudication |
PM-08 Scrubbing: Pre-Submission Validation
Status: ✅ ImplementedLast Verified: 2026-02-22
Location:
src/cores/pm/utils/claim-scrubbing.ts
| Code | Field | Rule |
|---|---|---|
MISSING_NPI | billing_provider_npi | NPI must be present (sourced from pm_module_settings) |
MISSING_DIAGNOSIS | primary_diagnosis_code | At least one ICD-10-CM required |
MISSING_SERVICE_DATE | service_date_from | Service date range required |
PAST_FILING_DEADLINE | filing_deadline | Must be within 365-day AHCCCS deadline |
MISSING_CPT | cpt_code (line) | Each line must have a valid CPT/HCPCS |
MISSING_UNITS | units (line) | Units must be > 0 |
MISSING_POS | place_of_service (line) | Place of service required per line |
MISSING_DIAG_POINTER | diagnosis_pointers (line) | At least one diagnosis pointer required |
Database Schema (pm_claims)
Last Verified: 2026-02-22| Column | Type | Nullable | Description |
|---|---|---|---|
id | uuid | NO | PK |
organization_id | uuid | NO | Tenant FK → pf_organizations |
patient_id | uuid | NO | FK → pm_patients |
claim_number | text | NO | Generated claim number |
claim_type | text | NO | professional_837p or institutional_837i |
payer_id | uuid | NO | FK → pm_payers |
policy_id | uuid | YES | FK → pm_insurance_policies |
billing_provider_npi | text | YES | From pm_module_settings |
rendering_provider_npi | text | YES | Provider NPI |
facility_id | uuid | YES | FK → pf_sites |
service_date_from | date | YES | DOS range start |
service_date_to | date | YES | DOS range end |
primary_diagnosis_code | text | YES | ICD-10-CM |
total_charge | numeric | YES | Sum of line charges |
status | text | YES | Claim lifecycle status |
submitted_at | timestamptz | YES | Submission timestamp |
adjudicated_at | timestamptz | YES | Adjudication timestamp |
paid_amount | numeric | YES | Payer paid amount |
adjustment_amount | numeric | YES | Contractual adjustments |
patient_responsibility | numeric | YES | Patient balance |
denial_codes | jsonb | YES | Array of DenialCode objects |
frequency_code | text | YES | 1 (original), 7 (replacement), 8 (void) |
original_claim_id | uuid | YES | Self-FK for replacement/void claims |
filing_deadline | date | YES | 365-day AHCCCS deadline |
clearinghouse_trace_id | text | YES | Returned by PM-15 |
custom_fields | jsonb | NO | Default {} |
deleted_at | timestamptz | YES | Soft delete |
created_at | timestamptz | NO | Auto |
updated_at | timestamptz | NO | Auto |
created_by | uuid | YES | FK → pf_profiles |
updated_by | uuid | YES | FK → pf_profiles |
Database Schema (pm_claim_lines)
Last Verified: 2026-02-22| Column | Type | Nullable | Description |
|---|---|---|---|
id | uuid | NO | PK |
organization_id | uuid | NO | Tenant FK |
claim_id | uuid | NO | FK → pm_claims |
charge_id | uuid | YES | FK → pm_charges (source charge) |
line_number | int | NO | Sequence within claim |
service_date | date | YES | Line-level DOS |
cpt_code | text | YES | CPT/HCPCS code |
modifiers | text[] | YES | Up to 4 modifiers |
units | numeric | YES | Service units |
diagnosis_pointers | int[] | YES | 1-indexed references to claim diagnoses |
charge_amount | numeric | YES | Billed amount |
paid_amount | numeric | YES | Paid by payer |
adjustment_amount | numeric | YES | Adjustments |
adjustment_reason | text | YES | CARC code |
denial_reason | text | YES | Denial reason |
rendering_provider_npi | text | YES | Line-level provider |
place_of_service | text | YES | POS code |
revenue_code | text | YES | For institutional claims |
custom_fields | jsonb | YES | Default {} |
deleted_at | timestamptz | YES | Soft delete |
created_at | timestamptz | NO | Auto |
updated_at | timestamptz | NO | Auto |
created_by | uuid | YES | FK → pf_profiles |
updated_by | uuid | YES | FK → pf_profiles |
RLS Policies
Last Verified: 2026-02-22| Table | Policy | Command | Rule |
|---|---|---|---|
pm_claims | pm_claims_select | SELECT | organization_id tenant match |
pm_claims | pm_claims_insert | INSERT | organization_id tenant match |
pm_claims | pm_claims_update | UPDATE | organization_id tenant match (with WITH CHECK) |
pm_claims | pm_claims_delete | DELETE | org_admin role only |
pm_claim_lines | pm_claim_lines_select | SELECT | organization_id tenant match |
pm_claim_lines | pm_claim_lines_insert | INSERT | organization_id tenant match |
pm_claim_lines | pm_claim_lines_update | UPDATE | organization_id tenant match (with WITH CHECK) |
pm_claim_lines | pm_claim_lines_delete | DELETE | org_admin role only |
Integration Matrix
| From | To | Pattern | Status | Last Verified | Doc |
|---|---|---|---|---|---|
| PM (PM-08) | PM-07 | Data (charges → claims) | ✅ Implemented | 2026-02-22 | This doc |
| PM (PM-08) | PM-09 | Data (claims for payment posting) | ✅ Implemented | 2026-02-22 | PM-09 Integration |
| PM (PM-08) | PM-15 | Data / API (clearinghouse) | 📋 Planned | — | TBD in PM-15 integration |
| PM (PM-08) | PM-02 | Data (eligibility query) | ✅ Implemented | 2026-02-22 | This doc |
| PM (PM-08) | PM-10 | Data (auth verification) | ✅ Implemented | 2026-02-22 | PM-10 Integration |
| PM (PM-08) | PF-70 | Platform (code library) | ✅ Implemented | 2026-02-22 | PF-70 Integration |
| PM (PM-08) | PF-10 | Platform (notifications) | ✅ Implemented | 2026-02-22 | Event consumers above |
| PM (PM-08) | PF-04 | Platform (audit) | ✅ Implemented | 2026-02-22 | Event consumers above |