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.

Feature ID: CL-03
Status: ✅ Implemented
Spec Reference: CL-03-treatment-planning.md
Last Updated: 2026-02-17
Last Verified: 2026-02-19

Table of Contents


Overview

CL-03 defines treatment planning per AHCCCS AMPM 320-O: measurable goals (patient’s own words, frequency, duration, target date), service line-specific timeframes, patient/HCDM signature with agreement/disagreement and appeal rights, multi-disciplinary team sign-off, annual and event-triggered review. It depends on PF (organizations, RBAC, digital signatures, notifications) and CL-01 (chart), CL-02 (assessment findings), CL-04 (progress notes → goal progress).

Quick Reference

ItemValue
Core tablescl_treatment_plans, cl_treatment_goals, cl_treatment_interventions, cl_treatment_plan_signatures
Signature flowPatient/HCDM + clinician + optional co-sign with attestation
Review triggerstreatment_plan_review_scheduled, treatment_plan_event_triggered
Key downstream linkCL-04 progress notes update goal progress

Decision Tree

  • Goal-setting and review flow: Create plan (CL-01 chart context) → add measurable goals (patient wording, frequency, duration, target date) → optional linkage to CL-02 assessment findings → patient/HCDM signature (PF-33) with agreement/disagreement and appeal rights → multidisciplinary sign-off → annual review (trigger: treatment_plan_review_scheduled 30 days before review_due_date) and event-triggered review (trigger: treatment_plan_event_triggered on life events); goal progress updated from CL-04 when progress notes are saved.
  • Triggers: CL-02 (findings → optional goal-to-finding link); CL-04 (progress note → progress_pct); PF-10 (review-due and event-triggered notifications).

Pattern Library

PatternUse
Goal templatesCanonical measurable-goal structure (patient wording, frequency, duration, target date); service line-specific timeframes
Signature / consentPF-33 for patient/HCDM and clinician; agreement/disagreement; appeal rights attestation (custom_fields or dedicated columns)
Multidisciplinary sign-offTeam sign-off on plan; store in cl_treatment_plan_signatures (Errata E-1)
Review triggersAnnual: pg_cron or scheduler → treatment_plan_review_scheduled; event: user records life event → treatment_plan_event_triggered

Common Mistakes

SymptomCauseRemediation
Goals not measurableVague wording or missing frequency/duration/target dateRequire patient’s own words, frequency, duration, target date per spec
Missing patient signaturePF-33 not invoked or disagreement path skippedCapture signature; on disagreement, complete appeal-rights attestation and store
user_id omitted on life-event triggerEvent payload missing audit fieldFor user-initiated triggers, include user_id (required per EVENT_CONTRACTS) for auditability
Signed plan updated in placeUPDATE without amendment pathCreate new version with previous_plan_id; signed rows immutable

Pre-Flight Checklist

  • Measurable-goal fields: patient wording, frequency, duration, target date present and validated.
  • Required signatures: patient/HCDM and clinician via PF-33; agreement/disagreement and appeal rights path implemented.
  • RBAC: Treatment plan permissions (create, sign, review) per PF-30; RLS via cl_has_org_access / cl_has_chart_access (CL-01 helpers).
  • Digital signature and notification hooks: PF-33 integration; PF-10 subscription for treatment_plan_review_scheduled and treatment_plan_event_triggered.
  • Annual and event-trigger review: Scheduler for review-due (30 days before review_due_date); life-event recording publishes treatment_plan_event_triggered with user_id when user-initiated.

Integration Points (from Spec)

DependencyPatternPurpose
PF-01 (Organizations & Sites)DirectMulti-tenant isolation; all tables scoped by organization_id
PF-02 (RBAC)DirectClinical treatment plan permissions (create, sign, review); recommend keys per PF-30
PF-33 (Digital Signatures)DirectPatient/HCDM and clinician signature capture; agreement/disagreement; appeal rights attestation
PF-10 (Notifications)EventReview-due alerts (30 days before annual); event-triggered update alerts (48h from event recorded)
CL-01 (Patient Chart)InternalPlans render within patient chart; plan list and detail in chart context
CL-02 (Assessments)Event / DataAssessment findings inform goal development; optional FK goal → finding; event payload: findings, linkedGoals
CL-04 (Progress Notes)Data / EventProgress notes link to goals; goal progress_pct updated from CL-04 (push when note saved); aggregation rules in CL-04

API / Data Contracts

  • Plan data: cl_treatment_plans, cl_treatment_goals, cl_treatment_interventions, cl_treatment_plan_signatures (Errata E-1); all scoped by organization_id; RLS via CL-01 SECURITY DEFINER helpers (cl_has_org_access, cl_has_chart_access, pf_is_org_admin).
  • PF-33: Request { signerId, documentId, payloadHash }; response { signedAt, signatureBlob }. Used for patient/HCDM and clinician signatures; disagreement triggers appeal-rights step (attestation + date; store in custom_fields or dedicated columns).
  • Signed plans: Immutable; updates create new version with previous_plan_id; amendment/supersede path only for UPDATE on signed rows.
  • Service line: User-selected at plan creation; constrained by chart/enrollment when available; drives FR-2 timeframe rules.

Event Contracts

Payload schemas are defined in EVENT_CONTRACTS.md (Planned Events CL/PM):
  • treatment_plan_review_scheduled: Published when plan review is due (e.g. 30 days before annual review_due_date). Payload: event_type, organization_id, timestamp, treatment_plan_id, chart_id, review_due_date (see EVENT_CONTRACTS). Consumer: PF-10 → notification to assigned clinician/care coordinator.
  • treatment_plan_event_triggered: Published when a life event is recorded that triggers plan update (hospitalization, move, LOC change, incarceration). Payload: event_type, organization_id, timestamp, chart_id, event_recorded_at, optional life_event_type, treatment_plan_id (see EVENT_CONTRACTS). Phase 1: manual event entry only; future ADT integration. Success metric: alert within 48h of event recorded.
  • CL-02 → CL-03: Assessment findings event (from CL-02) may include linkedGoals?: UUID[] for goal linkage. CL-03 consumes for optional goal-to-finding FK or narrative link.
  • CL-04 → CL-03: When a progress note linked to a goal is saved, CL-04 (or platform layer) updates cl_treatment_goals.progress_pct; aggregation rules defined in CL-04.

Labeled Example

Example: treatment_plan_review_scheduled payload

{
  "event_type": "treatment_plan_review_scheduled",
  "organization_id": "org-uuid",
  "treatment_plan_id": "plan-uuid",
  "chart_id": "chart-uuid",
  "review_due_date": "2026-12-01",
  "timestamp": "2026-11-01T00:00:00Z"
}

Security and RLS

  • RLS on all four tables with FORCE ROW LEVEL SECURITY; per-operation policies use CL-01 helpers (cl_has_chart_access for SELECT, cl_has_org_access for INSERT/UPDATE, pf_is_org_admin for DELETE); no direct queries to RLS-protected tables (constitution §5.7).
  • UPDATE policies include WITH CHECK; signed-plan immutability enforced via cl_prevent_signed_plan_update() BEFORE UPDATE trigger (not in RLS clauses).
  • Patient signature and appeal-rights data require secure storage; PHI.
  • 42 CFR Part 2 (SUD): Treatment plans that reference or expose SUD-related problems or goals must enforce CL-11 consent before display or export. Apply cl_has_sud_consent() (or equivalent) where plan/goal data is surfaced when linked to Part 2–covered diagnoses.