Skip to main content

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.

Spec: CE-28 — Intake Screening & Triage Workflow
Date: 2026-03-28
Reviewer: AI Agent (post-implementation review)

1. PHI Handling

ControlImplementationEvidence
PHI at restSupabase encryption; screening data in ce_screening_attempts and ce_screening_resultsTables created via migration with RLS
PHI in eventsEvent payloads contain only IDs and flags; no free-text clinical datauseCreateScreening.ts — payload construction excludes chief_complaint, notes
PHI in logsNo PHI logged; synthetic data in testsTest files use Test-CE-28-* naming
PHI in errorssanitizeErrorMessage() used in all user-facing error handlersComponent files use sanitized errors
ControlImplementationEvidence
Consent captureconsent_obtained, consent_method, consent_recorded_at columns on ce_screening_attemptsMigration file
Consent gating on eventsce_screening_completed only published when consent_obtained === trueuseCreateScreening.ts — conditional publish
Consent metadata in eventsconsent_recorded_at included in event metadataEvent payload construction
Consent UIForm requires consent checkbox before submissionScreeningForm.tsx — consent fields

3. Tenant Isolation

ControlImplementationEvidence
RLS on all tablesce_screening_attempts, ce_screening_results, ce_screening_questionnaires, ce_screening_sla_configMigration with ENABLE ROW LEVEL SECURITY + FORCE ROW LEVEL SECURITY
SECURITY DEFINER helpersce_can_view_screening() with REVOKE/GRANT patternMigration file
org_id on mutationsAll hooks use .eq('organization_id', orgId)Hook files
RLS tests4 test files covering all tablestests/rls/ce-screening-*.rls.test.ts

4. Access Control

ControlImplementationEvidence
Permission gatingce.screening.view, ce.screening.create, ce.screening.managePermission constants + seed migration
Route-level guards<PermissionGate> on screening routeRoute configuration
No hardcoded rolesPermission hooks used throughoutComponent files

Summary

CE-28 meets HIPAA Privacy Rule and 42 CFR Part 2 requirements for:
  • PHI protection (encryption at rest, no PHI in events/logs)
  • SUD consent gating (3-field consent capture, event-level enforcement)
  • Tenant isolation (RLS + application-level org_id filtering)
  • Access control (permission-based, not role-based)
Status: ⚠️ Implementation complete for Phase 1+1.5 scope — formal compliance sign-off pending