1. Permission setup
CL-31 introduces five permission keys (registered insrc/platform/permissions/constants.ts and seeded into pf_module_permissions):
Default role assignments
The seed migration assigns:licensed_clinician— all five permissions.clinical_admin— all five permissions.platform_admin— inherits via the platform admin override.
pf_role_permissions per your tenant’s role model.
2. Org-level configuration
There are no tenant-level COD settings in Phase 1+2. Phase 3 may add a “COD documentation enabled” feature flag incl_module_settings.custom_fields.
3. Audit and oversight
- All access to
cl_cod_assessmentsis governed by RLS (pf_has_org_access); cross-org reads return empty. - Mutations are timestamped via
created_by/updated_by. Theprevent_org_id_changetrigger blocks any attempt to move a row between organizations. - SUD-content access is checked at every read via the
cl_check_sud_consentRPC; default-deny applies on any failure or missing consent. - Consent grants are recorded in CL-11 (
cl_consents); redisclosure events are logged incl_consent_redisclosure_log(CL-11-EN-22).
4. Compliance crosswalk
5. Troubleshooting
Consent gate stays in amber-banner state for an authorized clinician.- Verify the patient has an active
sud_counseling_notesconsent in CL-11. - Check that the clinician’s role has
cl.cod_progress_notes.view_sud. - Confirm
cl_check_sud_consentRPC is deployed (one of the CL-11 conditions for go-live).
- The prompt fires once per browser session per chart. Clear localStorage or use the manual toggle in the chart header.
- Confirm RLS — the row’s
organization_idmust match the user’s active org. - Filter chips may be applied; reset filters at the top of the tab.
cl_moud_enrollments.
- The
moud_episode_idFK is nullable. If CL-21 is not deployed, the column remains unset; UI hides the MOUD callout.
6. Operational checklist before go-live
- CL-11 consent service deployed (RPC + tables) — required by compliance condition #1.
- Permission seed migration applied; verify with
SELECT * FROM pf_module_permissions WHERE permission_key LIKE 'cl.cod_%';. - RLS smoke tests pass:
npm run test:rls -- cl-31-cod. - Integration tests pass:
npm run test:integration -- cl-31-cod-workflow. - Legal review of
sud_counseling_notesconsent type completed (compliance condition #3). - Tenant-specific COD documentation policy attached in GR.
7. Related references
- Consent compliance admin guide (CL-11)
- Electronic consent admin guide
- Clinical audit & compliance dashboard admin guide
- Spec:
specs/cl/specs/CL-31-co-occurring-disorder-integrated-documentation.md - Compliance sign-off:
specs/cl/reviews/CL-31-COMPLIANCE-SIGNOFF.md