Spec: PM-36 Automated Charge ReconciliationDocumentation 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: ✅ 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
| Field | Value |
|---|---|
| Integration type | Platform Layer (@/platform/tasks) |
| Direction | PM-36 → PF-29 (write) |
| Trigger | Nightly edge function per org |
| Contract | TODO(#1234): link to API_CONTRACTS.md entry when tasks API is published |
PM-07 (Charge Capture) — Same-Core Data
- PM-36 reads
pm_chargesto detectencounter_no_chargegaps - No event contract; direct table query within same core
PM-08 (Claims Management) — Same-Core Data
- PM-36 reads
pm_claimsto detectcharge_no_claimgaps - No event contract; direct table query within same core
PM-09 (Payment Posting) — Same-Core Data
- PM-36 reads
pm_paymentsto detectclaim_no_paymentgaps - 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_summaryfor gap count KPIs, charge lag, and 30/60/90-day trends - Integration: shared table within same core; no event needed
Pending Contracts
| Dependency | Spec | Status | Blocker |
|---|---|---|---|
PF-29 createTask() platform API shape | PF-29 | TODO: confirm @/platform/tasks exports | Needed before Phase 2 |
| Real-time reconciliation event contracts | PM-07 | Not yet designed | Deferred; blocks PM-36 Phase 2 real-time feature |
| FA cross-core reconciliation contracts | FA | Not yet designed | Deferred; blocks cross-core reconciliation |
Permissions
| Key | Purpose |
|---|---|
pm.charge_recon.view | View reconciliation results and trends (Results list, PM-11 dashboard cards) |
pm.charge_recon.manage | Resolve gaps, configure thresholds (Resolve action, PM-28 settings) |
Security
- All
pm_charge_reconciliation_resultsandpm_charge_recon_daily_summaryrows are scoped byorganization_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_settingsthresholds 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
SeeCROSS_CORE_INTEGRATIONS.md — PM (PM-36) row.