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

# CL-PM Integration Contract: Referrals

> Version: 1.0.0 Last Updated: 2026-02-17 Constitution Reference: Section 1.2 (Core Independence), Section 1.3 (Integration Patterns) Source: CL-PM-SPEC-REVIEW F…

**Version:** 1.0.0
**Last Updated:** 2026-02-17
**Constitution Reference:** Section 1.2 (Core Independence), Section 1.3 (Integration Patterns)
**Source:** CL-PM-SPEC-REVIEW Finding 5.2

***

## Overview

Referrals involve both clinical coordination (CL-12) and business operations (PM-06). This contract defines the ownership boundary and integration pattern.

***

## Ownership Boundaries

| Concern                                     | Owner | Spec                            |
| ------------------------------------------- | ----- | ------------------------------- |
| Referral lifecycle (create, track, convert) | PM-06 | `pm_referrals`                  |
| Referral source/attribution tracking        | PM-06 | `pm_referrals.source`           |
| Insurance verification for referral         | PM-02 | Eligibility check               |
| Clinical summary for referral               | CL-12 | `cl_transitions`                |
| Medication reconciliation at transition     | CL-05 | `cl_medication_reconciliations` |
| Treatment plan transfer                     | CL-03 | `cl_treatment_plans`            |
| Safety plan update                          | CL-07 | `cl_safety_plans`               |
| C-CDA transition document                   | CL-16 | FHIR/C-CDA generation           |

**Principle:** PM-06 owns the referral entity. CL-12 adds clinical context by linking transitions to referrals through the Platform Integration Layer.

***

## Integration Pattern

### Event: `referral_accepted`

**Publisher:** PM-06
**Subscribers:** CL-12
**Channel:** `cl_pm_events`

When a referral is accepted (status → `accepted`), CL-12 receives the event to:

1. Create a `cl_transitions` record (type = `referral`)
2. Trigger discharge checklist if outbound referral
3. Trigger medication reconciliation
4. Generate C-CDA transition summary (via CL-16)

```typescript theme={null}
interface ReferralAccepted {
  event: 'referral_accepted';
  publisher: 'PM';
  subscriber: ['CL'];
  payload: {
    referral_id: uuid;
    patient_id: uuid;
    referral_direction: 'inbound' | 'outbound';
    from_facility?: string;
    to_facility?: string;
    from_level_of_care?: string;
    to_level_of_care?: string;
    referral_reason: string;
    urgency: 'routine' | 'urgent' | 'emergent';
  };
  metadata: {
    organization_id: uuid;
    user_id: uuid;
    timestamp: string;
    correlation_id: uuid;
  };
}
```

### Data Linkage

CL-12 `cl_transitions` references the PM-06 referral through the Platform Integration Layer:

```sql theme={null}
-- CL-12 adds this column to cl_transitions
referral_id UUID  -- References pm_referrals.id via Platform Integration Layer
                  -- NOT a direct FK (would violate core independence)
                  -- Validated at application layer, not database level
```

***

## Workflow: Outbound Referral with Clinical Transition

```
PM-06: Referral created (outbound, status = 'pending')
  ↓
PM-02: Insurance eligibility verified at destination
  ↓
PM-06: Referral accepted (status = 'accepted')
  → publishes referral_accepted event
  ↓
CL-12: Creates cl_transitions record (type = 'referral')
  ↓ (parallel)
CL-05: Medication reconciliation triggered
CL-07: Safety plan reviewed/updated
CL-16: C-CDA transition summary generated
CL-03: Treatment plan review triggered
  ↓
CL-12: Transition checklist completed
  → publishes transition_completed event
  ↓
PM-06: Referral status updated to 'completed'
```

***

## Cross-Reference

| Spec  | Responsibility                                       |
| ----- | ---------------------------------------------------- |
| PM-06 | Referral entity lifecycle, source tracking           |
| CL-12 | Clinical transition documentation, care coordination |
| CL-05 | Medication reconciliation at transition              |
| CL-07 | Safety plan update                                   |
| CL-16 | C-CDA transition summary                             |
| PM-02 | Eligibility verification                             |
