> ## 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.

# Payer Enrollment & EDI Onboarding — Integration Contract

> Status: ✅ Complete Spec Reference: specs/pm/specs/PM-46-payer-enrollment-edi-onboarding.md Last Updated: 2026-04-08

**Status:** ✅ Complete
**Spec Reference:** `specs/pm/specs/PM-46-payer-enrollment-edi-onboarding.md`\
**Last Updated:** 2026-04-08

***

## Integration Overview

PM-46 tracks EDI enrollment lifecycle per payer, per NPI, per transaction type. It integrates with several PM-internal specs and PF platform layers.

***

## Platform Foundation Dependencies

| PF Spec                       | Integration Type           | What PM-46 Consumes                                           |
| ----------------------------- | -------------------------- | ------------------------------------------------------------- |
| PF-01 (Organizations & Sites) | Direct dependency          | `organization_id`, `site_id` scoping                          |
| PF-02 (RBAC)                  | Direct dependency          | Role-based access control                                     |
| PF-10 (Notifications)         | Platform Integration Layer | Alert delivery for stalled enrollments, credentialing prompts |
| PF-30 (Permissions)           | Direct dependency          | Permission key enforcement (`pm.edi-enrollment.*`)            |

***

## Internal PM Dependencies

### PM-17 → PM-46: Credentialing-to-Enrollment Event

**Pattern:** Platform Event (Pattern 2)\
**Status:** 📝 Planned

**Event:** `pm.credentialing.completed`\
**Publisher:** PM-17 (Provider Credentialing)\
**Subscriber:** PM-46 (EDI Onboarding)

**Purpose:** When PM-17 marks a provider as credentialed with a payer, PM-46 receives a notification to prompt EDI enrollment initiation.

**Payload (planned):**

```json theme={null}
{
  "organization_id": "uuid",
  "provider_enrollment_id": "uuid",
  "provider_id": "uuid",
  "payer_id": "uuid",
  "npi": "string",
  "credentialing_effective_date": "date",
  "event_type": "pm.credentialing.completed"
}
```

**Subscriber action:** Create task/notification prompting user to initiate EDI enrollment; optionally pre-populate enrollment record stubs.

### PM-15: Clearinghouse Reference

**Pattern:** Data reference (FK)\
**Status:** 📝 Planned

PM-46's `pm_payer_edi_enrollments.clearinghouse_id` references `pm_clearinghouse_config.id` from PM-15. PM-46 tracks the enrollment application lifecycle; PM-15's `pm_payer_enrollments` tracks submission-readiness status. These are complementary, not competing.

### PM-27: NPI & Site Data

**Pattern:** Data reference (read)\
**Status:** 📝 Planned

PM-46 reads NPI and site data from PM-27's `pm_site_billing_config` to populate the enrollment matrix. No write dependency.

### PM-07: Payer Reference

**Pattern:** Data reference (FK)\
**Status:** 📝 Planned

PM-46's `payer_id` references the shared `pm_payers` table (also used by PM-07, PM-08, PM-15).

### PM-08: Remittance Volume Data

**Pattern:** Data read (query)\
**Status:** 📝 Planned

PM-46 FR-4.1 (ERA gap report) queries PM-08 claims data for estimated monthly remittance volume per payer. Fallback is manual priority score when PM-08 data is insufficient.

***

## Scheduled Processing

| Job                             | Schedule                 | Edge Function                                       | Purpose                                                |
| ------------------------------- | ------------------------ | --------------------------------------------------- | ------------------------------------------------------ |
| `pm-edi-enrollment-stall-check` | `0 8 * * *` (daily 8 AM) | `/supabase/functions/pm-edi-enrollment-stall-check` | Detect stalled enrollments, create PF-10 notifications |

***

## Validation Checklist

* [ ] Event contract for `pm.credentialing.completed` added to EVENT\_CONTRACTS.md
* [ ] FK relationships validated against PM-15, PM-17, PM-27 schemas
* [ ] PF-10 notification types registered for stalled enrollment alerts
* [ ] Permission keys seeded in migration
* [ ] Cross-core integration matrix updated

***

**Last Updated:** 2026-04-08
