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

# Zero Suicide Framework Implementation - Integration

> Feature ID: CL-07-EN-01 Status: 📋 Planned Spec Reference: specs/cl/specs/CL-07-EN-01-zero-suicide-framework.md Last Updated: 2026-04-10

**Feature ID:** CL-07-EN-01\
**Status:** 📋 Planned\
**Spec Reference:** `specs/cl/specs/CL-07-EN-01-zero-suicide-framework.md`\
**Last Updated:** 2026-04-10

***

## Overview

CL-07-EN-01 extends CL-07 with structured lethal means assessment capture, safety plan sharing with consent controls, and automated high-risk follow-up scheduling. This enhancement integrates with platform scheduling, notifications, and clinical context layers while preserving CL ownership boundaries.

***

## Integration Points

| Dependency                  | Pattern                                              | Purpose                                                                                                             |
| --------------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| PF-01 Organizations & Sites | Direct dependency                                    | Tenant/site scope for all created records and operations                                                            |
| PF-10 Notifications         | Platform Integration Layer                           | Notify clinicians/support network for safety-plan sharing (signed URL in `action_url`) and follow-up milestones     |
| PM-03 Scheduling            | Platform Integration Layer (`@/platform/scheduling`) | Create 24/48/72 follow-up encounters without direct CL->PM imports                                                  |
| PF-96 Jurisdiction Profiles | Platform Integration Layer                           | Support jurisdiction-specific policy parameters without hardcoded state constants                                   |
| CL-11 Consent Management    | Platform Clinical Layer (`@/platform/clinical`)      | `useConsentCheck(chartId, 'safety_plan_share')` → `cl_check_sud_consent` RPC for Part 2 consent gating before share |
| Supabase Storage            | Direct (edge function)                               | 24h signed URLs; share-row gate + audit (see below)                                                                 |

### Storage / signed URL policy

* Bucket: `cl-safety-plan-shares`. TTL: `createSignedUrl(..., 86400)` (24h).
* Before issuing or returning a signed URL: require `cl_safety_plan_shares.status === 'active'`; reject
  `revoked` / `expired`. Persist revocation as `status = 'revoked'`.
* Log each fetch: share row id, user id, timestamp, client IP, outcome (allow/deny).

***

## Event and API Contracts

### Planned Events

* **`cl_safety_plan_shared`**
  * Publisher: CL
  * Subscribers: PF-10 notifications, workflow listeners
  * Payload (minimum): `organization_id`, `patient_id`, `safety_plan_id`, `shared_by`, `shared_at`

* **`cl_zero_suicide_followup_scheduled`**
  * Publisher: CL
  * Subscribers: PM scheduling views, PF-10 reminders
  * Payload (minimum): `organization_id`, `patient_id`, `followup_type`, `scheduled_for`, `encounter_id`

### API Surface (planned)

* `createSafetyPlanShare(...)` — consent via `cl_check_sud_consent`; PDF to Storage; signed URL (24h TTL);
  insert `cl_safety_plan_shares` (`status = active`, `expires_at` aligned); PF-10 `action_url` = URL
* `scheduleZeroSuicideFollowups(chartId, riskLevel)` — creates 24/48/72h follow-up appointment requests via `@/platform/scheduling` when riskLevel is 'high' or 'imminent'

***

## Security and Compliance Notes

* Enforce tenant isolation via `organization_id` and RLS on new CL tables.
* Enforce consent-aware sharing logic for SUD/Part 2-sensitive content.
* Log only identifiers in integration payloads; avoid PHI-rich payload structures.

***

## Related Documentation

* `docs/architecture/integrations/CL-07-suicide-risk-screening-safety-planning-INTEGRATION.md`
* `docs/architecture/integrations/CROSS_CORE_INTEGRATIONS.md`
* `docs/architecture/integrations/EVENT_CONTRACTS.md`
* `docs/architecture/integrations/API_CONTRACTS.md`
