Dev Reference

Payer Optimization

Payer-specific coding rules, modifier suggestions, prior-auth guidance, and optimization audit trail — with hard compliance guardrails to prevent abuse.

Data Classification: All entities are org-scoped (partitioned by OrganizationID). See Data Model for ownership rules and IC Reference for isolation constraints.
Hard Guardrails — Non-Negotiable Compliance Rules:

PayerOptimizationConfig

Org-scoped. Trust Tier: T2 (organization configuration).

Schema

FieldTypeRequiredPKFKNotes
PayerOptimizationConfigIDUUIDYesYesPrimary key
OrganizationIDUUIDYesOrganizationOne config per organization
IsEnabledBoolYesMaster on/off switch
DisclosureTextTextNoDisplayed to staff when optimization is active
LastEnabledDateTimeDateTime (UTC)No
CreatedByUserIDUUIDYesUserAudit
CreatedDateTimeDateTime (UTC)YesAudit
UpdatedByUserIDUUIDYesUserAudit
UpdatedDateTimeDateTime (UTC)YesAudit

RBAC

RoleTierPermissions
Patient (10)NO ACCESS (hard rule)
Front Desk (30)T2Read config status
MA / RN (40)T2Read config status
Clinician (60)T2Read config + rules
Billing Manager (70)T2Read all; write rules; read audit
Compliance Officer (75)T2Read all (no write)
Practice Owner (80)T2Read / write config; read suggestions; read audit
EditAMI (90)T2Schema administration

PayerRule

Org-scoped. Trust Tier: T2 (payer contract rules).

Schema

FieldTypeRequiredPKFKNotes
PayerRuleIDUUIDYesYesPrimary key
PayerNameString(100)Yes
PayerPlanIdString(50)NoSpecific plan within payer
RuleTypeString(50)YesModifier / PreAuth / Documentation / CodingThreshold / Bundling
RuleDefinitionTextYesJSON-encoded rule logic
EffectiveDateTimeDateTime (UTC)Yes
IsActiveBoolYes
OrganizationIDUUIDYesOrganizationTenant partition key
CreatedByUserIDUUIDYesUserAudit
CreatedDateTimeDateTime (UTC)YesAudit
UpdatedByUserIDUUIDYesUserAudit
UpdatedDateTimeDateTime (UTC)YesAudit

RBAC

RoleTierPermissions
Patient (10)NO ACCESS (hard rule)
Front Desk (30)T2Read rules
MA / RN (40)T2Read rules
Clinician (60)T2Read rules
Billing Manager (70)T2Read / write rules
Compliance Officer (75)T2Read all (no write)
Practice Owner (80)T2Read rules
EditAMI (90)T2Schema administration

CodingOptimizationSuggestion

Org-scoped. Trust Tier: T2 (coding metadata). Records with IsCompliant = false are NEVER displayed to users.

Schema

FieldTypeRequiredPKFKNotes
CodingOptimizationSuggestionIDUUIDYesYesPrimary key
EncounterIDUUIDYesEncounter
SuggestedCodeString(50)YesSuggested CPT/HCPCS code
OriginalCodeString(50)YesCode before optimization
SuggestionReasonString(200)Yes
IsCompliantBoolYesFalse = suppressed from UI, audit-only
WasAcceptedBoolNoNull until clinician acts
OrganizationIDUUIDYesOrganizationTenant partition key
CreatedByUserIDUUIDYesUserAudit
CreatedDateTimeDateTime (UTC)YesAudit
UpdatedByUserIDUUIDYesUserAudit
UpdatedDateTimeDateTime (UTC)YesAudit

RBAC

RoleTierPermissions
Patient (10)NO ACCESS (hard rule)
Clinician (60)T2Read own encounter suggestions (IsCompliant=true only); accept/reject
Billing Manager (70)T2Read all compliant suggestions
Compliance Officer (75)T2Read all (including non-compliant, audit context)
Practice Owner (80)T2Read compliant suggestions
EditAMI (90)T2Schema administration

