Feature ID: CL-19Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
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)
| 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 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