Skip to main content
Feature ID: CL-08
Status: 📝 Planned
Spec Reference: CL-08-clinical-decision-support.md
Last Updated: 2026-02-18

Table of Contents


Overview

CL-08 provides clinical decision support (CDS): drug-drug and drug-allergy alerts, medication monitoring reminders (e.g. lithium, clozapine), documentation completeness and overdue alerts, and quality measure gap detection (HEDIS: FUH, FUM, IET, AMM). Alerts are configurable per organization (severity, hard stop vs soft), with override tracking for alert fatigue management. Delivery uses PF-10 (notifications).

Quick Reference


Integration Points (from Spec)

Drug interaction data source: CL-05/CL-06/CL-08 do not specify the interaction database (First Databank, Medi-Span, RxNav/NLM, etc.). Per CL-PM-SPEC-REVIEW: define data source and update process in a PF-level or CL-08 integration contract. CL-05 integration doc currently references RxNav/NLM for MVP with interface abstracted for future FDB swap; CL-08 should use the same abstraction.

API / Data Contracts

cl_cds_rules

  • Scope: organization_id; rule types and trigger_event per spec Data Model.
  • Condition/action: JSONB schemas per spec Errata E-3.
  • Audit: created_at, updated_at; add created_by, updated_by per Errata E-1.
  • Custom fields: custom_fields JSONB NOT NULL DEFAULT '{}'.

cl_cds_alerts

  • Scope: organization_id, chart_id; optional rule_id linking to rule that fired.
  • Lifecycle: triggered_at → acknowledged_by/acknowledged_at; overridden + override_reason when user proceeds despite alert.
  • Audit: created_at, updated_at; add created_by, updated_by per Errata E-1.

CDS invocation (inbound)

  • Callers: CL-05 (medication list + allergies → interaction check), CL-06 (prescription submit → interaction/allergy check), documentation/chart flows (documentation_gap, quality_measure_eval).
  • Response: List of alerts with severity and is_hard_stop; caller blocks or shows modal per config.

Outbound to PF-10

  • Payload: Alert title, message, severity, chart_id, user context; optional deep link to chart/medication.
  • When: On insert of cl_cds_alerts (or via application logic that creates alert then notifies).

Event Contracts

Registration: Both cds_alert_triggered and cds_rule_overridden must be inserted into fw_workflow_events with category = 'operational' during Phase 1 migration.

Security and RLS

  • RLS: Enabled on cl_cds_rules and cl_cds_alerts; org isolation via cl_has_org_access(organization_id) (per Errata E-2). Do not use current_setting('app.current_org').
  • Rule CRUD: Restrict INSERT/UPDATE/DELETE on cl_cds_rules to users with org access and permitted role (e.g. admin, compliance) via SECURITY DEFINER helper cl_can_manage_cds_rules(organization_id, auth.uid()).
  • Alerts: SELECT/UPDATE for clinicians in same org; UPDATE for acknowledgement/override only (clinician or prescriber roles). Compliance may manage rules; may have read-only access to alert history for audit.
  • SECURITY DEFINER: All helpers use SET search_path = public. UPDATE policies include WITH CHECK (§5.2.4).