OptimizationAuditEntry

Org-scoped. Trust Tier: T1 (immutable compliance audit trail). IMMUTABLE — append-only. No updates or deletes permitted.

Schema

FieldTypeRequiredPKFKNotes
OptimizationAuditEntryIDUUIDYesYesPrimary key
PayerOptimizationConfigIDUUIDYesPayerOptimizationConfig
ActorUserIDUUIDYesUser
PatientIDUUIDNoPatientNull for config-level actions
ActionTypeString(50)Yese.g. ConfigEnabled, RuleCreated, SuggestionAccepted, SuggestionRejected, NonCompliantSuppressed
DetailTextNoHuman-readable detail
ActionDateTimeDateTime (UTC)Yes
OrganizationIDUUIDYesOrganizationTenant partition key
CreatedByUserIDUUIDYesUserAudit
CreatedDateTimeDateTime (UTC)YesAudit (same as ActionDateTime on insert)
UpdatedByUserIDUUIDYesUserAudit (immutable — always equals Created)
UpdatedDateTimeDateTime (UTC)YesAudit (immutable — always equals Created)

RBAC

RoleTierPermissions
Patient (10)NO ACCESS (hard rule)
Billing Manager (70)T1Read audit entries
Compliance Officer (75)T1Read all audit entries
Practice Owner (80)T1Read audit entries
EditAMI (90)T1Schema administration (no delete)

Trust tier roll-up

EntityTierSource of truth
PayerOptimizationConfig1 — Internal canonicalSet by an authorized practice owner within this system; gates all other features
PayerRule2 — External inboundSourced from payer policy documentation; curated and effective-dated by the billing manager
CodingOptimizationSuggestion1 — Internal derivedGenerated by the engine from global clinical data within this system, with compliance validation against documented findings
OptimizationAuditEntry1 — Internal canonicalAppend-only audit trail authored by the system in response to authenticated user actions; never modified or deleted

RBAC matrix (IC 0–100 scale)

