Status: ✅ Implemented
Spec Reference: CL-27-behavioral-health-program-scheduling-templates.md
Last Updated: 2026-02-25
Overview
CL-27 defines program schedule templates (IOP, PHP, residential, outpatient), patient program enrollment, group session auto-creation from templates, attendance compliance, and conflict detection with individual appointments. Integrations: CL-14 (group sessions), PM-03/PM-04 (scheduling), RH (census).Integration Points (from Spec)
API / Data Contracts
- CL-14 session creation:
useProgramSessionGenerationhook readsschedule_definition.blockswhereservice_type === 'group', inserts intocl_group_sessionswithcustom_fields.program_schedule_idfor linkage. Fire-and-forget; exception dates skipped. Batch insert for N weeks. - PM-03/PM-04 conflict check: Deferred to PM-03/PM-04 implementation. When available, query PM schedule for patient appointments overlapping program blocks and surface warning in enrollment dialog.
Event Contracts
- Deferred: Events for program enrollment start/end or template changes to be added when workflow automation (FW-16) consumes them. No events published in MVP.
Security and RLS
- All CL-27 tables use
organization_id(andsite_idoncl_program_schedules); RLS via SECURITY DEFINER (e.g.cl_has_org_access); UPDATE policies include WITH CHECK (§5.2.4). Enrollment/chart linkage is PHI; no RLS policy may query RLS-protected tables directly (§5.7).
Related Docs
- CL-14-group-therapy-documentation-INTEGRATION.md
- CL-PM-GROUP-SESSIONS.md — PM-04 / CL-14 group scheduling
- CROSS_CORE_INTEGRATIONS.md — Integration matrix