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

# Peer Recovery Support Services — Integration

> Feature ID: CL-19 Status: ✅ Implemented Spec Reference: CL-19-peer-recovery-support-services.md Last Updated: 2026-02-23

**Feature ID:** CL-19\
**Status:** ✅ Implemented\
**Spec Reference:** [CL-19-peer-recovery-support-services.md](../../../specs/cl/specs/CL-19-peer-recovery-support-services.md)\
**Last Updated:** 2026-02-23

***

## Overview

CL-19 adds peer specialist and recovery coach encounter documentation with HCPCS code support (e.g. H0038, H2017), supervision tracking, and integration with the patient chart (CL-01) and charge capture (PM-07). Integration is via Platform Foundation, internal CL dependencies, and event-based integration with PM.

***

## Integration Points (from Spec)

| Dependency                    | Pattern  | Purpose                                                                                   |
| ----------------------------- | -------- | ----------------------------------------------------------------------------------------- |
| PF-01 (Organizations & Sites) | Direct   | Multi-tenant isolation                                                                    |
| PF-02 (RBAC)                  | Direct   | Role-based access                                                                         |
| PF-70 (Medical Terminology)   | Platform | HCPCS H0038, H2017 and org-specific codes                                                 |
| CL-01 (Patient Chart)         | Internal | Peer encounters visible on chart                                                          |
| CL-04 (Progress Notes)        | Internal | Distinct document type; not progress notes                                                |
| CL-11 (Part 2 Consent)        | Internal | `cl_check_sud_consent(chart_id, 'peer_encounter', auth.uid())` in RLS for peer encounters |
| PM-03 (Encounter)             | Data     | Optional `encounter_id` link from `cl_peer_encounters` to `pm_encounters`                 |
| PM-07 (Charge Capture)        | Event    | Encounter-to-billing event when peer encounter finalized; HCPCS from PF-70                |

***

## API / Data Contracts

* **Peer encounters:** `cl_peer_encounters` (chart\_id, encounter\_id, peer\_provider\_id, service\_date, start\_time, end\_time, duration\_minutes, service\_type, hcpcs\_code, focus\_notes). **service\_type:** Prefer **PF-15** as the primary source: use its `peer_encounter_type` seeded values (e.g. Peer support, Recovery coaching, Crisis peer) for cross-org standardization and reporting. If an org does not use PF-15, implement an org-scoped table `cl_peer_service_types` and expose a config flag (e.g. `use_pf15 = true/false`) so implementations support both paths deterministically. Decision criteria: use PF-15 for cross-org standardization and reporting; use `cl_peer_service_types` for org-customized vocabularies. No public REST API; access via Supabase client and RLS.
* **Peer supervision:** `cl_peer_supervision` (peer\_provider\_id, supervisor\_id, supervision\_date, modality, notes). **SUD indicator deferred to Phase 2.** For MVP, supervision records have no `chart_id` and no machine-readable SUD flag; application layer treats supervision as non-SUD unless org policy mandates otherwise. Phase 2 may add an optional `notes_sud_flag BOOLEAN` or `chart_id` column to enable `cl_check_sud_consent` enforcement on supervision records. Same access pattern as peer encounters (org-scoped RLS via `cl_has_org_access`).
* **Consent (CL-11):** RLS for `cl_peer_encounters` MUST call `cl_check_sud_consent(p_chart_id, p_record_type, p_requesting_user)` with `record_type = 'peer_encounter'`. Signature and behavior defined in [CL-11 spec Errata E-2](../../../specs/cl/specs/CL-11-consent-management-42cfr-part2.md) and [CL-11 integration](./consent-management-42cfr-part2-integration.md). Example: `USING (cl_has_org_access(organization_id) AND cl_check_sud_consent(chart_id, 'peer_encounter', auth.uid()))`. For `cl_peer_supervision` in MVP, no `chart_id` exists, so CL-11 consent checks are deferred to Phase 2 when `chart_id` or `notes_sud_flag` is introduced; until then, supervision records remain org-scoped through `cl_has_org_access`.

***

## Event Contracts

* **Published:** `peer_encounter_finalized` (CL-19 → PM-07). Payload: peer\_encounter\_id, organization\_id, chart\_id, encounter\_id (optional), peer\_provider\_id, service\_date, hcpcs\_code, duration\_minutes. See [EVENT\_CONTRACTS.md](./EVENT_CONTRACTS.md).
* **Consumed:** None for MVP.

***

## Security and RLS

* **Tables:** `cl_peer_encounters`, `cl_peer_supervision` — RLS enabled; org-scoped via SECURITY DEFINER helpers; UPDATE policies with WITH CHECK per constitution §5.2.4.
* **Part 2 (CL-11):** Use helper `cl_check_sud_consent(chart_id, 'peer_encounter', auth.uid())` in RLS for `cl_peer_encounters`; see CL-11 spec and integration doc.
* **PHI:** Encounter and supervision data are PHI; no PHI in logs or external AI.

***

## Related Docs

* [CL-19 Spec](../../../specs/cl/specs/CL-19-peer-recovery-support-services.md)
* [CL-PM Encounter-to-Billing](./CL-PM-ENCOUNTER-TO-BILLING.md) — Charge capture pipeline
* [PF-70 Medical Terminology](./medical-terminology-code-libraries-integration.md) — HCPCS code library
* [CL-11 Consent](./consent-management-42cfr-part2-integration.md) — Part 2 consent
* [docs/architecture/integrations/index.md](index.md)