RoleLevelPayerOptimizationConfigPayerRuleCodingOptimizationSuggestionOptimizationAuditEntry
Patient (self)10No accessNo accessNo accessNo access
Front desk (Jordan)30Read (knows if enabled)Read applicable rulesNo accessNo access
MA / RN40ReadRead applicable rulesNo accessNo access
Clinician (Dr. M)60ReadRead applicable rulesRead own; Accept/RejectNo access
Billing manager (Sam)70ReadRead / Write (author rules)Read allRead
Practice owner80Read / Write (enable/disable)ReadRead allRead
Compliance officer75ReadReadRead allRead
EditAMI90Required for any AMI schema break (per IC hard rule #5)

Patient access hard rule: Patients have no access to any Payer Optimization data — not the config, not the rules, not the suggestions, not the audit log. Payer-margin data is never exposed to patients, and the patient-facing experience is identical whether Payer Optimization is enabled or disabled at the practice.

FK Relationship Diagram

erDiagram
    Organization ||--o| PayerOptimizationConfig : "has"
    PayerOptimizationConfig ||--o{ OptimizationAuditEntry : "audits"
    User ||--o{ OptimizationAuditEntry : "ActorUserID"
    Patient ||--o{ OptimizationAuditEntry : "PatientID"
    Encounter ||--o{ CodingOptimizationSuggestion : "generates"
    

Optimization Suggestion Flow

flowchart TD
    A[Encounter coding completed] --> B[Optimization engine evaluates PayerRules]
    B --> C{Suggestion generated?}
    C -- No --> D[No action]
    C -- Yes --> E{IsCompliant check}
    E -- false --> F[Suppress from UI]
    F --> G[Log NonCompliantSuppressed in audit]
    E -- true --> H[Display to Clinician]
    H --> I{Clinician decision}
    I -- Accept --> J[Update code on ClaimLine]
    J --> K[Log SuggestionAccepted in audit]
    I -- Reject --> L[Keep original code]
    L --> M[Log SuggestionRejected in audit]
    

Functional Requirements

  1. P0 The system SHALL enforce all four hard guardrails (no Medicare/Medicaid access reduction, no protected-category discrimination, no patient visibility, no non-compliant suggestion display) at the application layer with no override mechanism.
  2. P0 The system SHALL validate every PayerRule against guardrails before activation and reject non-compliant rules with a detailed error message.
  3. P0 The system SHALL maintain an immutable, append-only OptimizationAuditEntry log for every action (config changes, rule creation, suggestion acceptance/rejection, non-compliant suppression).
  4. P0 The system SHALL suppress CodingOptimizationSuggestion records with IsCompliant=false from all user-facing views; these records are retained exclusively for audit.
  5. P0 The system SHALL provide a master on/off switch (PayerOptimizationConfig.IsEnabled) that immediately disables all suggestion generation when set to false.
  6. P1 The system SHALL generate coding optimization suggestions by evaluating encounter codes against active PayerRules for the encounter's payer.
  7. P1 The system SHALL allow clinicians to accept or reject compliant suggestions, with the decision recorded in the audit trail.
  8. P1 The system SHALL support five rule types: Modifier, PreAuth, Documentation, CodingThreshold, and Bundling.
  9. P1 The system SHALL allow Billing Managers to create, modify, and deactivate PayerRules with effective dates.
  10. P1 The system SHALL display disclosure text to staff when optimization is active, as configured in PayerOptimizationConfig.DisclosureText.
  11. P2 The system SHALL provide optimization impact reporting (acceptance rate, revenue impact, denial reduction) for Practice Owners.
  12. P2 The system SHALL support rule versioning so that historical rule definitions are preserved when rules are updated.
  13. P2 The system SHALL allow Compliance Officers read-only access to all entities including non-compliant suggestions for audit review.
  14. P2 The system SHALL support payer-plan-level rule targeting (PayerRule.PayerPlanId) for granular optimization.

Non-Functional Requirements

icApplication Overrides

How the four Payer Optimization AMI schemas turn into a live application: module-specific stack additions, override component bindings, the coding optimization pipeline, the payer rules engine integration with Coding / CDS, a versioning worked example, environment cascade, and RBAC enforcement.

Shared generation map. The IC platform code-gen flow, default bindings, environment cascade, RBAC model, and CLI commands are identical across all modules. See the IC Reference for the canonical shared reference. This section covers only Payer Optimization-specific content.

Technology stack P0

The shared platform stack (Cosmos DB, Redis, IC-generated API, Angular 21, SQS+SNS, OpenTelemetry, etc.) is documented in the IC Reference. Module-specific additions:

LayerTechnologyNotes
Coding optimization engineCoding / CDS moduleCDS Hooks invocation at charge-capture time; payer-specific rule overlay applied as additional CDS card.
Payer rules engineJSON rule definitions + in-process evaluatorRules stored as PayerRule.RuleDefinitionText (JSON); evaluated by a dedicated in-process rules evaluator. Quarterly refresh cycle.
Scheduling integrationScheduling moduleAdvisory payer-mix guidance sent to Scheduling via CDS Hooks; hard guardrails enforced in the Payer Optimization layer, not delegated to Scheduling.
Denial data feedRCM moduleDenial and remittance data flows from RCM into the ROI dashboard via async SQS messages.
FHIR resource profilesTask (suggestion), Coverage (payer)R4 baseline; USCDI v3 alignment for CY 2026.
Audit logDedicated Cosmos DB dedicated containerOptimizationAuditEntry rows written to a separate Cosmos DB container with synchronous replication for zero-data-loss durability.
Feature flagLaunchDarkly (or equivalent)Kill-switch for entire Payer Optimization module; disables all optimization behavior without a code deploy.

Payer Optimization override bindings P0

These overrides are declared in rules/*.rules.json and replace the default for the matching field name pattern.

FieldDefault would renderOverride componentWhy
PayerOptimizationConfig.IsEnabledBoolplain checkboxic-ng21-payer-opt-1-opt-in-dialogOpt-in requires disclosure acknowledgment; plain checkbox bypasses the compliance gate. The dialog enforces review-before-enable with disclosure text and timestamp recording.
PayerOptimizationConfig.DisclosureTextplain textareaic-ng21-core-1-textarea (read-only)Disclosure text is system-authored and read-only; the practice owner reviews but does not edit it.
PayerRule.RuleDefinitionTextplain textareaic-ng21-payer-opt-1-rule-editorStructured JSON rule editor with validation, type-specific templates (Modifier / PreAuth / Documentation / CodingThreshold / Bundling), and syntax checking; prevents malformed rule definitions.
PayerRule.RuleTypeString50plain text inputic-ng21-core-1-comboboxConstrained to the five valid rule types; free-text entry would allow invalid types.
PayerRule.IsActiveBoolplain checkboxic-ng21-core-1-checkbox (with confirmation)Retiring a rule (setting IsActiveBool = false) requires a confirmation dialog because it affects active coding suggestions.
CodingOptimizationSuggestion (full entity)default jtableic-ng21-payer-opt-1-suggestion-panelSide-panel showing suggestion cards with accept/reject actions, compliance badge, and original-vs-suggested code comparison. Plain jtable cannot convey the accept/reject workflow.
(synthetic) Scheduling guidance badgen/aic-ng21-payer-opt-1-scheduling-guidance-badgeInline badge in the Scheduling module showing payer-mix guidance status; rendered only when Payer Optimization is enabled and guidance is available.
(synthetic) E/M downcode alertn/aic-ng21-payer-opt-1-downcode-alertDedicated alert card for E/M downcode suggestions, distinct from upcode cards; ensures downcodes receive equal visual prominence per the compliance requirement.
(synthetic) ROI dashboardn/aic-ng21-payer-opt-1-roi-dashboardFull dashboard with denial-trend chart, payer-mix chart, suggestion acceptance rates, and optimization impact summary. Aggregated org-scoped data only.
(synthetic) Audit log viewern/aic-ng21-payer-opt-1-audit-log-viewerFilterable audit log display with date-range, action-type, actor, and patient filters. Compliance-officer-facing; not accessible to patient-level roles.

Coding optimization pipeline P1

The coding optimization pipeline runs after the clinician completes an encounter and before the charge is captured. It is triggered via CDS Hooks from the Coding / CDS module, with payer-specific rules applied as an additional CDS card overlay:

flowchart TD
  A[Clinician completes encounter] --> B{PayerOptimizationConfig
IsEnabledBool?} B -- No --> Z[No suggestions generated] B -- Yes --> C[Fetch active PayerRule set
for the encounter's payer] C --> D[Invoke CDS Hooks via
Coding / CDS module] D --> E[Evaluate base coding rules
ICD-10 / CPT / E/M levels] E --> F[Apply payer-specific
rule overlay] F --> G{Compliance validation:
IsCompliantBool?} G -- false --> H[Discard suggestion
log to internal audit] G -- true --> I{E/M downcode
candidate?} I -- Yes --> J[Create downcode
CodingOptimizationSuggestion] I -- No --> K[Create upcode/modifier
CodingOptimizationSuggestion] J --> L[Surface suggestion cards
to clinician] K --> L L --> M{Clinician accepts
or rejects?} M -- Accept --> N[Apply suggested code
set WasAcceptedBool = true
create OptimizationAuditEntry] M -- Reject --> O[Preserve original code
set WasAcceptedBool = false
create OptimizationAuditEntry]

The pipeline is synchronous from the clinician’s perspective (suggestions appear within 2 seconds per NFR-PO-001), but the compliance validation and audit entry creation are asynchronous to avoid blocking the clinical workflow. The IsEnabledBool check at step B is cached (1-hour TTL) to avoid a database round-trip on every encounter.

Payer rules engine — integration with Coding / CDS P0

Payer-specific rules are layered on top of the base coding rules from Coding / CDS. The integration uses CDS Hooks as the transport mechanism:

HookTriggerPayer Optimization contribution
order-selectClinician selects a diagnosis or procedure codePayer-specific modifier suggestions, bundling rules, and documentation thresholds surfaced as additional CDS cards
order-reviewClinician reviews the charge before signingE/M level validation against payer thresholds; downcode suggestions; pre-auth trigger warnings
appointment-bookScheduler books an appointmentAdvisory payer-mix guidance surfaced as a non-blocking card; guardrails enforced before the card reaches the Scheduling module

The payer rules evaluator (rules-evaluator.ts) runs in-process (not a separate microservice) to minimize latency. It evaluates the active PayerRule set for the encounter’s payer against the coding context and produces a list of payer-specific suggestions that are merged with the base CDS suggestions. The compliance validation step runs after the merge, discarding any suggestion where IsCompliantBool = false.

Versioning — worked example P0

All Payer Optimization artifacts are versioned break.feature.bug.buildtimestamp per IC hard rule #9. The example below traces a feature bump on CodingOptimizationSuggestion.

CodingOptimizationSuggestion 1.0.0.20260301T120000Z — Initial schema. 5 business fields plus org-scoped audit columns. Component ic-ng21-payer-opt-1-suggestion-panel and ic-ng21-payer-opt-1-downcode-alert bind to coding-optimization-suggestion@1.0.0.* via the DI manifest.

CodingOptimizationSuggestion 1.1.0.20260615T093000Z — feature bump — Adds a single optional field, PayerRuleID (Guid, FK → PayerRule), to link the suggestion to the specific payer rule that triggered it. Per the IC change matrix:

ChangeVersion impactApproval neededMin permission
Add optional field PayerRuleIDfeature bump (1.0.0 → 1.1.0)NoWrite (60)

Because the change is backward-compatible, the component tag stays ic-ng21-payer-opt-1-suggestion-panel. Existing UI consumers continue to bind coding-optimization-suggestion@1.x.* and ignore the new field. New UI surfaces that need payer-rule traceability bind coding-optimization-suggestion@^1.1.0. No new database is required (IC rule #13 only applies to break bumps).

CodingOptimizationSuggestion 2.0.0.20280101T120000Z — break bump (illustrative) — An illustrative future break bump: SuggestionReasonString200 is replaced by a structured set of fields (SuggestionCategoryString50, SuggestionDetailText, SupportingDocumentationRefString200). Per the IC change matrix this is change field type + add required fields — break bump, EditAMI (90) approval, and per IC rule #13 a new database is provisioned with ETL from the old one. The component tag becomes ic-ng21-payer-opt-2-suggestion-panel; consumers must re-bind. The old database stays live for the configured grace period (default 90 days) for rollback.

Illustrative. The 2.0.0 example is illustrative of the change matrix and IC rule #13; it is not a committed roadmap item.

Payer Optimization environment details

EnvCDS HooksRCM denial feedAudit container
DevCoding / CDS dev sandboxRCM dev stub (synthetic denials)Dev container (standard replication)
QACoding / CDS QA instanceRCM QA stub (scenario denials)QA container (standard replication)
UATCoding / CDS UAT instanceRCM UAT (realistic denial patterns)UAT container (synchronous replication)
ProdCoding / CDS productionRCM production (live denial data)Prod container (synchronous replication + PITR)

Payer Optimization RBAC notes

Cross-Module Dependencies

See also: Payer Optimization walkthrough · IC Reference