Skip to main content
Version: 1.1.0
Status: ✅ Implemented
Last Updated: 2026-03-27
Spec: PM-18 Configurable Claim Scrubbing & Org Edit Rules
Constitution Reference: Section 1.2 (Core Independence), Section 1.3 (Integration Patterns)

Overview

PM-18 extends PM-08 claim scrubbing with organization-level overrides for system scrub rules (enabled, severity, optional config). The scrubbing engine remains internal; no new public API or event contracts. Overrides are stored in pm_scrub_rule_overrides; definitions in pm_scrub_rule_definitions (seeded, read-only). Key tables: pm_scrub_rule_definitions, pm_scrub_rule_overrides, pm_scrub_custom_edits (EN-06)
RLS: pm_scrub_rule_overrides and pm_scrub_custom_edits (SELECT/INSERT/UPDATE with WITH CHECK via pm_has_org_access; DELETE via pf_is_org_admin()). Definitions are system-wide read-only.

Enhancement: PM-EN-06 — Per-Payer Custom Scrub Rules

Spec: PM-18-EN-06 Per-Payer Custom Scrub Rules EN-06 extends PM-18 with:
  • Per-payer/claim-type overrides: payer_id and claim_type columns added to pm_scrub_rule_overrides; override priority: payer+type → payer-only → org-wide.
  • Custom edits: New pm_scrub_custom_edits table for org-defined rules with condition expressions (single/compound), severity, message templates, and scope (claim/line).
  • Effectiveness reporting: Per-rule pass/fail/warning rate from pm_claim_notes scrub_error entries, with date range presets and per-payer filter.
  • Permission: pm.settings.scrub_rules.payer gates per-payer override and custom edit management.
  • PF-70 dependency: Active (not Phase 2) for code-type field validation in custom edit conditions.

Integration Points


API Contracts

No new public API. Scrubbing is invoked internally by PM-08 claim detail/generate flows; engine accepts organizationId and uses PM-18 overrides when present. Contract remains existing ScrubResult shape (isValid, errors[]). EN-06 adds rule_key to custom edit errors for traceability.

Event Contracts

None. PM-18 does not publish or subscribe to events.

Tenant Isolation & Auth

  • All override access is scoped by organization_id via RLS on pm_scrub_rule_overrides and pm_scrub_custom_edits.
  • UI for managing overrides is gated by pm.settings.scrub_rules (org-wide) and pm.settings.scrub_rules.payer (per-payer/custom edits).
  • No PHI in rule definitions, overrides, or custom edits; rule execution operates on claim/line data already protected by PM-08 RLS.