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: specs/pf/specs/PF-96-medicaid-state-compliance-configuration.md Owner: PF (Platform Foundation) Created: 2026-03-29

Integration Overview

PF-96 provides the jurisdiction profile system — a multi-tier configuration layer that decouples state-specific Medicaid compliance rules from hardcoded constants. It is consumed by CL, PM, and PF features via a resolution function and frontend hook.

Platform Integration Layer

Location: src/platform/jurisdiction/ Public API:
ExportTypePurpose
useJurisdictionProfile(siteId?)React hookResolve effective profile for current org + optional site
useClinicalRules(siteId?)React hookConvenience accessor for clinical rule pack
useBillingRules(siteId?)React hookConvenience accessor for billing rule pack
useComplianceRules(siteId?)React hookConvenience accessor for compliance rule pack
JurisdictionProfileTypeScript interfaceResolved profile shape
ClinicalRulesTypeScript interfaceClinical rule pack
BillingRulesTypeScript interfaceBilling rule pack
ComplianceRulesTypeScript interfaceCompliance rule pack
Edge Function Helper:
ExportLocationPurpose
getJurisdictionProfile(client, orgId, siteId?)supabase/functions/_shared/jurisdiction.tsServer-side profile resolution

Event Contracts

Events Published

pf_jurisdiction_profile_changed
  • Publisher: PF-96 (on org/site jurisdiction config change)
  • Subscribers: CL-02, CL-04, CL-40, PM-07, PM-08, PM-41, PF-91
  • Payload Schema:
    {
      event_id: string; // UUID - unique event identifier for deduplication
      organization_id: string; // UUID
      site_id?: string; // UUID, present if site-level change
      old_profile_code: string; // e.g. "az-ahcccs"
      new_profile_code: string; // e.g. "ca-medi-cal"
      changed_by: string; // UUID of user who made the change
    }
    
  • Status: ✅ Complete

Events Consumed

EventSourcePurpose
pf_organization_createdPF-01Set default federal baseline jurisdiction profile on new org
pf_site_createdPF-19Prompt for jurisdiction profile if org is multi-state

API Contracts

RPC Functions

pf_resolve_jurisdiction_profile(p_org_id UUID, p_site_id UUID DEFAULT NULL)
  • Type: PostgreSQL RPC (SECURITY DEFINER)
  • Returns: JSONB — Merged profile with { profile_id, state_code, program_code, display_name, clinical, billing, compliance }
  • Consumers: All CL/PM features, PF-91 compliance dashboard, edge functions
  • Resolution Order: Federal baseline → State profile → Org overrides → Site overrides
  • Status: ✅ Complete

Consumer Integration Points

Consumer SpecWhat It ReadsHow It Integrates
CL-02 (Assessments)clinical.assessment_required_elements, clinical.assessment_completion_hoursuseClinicalRules() hook
CL-04 (Progress Notes)clinical.documentation_timeliness_hours, clinical.required_note_elementsuseClinicalRules() hook
CL-11 (Consent)clinical.minor_consent_age, clinical.sud_confidentiality_standarduseClinicalRules() hook
CL-40 (Intake)clinical.intake_assessment_typeuseClinicalRules() hook / edge function helper
PM-07 (Charge Capture)billing.min_billable_minutes, billing.modifier_conventionsuseBillingRules() hook
PM-08 (Claims)billing.filing_deadline_daysuseBillingRules() hook
PM-10 (Prior Auth)billing.bhrf_urgent_pa_exempt_daysuseBillingRules() hook
PM-18 (Scrub Rules)billing.modifier_conventionsgetJurisdictionProfile() edge fn
PM-41 (Compliance Reports)billing.compliance_window_hoursgetJurisdictionProfile() edge fn
PF-91 (Compliance Dashboard)All rule packsuseJurisdictionProfile() hook

Security

  • RLS: All three tables have RLS + FORCE enabled
  • Profile access: All authenticated users can read active profiles (shared reference data)
  • Config access: Org-scoped via pf_has_org_access(); admin writes via pf_has_org_role()
  • Federal baseline enforcement: pf_validate_jurisdiction_override() trigger prevents weakening federal requirements
  • No PHI: Profiles contain configuration data only; no patient data

References