Spec: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.
specs/pm/specs/PM-07-EN-13-jurisdiction-aware-billing-rules.mdFeature ID: PM-07-EN-13
Core: PM
Status: Draft (ready for implementation pending review)
Summary
PM-07 timed-unit and modifier logic consumes jurisdiction-specific billing configuration from PF-96 profiles to remove hardcoded Arizona constants while preserving Arizona parity behavior.Integration Pattern
- Publisher Core: PF (jurisdiction profile data ownership)
- Consumer Core: PM (charge capture and billing rules evaluation)
- Pattern: Direct configuration dependency. PM reads PF-96 jurisdiction profile values via
pf_resolve_jurisdiction_profile()(SECURITY DEFINER) perdocs/architecture/integrations/API_CONTRACTS.md§ PF-96 anddocs/architecture/integrations/PF-96-medicaid-state-compliance-configuration-INTEGRATION.md. Frontend usesuseJurisdictionProfile()from@/platform/jurisdiction; edge functions use the RPC directly.
Data Contract (Read)
PM consumes the resolvedJurisdictionProfile (defined in src/platform/jurisdiction/types.ts) and reads:
billing.min_billable_minutes(number; AZ default8)billing.timed_code_unit_minutes(number; AZ default15)billing.modifier_conventions(ModifierConvention[]; may be empty)clinical.iop_php_compliance(IOP/PHP threshold and program-naming behavior)display_name(program label, e.g. “AHCCCS”)
Naming note: the underlying column ispf_jurisdiction_profiles.billing_rules(JSONB). Bothpf_resolve_jurisdiction_profile()anduseJurisdictionProfile()expose this JSON under thebillingkey onJurisdictionProfile. PM code MUST reference the runtime fieldbilling.*, not the column namebilling_rules.*.
Failure Modes
| Condition | Behavior | Logging |
|---|---|---|
| Profile RPC unreachable / timeout | Fall back to AHCCCS hardcoded defaults | warn (no PHI) |
Profile resolved but billing key missing | Fall back to AHCCCS hardcoded defaults | warn |
modifier_conventions empty/undefined | Use legacy hardcoded modifier logic | none |
min_billable_minutes <= 0 | Return 0 units (safety guard) | none |
useJurisdictionProfile() (staleTime: 5 min, gcTime: 10 min) on the frontend.
Security and Tenant Isolation
- Profile reads scoped by
organization_id(andsite_idwhen supplied). - All resolution flows through
pf_resolve_jurisdiction_profile(p_org_id, p_site_id)SECURITY DEFINER (search_path = public, pg_catalog); PM code does not querypf_jurisdiction_profilesdirectly. - No PHI in profile resolution; no PHI in fallback warnings.
- Billing calculations remain auditable via existing PM-07 charge audit paths.
- No new permission keys; uses existing
pm.charges.create/pm.charges.edit.
Backward Compatibility
- Arizona organizations remain behaviorally equivalent to legacy PM-07 logic.
- No breaking schema changes.
- Existing PM-07 unit/integration tests remain green with AZ fixture parity.
Related Specs
specs/pm/specs/PM-07-charge-capture-fee-schedules.mdspecs/pf/specs/PF-96-medicaid-state-compliance-configuration.mdspecs/pm/specs/PM-07-EN-14-payer-specific-modifier-rules-engine.mdspecs/pm/specs/PM-08-EN-13-jurisdiction-aware-filing-deadlines.md(sibling pattern)specs/pm/specs/PM-01-EN-02-jurisdiction-aware-patient-identifiers.md(sibling pattern)