Status: ✅ Implemented
Spec Reference: 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)
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 itspeer_encounter_typeseeded 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 tablecl_peer_service_typesand 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; usecl_peer_service_typesfor 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 nochart_idand no machine-readable SUD flag; application layer treats supervision as non-SUD unless org policy mandates otherwise. Phase 2 may add an optionalnotes_sud_flag BOOLEANorchart_idcolumn to enablecl_check_sud_consentenforcement on supervision records. Same access pattern as peer encounters (org-scoped RLS viacl_has_org_access). - Consent (CL-11): RLS for
cl_peer_encountersMUST callcl_check_sud_consent(p_chart_id, p_record_type, p_requesting_user)withrecord_type = 'peer_encounter'. Signature and behavior defined in CL-11 spec Errata E-2 and CL-11 integration. Example:USING (cl_has_org_access(organization_id) AND cl_check_sud_consent(chart_id, 'peer_encounter', auth.uid())). Forcl_peer_supervisionin MVP, nochart_idexists, so CL-11 consent checks are deferred to Phase 2 whenchart_idornotes_sud_flagis introduced; until then, supervision records remain org-scoped throughcl_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. - 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 forcl_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
- CL-PM Encounter-to-Billing — Charge capture pipeline
- PF-70 Medical Terminology — HCPCS code library
- CL-11 Consent — Part 2 consent
- docs/architecture/integrations/index.md