Skip to main content

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.

Spec: PM-36 Automated Charge Reconciliation
Status: ✅ Complete
Last Updated: 2026-04-04
Integration Type: Platform Layer (PF-29 tasks) / Data (same-core PM tables) / Scheduled Edge Function

Overview

PM-36 adds nightly automated charge reconciliation: an edge function scans all orgs for five gap types (encounter→charge, charge→claim, claim→payment, duplicate charges, zero-amount charges) and creates PF-29 tasks for each gap. Summary rollups feed the PM-11 Revenue Cycle Dashboard.

Integration Points

PF-29 (Tasks) — Platform Integration Layer

FieldValue
Integration typePlatform Layer (@/platform/tasks)
DirectionPM-36 → PF-29 (write)
TriggerNightly edge function per org
ContractTODO(#1234): link to API_CONTRACTS.md entry when tasks API is published
Payload created per gap:
{
  source_type: 'charge_reconciliation',
  source_id: reconciliation_result.id,   // pm_charge_reconciliation_results.id
  organization_id: org.id,
  title: `<gap_type> — <days_outstanding> days`,
  // assigned_to: null (biller self-assigns from task queue)
  // status: 'open'
}

PM-07 (Charge Capture) — Same-Core Data

  • PM-36 reads pm_charges to detect encounter_no_charge gaps
  • No event contract; direct table query within same core

PM-08 (Claims Management) — Same-Core Data

  • PM-36 reads pm_claims to detect charge_no_claim gaps
  • No event contract; direct table query within same core

PM-09 (Payment Posting) — Same-Core Data

  • PM-36 reads pm_payments to detect claim_no_payment gaps
  • No event contract; direct table query within same core

PM-11 (Revenue Cycle Dashboard) — Shared Table

  • PM-36 populates pm_charge_recon_daily_summary (1 row per org per night)
  • PM-11 queries pm_charge_recon_daily_summary for gap count KPIs, charge lag, and 30/60/90-day trends
  • Integration: shared table within same core; no event needed

Pending Contracts

DependencySpecStatusBlocker
PF-29 createTask() platform API shapePF-29TODO: confirm @/platform/tasks exportsNeeded before Phase 2
Real-time reconciliation event contractsPM-07Not yet designedDeferred; blocks PM-36 Phase 2 real-time feature
FA cross-core reconciliation contractsFANot yet designedDeferred; blocks cross-core reconciliation

Permissions

KeyPurpose
pm.charge_recon.viewView reconciliation results and trends (Results list, PM-11 dashboard cards)
pm.charge_recon.manageResolve gaps, configure thresholds (Resolve action, PM-28 settings)
Seed to: Billing Manager, Org Admin roles.

Security

  • All pm_charge_reconciliation_results and pm_charge_recon_daily_summary rows are scoped by organization_id
  • RLS uses pm_has_org_access(organization_id, auth.uid()) (SECURITY DEFINER)
  • Edge function uses service-role key; PHI (patient_id) must not appear in logs
  • See PM-36 spec Security Considerations for full detail

PF-96 (Jurisdiction Profiles) — Read-Only

  • PM-36 uses org-level pm_module_settings thresholds for v1
  • Phase 2 enhancement: baseline thresholds read from PF-96 jurisdiction profile, with org settings as overrides
  • No direct PF-96 table dependency in v1; listed for architecture awareness
  • API Contract: See API_CONTRACTS.md § PF-96 and PF-96 Integration Doc for resolver function signatures and fallback semantics

Integration Matrix Entry

See CROSS_CORE_INTEGRATIONS.md — PM (PM-36) row.