Generated by npm run db:docs:generate — DO NOT EDIT BY HAND. Change the schema via a migration, then regenerate.
Core: cl_ · Tables: 146 · Source generated: 2026-06-10T02:55:32.169Z
Entity relationships
Tables
cl_988_transfers
CL-07 EN-26: Documents 988 Crisis Line warm transfer outcomes
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)safety_plan_id→cl_safety_plans(id)screening_id→cl_risk_screenings(id)updated_by→pf_profiles(id)
cl_988_transfers_delete(DELETE)cl_988_transfers_insert(INSERT)cl_988_transfers_select(SELECT)cl_988_transfers_update(UPDATE)
cl_aftercare_plans
CL-29: Structured discharge aftercare plans linked to patient charts and optionally to care transitions
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_aftercare_plans_delete(DELETE)cl_aftercare_plans_insert(INSERT)cl_aftercare_plans_select(SELECT)cl_aftercare_plans_update(UPDATE)
cl_ai_documentation_sessions
CL-36: Immutable audit log of AI-assisted clinical documentation sessions. No DELETE allowed.
RLS: ✅ enabled (3 policies)
Foreign keys:
attestation_by→pf_profiles(id)chart_id→cl_patient_charts(id)created_by→pf_profiles(id)encounter_id→pm_encounters(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
cl_ai_doc_sessions_insert(INSERT)cl_ai_doc_sessions_select(SELECT)cl_ai_doc_sessions_update(UPDATE)
cl_ai_note_attributions
CL-36: Attribution records for AI-assisted clinical notes. Links notes to AI sessions with attestation tracking. No DELETE allowed.
RLS: ✅ enabled (3 policies)
Foreign keys:
ai_attestation_by→pf_profiles(id)ai_session_id→cl_ai_documentation_sessions(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_ai_note_attr_insert(INSERT)cl_ai_note_attr_select(SELECT)cl_ai_note_attr_update(UPDATE)
cl_allergies
CL-01: Patient allergy records with severity classification and verification tracking.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)documented_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)verified_by→pf_profiles(id)
cl_allergies_delete(DELETE)cl_allergies_insert(INSERT)cl_allergies_select(SELECT)cl_allergies_update(UPDATE)
cl_allergy_alert_overrides
CL-45: Append-only audit of drug-allergy alert overrides during prescribing (CL-05/CL-06). Mirrored to GR audit via cl_allergy_alert_overridden event.
RLS: ✅ enabled (2 policies)
Foreign keys:
allergy_id→cl_allergies(id)chart_id→cl_patient_charts(id)organization_id→pf_organizations(id)overridden_by→pf_profiles(id)
cl_allergy_overrides_insert(INSERT)cl_allergy_overrides_select(SELECT)
cl_ambient_session_events
CL-36-EN-01: Append-only audit log for ambient session lifecycle events (start, stop, approve, reject, break-glass, etc.).
RLS: ✅ enabled (4 policies)
Foreign keys:
ambient_session_id→cl_ambient_sessions(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)
cl_ambient_session_events_delete(DELETE)cl_ambient_session_events_insert(INSERT)cl_ambient_session_events_select(SELECT)cl_ambient_session_events_update(UPDATE)
cl_ambient_sessions
CL-36-EN-01: Ambient audio capture sessions linked to encounters. Tracks recording lifecycle, processing status, and audio retention policy.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)consent_record_id→cl_consents(id)created_by→pf_profiles(id)encounter_id→pm_encounters(id)organization_id→pf_organizations(id)patient_id→pf_profiles(id)provider_id→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_ambient_sessions_delete(DELETE)cl_ambient_sessions_insert(INSERT)cl_ambient_sessions_select(SELECT)cl_ambient_sessions_update(UPDATE)
cl_ambient_transcripts
CL-36-EN-01: Immutable transcript records from ambient audio processing. Contains raw transcript, speaker diarization, and structured SOAP sections.
RLS: ✅ enabled (4 policies)
Foreign keys:
ambient_session_id→cl_ambient_sessions(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)
cl_ambient_transcripts_delete(DELETE)cl_ambient_transcripts_insert(INSERT)cl_ambient_transcripts_select(SELECT)cl_ambient_transcripts_update(UPDATE)
cl_assessment_instruments
CL-02: Configurable assessment instruments per organization. Defines scoring rules, age ranges, and reassessment frequency.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_assessment_instruments_delete(DELETE)cl_assessment_instruments_insert(INSERT)cl_assessment_instruments_select(SELECT)cl_assessment_instruments_update(UPDATE)
cl_assessment_sections
CL-02: Individual sections within an assessment (e.g., 18 AHCCCS elements). section_data stores the structured responses.
RLS: ✅ enabled (4 policies)
Foreign keys:
assessment_id→cl_assessments(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_assessment_sections_delete(DELETE)cl_assessment_sections_insert(INSERT)cl_assessment_sections_select(SELECT)cl_assessment_sections_update(UPDATE)
cl_assessment_template_sections
CL-02-EN-61: Sections within an assessment template
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→cl_assessment_templates(id)updated_by→pf_profiles(id)
cl_assessment_template_sections_delete(DELETE)cl_assessment_template_sections_insert(INSERT)cl_assessment_template_sections_select(SELECT)cl_assessment_template_sections_update(UPDATE)
cl_assessment_templates
CL-02-EN-61: Configurable assessment template definitions per organization
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_assessment_templates_delete(DELETE)cl_assessment_templates_insert(INSERT)cl_assessment_templates_select(SELECT)cl_assessment_templates_update(UPDATE)
cl_assessments
CL-02: Comprehensive clinical assessments. Supports 18-element AHCCCS, CALOCUS, ASAM, and other standardized instruments.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)clinician_id→pf_profiles(id)cod_assessment_id→cl_cod_assessments(id)cosigned_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)signed_by→pf_profiles(id)site_id→pf_sites(id)supersedes_id→cl_assessments(id)template_id→cl_assessment_templates(id)updated_by→pf_profiles(id)
cl_assessments_delete(DELETE)cl_assessments_insert(INSERT)cl_assessments_select(SELECT)cl_assessments_update(UPDATE)
cl_audit_dashboard_break_glass_reviews
CL-25: Append-only log of break-glass access reviews by compliance staff
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)reviewed_by→pf_profiles(id)
cl_audit_bg_reviews_insert(INSERT)cl_audit_bg_reviews_select(SELECT)
cl_between_session_checkins
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)organization_id, chart_id→cl_patient_charts(organization_id, id)
cl_between_session_checkins_clinician_select(SELECT)cl_between_session_checkins_portal_insert(INSERT)cl_between_session_checkins_portal_select(SELECT)
cl_biometrics
CL-22: Biometric measurements (height, weight, BMI, waist circumference)
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_biometrics_delete(DELETE)cl_biometrics_insert(INSERT)cl_biometrics_select(SELECT)cl_biometrics_update(UPDATE)
cl_care_gaps
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
cl_care_gaps_delete(DELETE)cl_care_gaps_insert(INSERT)cl_care_gaps_select(SELECT)cl_care_gaps_update(UPDATE)
cl_care_teams
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)provider_id→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)
cl_care_teams_delete(DELETE)cl_care_teams_insert(INSERT)cl_care_teams_select(SELECT)cl_care_teams_update(UPDATE)
cl_cda_documents
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)organization_id→pf_organizations(id)recipient_endpoint_id→cl_cda_transmission_endpoints(id)
cl_cda_documents_delete(DELETE)cl_cda_documents_insert(INSERT)cl_cda_documents_select(SELECT)cl_cda_documents_update(UPDATE)
cl_cda_transmission_endpoints
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
cl_cda_endpoints_delete(DELETE)cl_cda_endpoints_insert(INSERT)cl_cda_endpoints_select(SELECT)cl_cda_endpoints_update(UPDATE)
cl_cds_alerts
CL-08: CDS alerts. Append-only audit trail. PHI: contains clinical context.
RLS: ✅ enabled (3 policies)
Foreign keys:
acknowledged_by→pf_profiles(id)created_by→pf_profiles(id)rule_id→cl_cds_rules(id)site_id→pf_sites(id)updated_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)
cl_cds_alerts_insert(INSERT)cl_cds_alerts_select(SELECT)cl_cds_alerts_update(UPDATE)
cl_cds_rules
CL-08: Configurable clinical decision support rules. Soft-delete via deleted_at.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_cds_rules_delete(DELETE)cl_cds_rules_insert(INSERT)cl_cds_rules_select(SELECT)cl_cds_rules_update(UPDATE)
cl_clinical_standing_orders
CL-44: Cross-category standing order protocols (medication/lab/assessment/monitoring/nursing_action) executable by nursing staff within defined parameters.
RLS: ✅ enabled (4 policies)
Foreign keys:
approved_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_clinical_standing_orders_delete(DELETE)cl_clinical_standing_orders_insert(INSERT)cl_clinical_standing_orders_select(SELECT)cl_clinical_standing_orders_update(UPDATE)
cl_cod_assessments
CL-31: Integrated COD assessments (ASI-6, BASIS-32, GAIN-SS). SUD domain keys redacted at app layer per 42 CFR Part 2.
RLS: ✅ enabled (4 policies)
Foreign keys:
assessor_id→pf_profiles(id)chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cod_assessments_delete(DELETE)cod_assessments_insert(INSERT)cod_assessments_select(SELECT)cod_assessments_update(UPDATE)
cl_cod_treatment_plan_extension
CL-31: COD-specific extension to CL-03 treatment plans. ASAM level + dimensions 5/6 + optional MOUD link.
RLS: ✅ enabled (3 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)moud_episode_id→cl_moud_enrollments(id)organization_id→pf_organizations(id)treatment_plan_id→cl_treatment_plans(id)updated_by→pf_profiles(id)
cod_tp_ext_insert(INSERT)cod_tp_ext_select(SELECT)cod_tp_ext_update(UPDATE)
cl_concurrent_reviews
CL-43: Concurrent review submissions and outcomes for utilization management.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)organization_id→pf_organizations(id)
cl_concurrent_reviews_delete(DELETE)cl_concurrent_reviews_insert(INSERT)cl_concurrent_reviews_select(SELECT)cl_concurrent_reviews_update(UPDATE)
cl_consent_requests
CL-11 EN-35: Patient portal consent change requests (revocation, scope change, renewal). Reviewed by staff.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)consent_id→cl_consents(id)created_by→users(id)organization_id→pf_organizations(id)reviewed_by→users(id)updated_by→users(id)
cl_consent_requests_delete(DELETE)cl_consent_requests_insert(INSERT)cl_consent_requests_select(SELECT)cl_consent_requests_update(UPDATE)
cl_consents
CL-11: Patient consent records for 42 CFR Part 2, HIPAA, and organizational consent types. PHI.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)witnessed_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)
cl_consents_delete(DELETE)cl_consents_insert(INSERT)cl_consents_select(SELECT)cl_consents_update(UPDATE)
cl_controlled_substance_inventory
CL-06 EN-21: Tracks controlled substance transactions (receive, dispense, adjust, count, return, destroy) per 21 CFR 1304.
RLS: ✅ enabled (4 policies)
Foreign keys:
reference_prescription_id→cl_prescriptions(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)performed_by→users(id)site_id→pf_sites(id)updated_by→pf_profiles(id)witness_id→users(id)
cl_csi_delete(DELETE)cl_csi_insert(INSERT)cl_csi_select(SELECT)cl_csi_update(UPDATE)
cl_cron_run_log
CL-24+: per-day cron idempotency log. Used by cl-telehealth-consent-expiry-scan to prevent re-publish within 24h.
RLS: ✅ enabled
cl_data_exchange_log
CL-16: Immutable audit trail for all FHIR, C-CDA, HIE, and bulk data exchanges. Append-only — no UPDATE or DELETE.
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)
cl_data_exchange_log_insert(INSERT)cl_data_exchange_log_select(SELECT)
cl_ddi_alert_suppressions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)provider_id→users(id)updated_by→users(id)
cl_ddi_alert_suppressions_delete(DELETE)cl_ddi_alert_suppressions_insert(INSERT)cl_ddi_alert_suppressions_select(SELECT)cl_ddi_alert_suppressions_update(UPDATE)
cl_ddi_overrides
RLS: ✅ enabled (4 policies)
Foreign keys:
acknowledged_by→users(id)chart_id→cl_patient_charts(id)consent_id→cl_consents(id)cosigner_id→users(id)created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
cl_ddi_overrides_delete(DELETE)cl_ddi_overrides_insert(INSERT)cl_ddi_overrides_select(SELECT)cl_ddi_overrides_update(UPDATE)
cl_designated_contacts
CL-07 EN-25: Family/emergency contacts designated for risk notifications
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)consent_verified_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_designated_contacts_delete(DELETE)cl_designated_contacts_insert(INSERT)cl_designated_contacts_select(SELECT)cl_designated_contacts_update(UPDATE)
cl_diagnoses
CL-40: Patient diagnoses with ICD-10 codes, linked to patient charts
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)entered_by→pf_profiles(id)organization_id→pf_organizations(id)patient_id→pm_patients(id)updated_by→pf_profiles(id)
cl_diagnoses_delete(DELETE)cl_diagnoses_insert(INSERT)cl_diagnoses_select(SELECT)cl_diagnoses_update(UPDATE)
cl_discharge_checklists
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)updated_by→pf_profiles(id)waived_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)organization_id, transition_id→cl_transitions(organization_id, id)
cl_discharge_checklists_delete(DELETE)cl_discharge_checklists_insert(INSERT)cl_discharge_checklists_select(SELECT)cl_discharge_checklists_update(UPDATE)
cl_disclosure_log
CL-11: Append-only disclosure log for 42 CFR Part 2 accounting of disclosures. PHI.
RLS: ✅ enabled (4 policies)
Foreign keys:
consent_id→cl_consents(id)created_by→pf_profiles(id)disclosed_by→pf_profiles(id)organization_id→pf_organizations(id)organization_id, chart_id→cl_patient_charts(organization_id, id)
cl_disclosure_log_delete(DELETE)cl_disclosure_log_insert(INSERT)cl_disclosure_log_select(SELECT)cl_disclosure_log_update(UPDATE)
cl_dsi_disclosures
CL-65: §170.315(b)(11) DSI source-attribute disclosure registry. One published row per (org, model_id, model_version) gates AI clinical features (CL-36 note drafting). Org-scoped readable; publish/retire is org-admin-only; rows are append-versioned (retire, do not delete) for audit continuity.
RLS: ✅ enabled (5 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)published_by→pf_profiles(id)retired_by→pf_profiles(id)updated_by→pf_profiles(id)
cl_dsi_disclosures_delete(DELETE)cl_dsi_disclosures_insert(INSERT)cl_dsi_disclosures_public_read(SELECT)cl_dsi_disclosures_select(SELECT)cl_dsi_disclosures_update(UPDATE)
cl_electronic_consents
CL-11-EN-01: Signed electronic consent records with granular categories and e-signature data for 42 CFR Part 2 compliance
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_electronic_consents_delete(DELETE)cl_electronic_consents_insert(INSERT)cl_electronic_consents_select(SELECT)cl_electronic_consents_update(UPDATE)
cl_environmental_assessments
CL-07: Environmental risk assessments for inpatient/residential settings. Ligature resistance per Joint Commission NPSG.15.01.01.
RLS: ✅ enabled (4 policies)
Foreign keys:
assessed_by→pf_profiles(id)chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_environmental_assessments_delete(DELETE)cl_environmental_assessments_insert(INSERT)cl_environmental_assessments_select(SELECT)cl_environmental_assessments_update(UPDATE)
cl_family_notification_log
CL-07 EN-25: Audit log of family notification decisions and outcomes
RLS: ✅ enabled (2 policies)
Foreign keys:
chart_id→cl_patient_charts(id)contact_id→cl_designated_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)screening_id→cl_risk_screenings(id)updated_by→pf_profiles(id)
cl_family_notification_log_insert(INSERT)cl_family_notification_log_select(SELECT)
cl_fhir_resources
CL-16: Cached FHIR R4 resources mapped from internal clinical and patient data for interoperability.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_fhir_resources_delete(DELETE)cl_fhir_resources_insert(INSERT)cl_fhir_resources_select(SELECT)cl_fhir_resources_update(UPDATE)
cl_follow_up_contacts
CL-29: Post-discharge follow-up contacts (7-day, 30-day) feeding HEDIS FUH measures
RLS: ✅ enabled (4 policies)
Foreign keys:
aftercare_plan_id→cl_aftercare_plans(id)chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_follow_up_contacts_delete(DELETE)cl_follow_up_contacts_insert(INSERT)cl_follow_up_contacts_select(SELECT)cl_follow_up_contacts_update(UPDATE)
cl_group_attendance
CL-14: Per-patient attendance and individual documentation for group therapy sessions
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)session_id→cl_group_sessions(id)updated_by→pf_profiles(id)
cl_group_attendance_delete(DELETE)cl_group_attendance_insert(INSERT)cl_group_attendance_select(SELECT)cl_group_attendance_update(UPDATE)
cl_group_curricula
CL-14-ENHANCEMENTS (EN-39): Curriculum library for group therapy sessions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_group_curricula_delete(DELETE)cl_group_curricula_insert(INSERT)cl_group_curricula_select(SELECT)cl_group_curricula_update(UPDATE)
cl_group_encounter_generations
CL-14-EN-01: Tracks individual encounter generation from group session attendance for batch review and charge creation
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)group_session_id→cl_group_sessions(id)organization_id→pf_organizations(id)reviewed_by→pf_profiles(id)updated_by→pf_profiles(id)
cl_group_enc_gen_delete(DELETE)cl_group_enc_gen_insert(INSERT)cl_group_enc_gen_select(SELECT)cl_group_enc_gen_update(UPDATE)
cl_group_session_telehealth_metadata
CL-55: Telehealth metadata for virtual/hybrid group sessions. Stores PM-13 telehealth session UUID reference (no durable join URLs), contingency plan, recording state, technology failures, and backup site.
RLS: ✅ enabled (4 policies)
Foreign keys:
in_person_backup_site_id→pf_sites(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)session_id→cl_group_sessions(id)updated_by→pf_profiles(id)
cl_group_session_telehealth_metadata_delete(DELETE)cl_group_session_telehealth_metadata_insert(INSERT)cl_group_session_telehealth_metadata_select(SELECT)cl_group_session_telehealth_metadata_update(UPDATE)
cl_group_sessions
CL-14: Group therapy session records with facilitator, timing, and topic
RLS: ✅ enabled (4 policies)
Foreign keys:
co_facilitator_id→pf_profiles(id)created_by→pf_profiles(id)facilitator_id→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_group_sessions_delete(DELETE)cl_group_sessions_insert(INSERT)cl_group_sessions_select(SELECT)cl_group_sessions_update(UPDATE)
cl_inbasket_item_activity
CL-23: Append-only activity log for in-basket item lifecycle events. Exempt from custom_fields (audit/log table).
RLS: ✅ enabled (2 policies)
Foreign keys:
actor_id→pf_profiles(id)item_id→cl_inbasket_items(id)organization_id→pf_organizations(id)
cl_inbasket_activity_insert(INSERT)cl_inbasket_activity_select(SELECT)
cl_inbasket_items
CL-23: Unified clinical in-basket queue for provider action items (co-sign, lab review, refill, chart messages, CDS alerts, referral responses)
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_to→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)
cl_inbasket_items_delete(DELETE)cl_inbasket_items_insert(INSERT)cl_inbasket_items_select(SELECT)cl_inbasket_items_update(UPDATE)
cl_incidents
CL-15: AZDHS incident tracking with mandated reporting timeframes and immutability after reporting
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_incidents_delete(DELETE)cl_incidents_insert(INSERT)cl_incidents_select(SELECT)cl_incidents_update(UPDATE)
cl_intake_assessments
CL-40: Clinical intake assessments with AHCCCS 18-element compliance tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
appointment_id→pm_appointments(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)patient_id→pm_patients(id)sdoh_screening_id→cl_sdoh_screenings(id)updated_by→pf_profiles(id)
cl_intake_assessments_delete(DELETE)cl_intake_assessments_insert(INSERT)cl_intake_assessments_select(SELECT)cl_intake_assessments_update(UPDATE)
cl_lethal_means_assessments
RLS: ✅ enabled (4 policies)
Foreign keys:
assessed_by→pf_profiles(id)chart_id→cl_patient_charts(id)created_by→pf_profiles(id)encounter_id→pm_encounters(id)organization_id→pf_organizations(id)screening_id→cl_risk_screenings(id)updated_by→pf_profiles(id)
rls_cl_lethal_means_assessments_delete(DELETE)rls_cl_lethal_means_assessments_insert(INSERT)rls_cl_lethal_means_assessments_select(SELECT)rls_cl_lethal_means_assessments_update(UPDATE)
cl_loc_assessments
CL-49: ASAM/LOCUS level-of-care assessments. Chart-scoped; Part 2 gated when is_sud_related=true.
RLS: ✅ enabled (4 policies)
Foreign keys:
assessed_by→users(id)chart_id→cl_patient_charts(id)created_by→users(id)organization_id→pf_organizations(id)signed_by→users(id)site_id→pf_sites(id)supersedes_id→cl_loc_assessments(id)updated_by→users(id)
cl_loc_assessments_delete(DELETE)cl_loc_assessments_insert(INSERT)cl_loc_assessments_select(SELECT)cl_loc_assessments_update(UPDATE)
cl_loinc_codes
CL-09: LOINC code reference (public read-only, no org scoping). Subset for behavioral health labs.
RLS: ✅ enabled (1 policies)
Policies:
cl_loinc_codes_select_authenticated(SELECT)
cl_marketplace_bundle_items
CL-57: Items within a marketplace bundle. Each carries a typed payload that handlers materialize into per-org target tables.
RLS: ✅ enabled (4 policies)
Foreign keys:
bundle_id→cl_marketplace_bundles(id)
cl_marketplace_bundle_items_delete_curator(DELETE)cl_marketplace_bundle_items_insert_curator(INSERT)cl_marketplace_bundle_items_read_all(SELECT)cl_marketplace_bundle_items_update_curator(UPDATE)
cl_marketplace_bundles
CL-57: Platform-curated clinical content bundles. Global table (no org_id). RLS: SELECT for all authenticated; writes restricted to marketplace curators.
RLS: ✅ enabled (4 policies)
Foreign keys:
published_by→pf_profiles(id)
marketplace_bundles_delete_curator(DELETE)marketplace_bundles_insert_curator(INSERT)marketplace_bundles_read_all(SELECT)marketplace_bundles_update_curator(UPDATE)
cl_marketplace_imports
CL-57: Per-org marketplace bundle import history. Supports rollback via standardized snapshot envelope.
RLS: ✅ enabled (4 policies)
Foreign keys:
bundle_id→cl_marketplace_bundles(id)imported_by→pf_profiles(id)organization_id→pf_organizations(id)
cl_marketplace_imports_delete_org(DELETE)cl_marketplace_imports_insert_org(INSERT)cl_marketplace_imports_select_org(SELECT)cl_marketplace_imports_update_org(UPDATE)
cl_medication_adherence
CL-05 EN-17: Medication adherence records for PDC calculation and peer support tracking.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)medication_id→cl_medications(id)organization_id→pf_organizations(id)sdoh_screening_id→cl_sdoh_screenings(id)updated_by→pf_profiles(id)
cl_medication_adherence_delete(DELETE)cl_medication_adherence_insert(INSERT)cl_medication_adherence_select(SELECT)cl_medication_adherence_update(UPDATE)
cl_medication_education
CL-05 EN-19: Medication education records with cultural responsiveness fields.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)educated_by→pf_profiles(id)medication_id→cl_medications(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_medication_education_delete(DELETE)cl_medication_education_insert(INSERT)cl_medication_education_select(SELECT)cl_medication_education_update(UPDATE)
cl_medication_reconciliations
CL-05: Medication reconciliation records for transitions of care (admission, transfer, discharge, routine).
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)reconciled_by→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_med_recon_delete(DELETE)cl_med_recon_insert(INSERT)cl_med_recon_select(SELECT)cl_med_recon_update(UPDATE)
cl_medications
CL-05: Patient medication list; soft-delete via deleted_at; controlled substances require DEA audit trail.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)discontinued_by→pf_profiles(id)organization_id→pf_organizations(id)prescribed_by→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_medications_delete(DELETE)cl_medications_insert(INSERT)cl_medications_select(SELECT)cl_medications_update(UPDATE)
cl_metabolic_monitoring_events
CL-22: Metabolic monitoring events for antipsychotic/MAT regimens
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_metabolic_monitoring_events_delete(DELETE)cl_metabolic_monitoring_events_insert(INSERT)cl_metabolic_monitoring_events_select(SELECT)cl_metabolic_monitoring_events_update(UPDATE)
cl_module_settings
CL-01: Per-organization clinical module configuration. One row per org.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_module_settings_delete(DELETE)cl_module_settings_insert(INSERT)cl_module_settings_select(SELECT)cl_module_settings_update(UPDATE)
cl_moud_enrollments
CL-21: MAT/MOUD enrollment and treatment phase tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)consent_id→cl_consents(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_moud_enrollments_delete(DELETE)cl_moud_enrollments_insert(INSERT)cl_moud_enrollments_select(SELECT)cl_moud_enrollments_update(UPDATE)
cl_moud_medication_events
CL-21: MOUD medication events (ordered, prescribed, administered, dispensed, held, missed)
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)enrollment_id→cl_moud_enrollments(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_moud_medication_events_delete(DELETE)cl_moud_medication_events_insert(INSERT)cl_moud_medication_events_select(SELECT)cl_moud_medication_events_update(UPDATE)
cl_moud_monitoring_events
CL-21: Monitoring protocol events (UDS, hepatic, etc.) with due and completion
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)enrollment_id→cl_moud_enrollments(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_moud_monitoring_events_delete(DELETE)cl_moud_monitoring_events_insert(INSERT)cl_moud_monitoring_events_select(SELECT)cl_moud_monitoring_events_update(UPDATE)
cl_multi_party_encounters
CL-55: Non-group multi-party encounters (mobile crisis, family therapy, interpreter-assisted, care team meetings).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)primary_chart_id→cl_patient_charts(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_multi_party_encounters_delete(DELETE)cl_multi_party_encounters_insert(INSERT)cl_multi_party_encounters_select(SELECT)cl_multi_party_encounters_update(UPDATE)
cl_multi_party_participants
CL-55: Participants in multi-party encounters with role attribution and per-participant recording consent.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)encounter_id→cl_multi_party_encounters(id)organization_id→pf_organizations(id)staff_user_id→pf_profiles(id)updated_by→pf_profiles(id)
cl_multi_party_participants_delete(DELETE)cl_multi_party_participants_insert(INSERT)cl_multi_party_participants_select(SELECT)cl_multi_party_participants_update(UPDATE)
cl_note_940_override_audit
CL-04-EN-66: INSERT-only audit log for Policy 940 validation overrides. No UPDATE or DELETE permitted. Retention: minimum 6 years per HIPAA 45 CFR 164.316(b)(2)(i).
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→users(id)note_id→cl_progress_notes(id)organization_id→pf_organizations(id)override_by→users(id)
cl_note_940_audit_insert_org(INSERT)cl_note_940_audit_select_org(SELECT)
cl_note_templates
CL-04: Service-line note templates (outpatient, residential, iop_php).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_note_templates_delete(DELETE)cl_note_templates_insert(INSERT)cl_note_templates_select(SELECT)cl_note_templates_update(UPDATE)
cl_note_treatment_goals
CL-04: Junction between progress notes and treatment plan goals.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)note_id→cl_progress_notes(id)organization_id→pf_organizations(id)treatment_goal_id→cl_treatment_goals(id)
cl_note_treatment_goals_delete(DELETE)cl_note_treatment_goals_insert(INSERT)cl_note_treatment_goals_select(SELECT)cl_note_treatment_goals_update(UPDATE)
cl_notification_delivery_attempts
CL-56: Per-alert delivery attempt log (dispatch, retry, escalation, acknowledge, error). PHI prohibited in metadata/error_message.
RLS: ✅ enabled (2 policies)
Foreign keys:
event_id→cl_notification_events(id)organization_id→pf_organizations(id)recipient_user_id→pf_profiles(id)
cl_notif_attempts_insert(INSERT)cl_notif_attempts_select(SELECT)
cl_notification_escalation_chains
CL-56: Ordered escalation steps per severity tier; recipient_role_key + delay_seconds.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_notification_escalation_chains_delete(DELETE)cl_notification_escalation_chains_insert(INSERT)cl_notification_escalation_chains_select(SELECT)cl_notification_escalation_chains_update(UPDATE)
cl_notification_events
CL-56: Append-only fact table of dispatched clinical notifications with ack/escalation/SLA tracking. PHI prohibited in payload (chk_cl_notification_no_phi).
RLS: ✅ enabled (3 policies)
Foreign keys:
acknowledged_by→pf_profiles(id)organization_id→pf_organizations(id)policy_id→cl_notification_policies(id)recipient_user_id→pf_profiles(id)
cl_notification_events_delete(DELETE)cl_notification_events_insert(INSERT)cl_notification_events_select(SELECT)
cl_notification_policies
CL-56: Per-organization rules mapping clinical signal types to severity, SLA, and dedup window.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_notification_policies_delete(DELETE)cl_notification_policies_insert(INSERT)cl_notification_policies_select(SELECT)cl_notification_policies_update(UPDATE)
cl_order_results
CL-09: Individual result values for lab/diagnostic orders
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)reviewed_by→pf_profiles(id)updated_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)organization_id, order_id→cl_orders(organization_id, id)
cl_order_results_delete(DELETE)cl_order_results_insert(INSERT)cl_order_results_select(SELECT)cl_order_results_update(UPDATE)
cl_order_set_activations
CL-44: Per-patient activation log of an order set template; created orders captured in created_orders JSONB.
RLS: ✅ enabled (2 policies)
Foreign keys:
activated_by→pf_profiles(id)chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→cl_order_set_templates(id)updated_by→pf_profiles(id)
cl_order_set_activations_insert(INSERT)cl_order_set_activations_select(SELECT)
cl_order_set_templates
CL-44: Order set template definitions (medications + labs + assessments + monitoring) with versioning and approval workflow.
RLS: ✅ enabled (4 policies)
Foreign keys:
approved_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)parent_version_id→cl_order_set_templates(id)updated_by→pf_profiles(id)
cl_order_set_templates_delete(DELETE)cl_order_set_templates_insert(INSERT)cl_order_set_templates_select(SELECT)cl_order_set_templates_update(UPDATE)
cl_order_templates
CL-09: Reusable order templates (e.g., CMP panel, UDS panel)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_order_templates_delete(DELETE)cl_order_templates_insert(INSERT)cl_order_templates_select(SELECT)cl_order_templates_update(UPDATE)
cl_orders
CL-09: Lab and diagnostic orders linked to patient charts
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)loinc_code→cl_loinc_codes(loinc_code)ordering_provider_id→pf_profiles(id)organization_id→pf_organizations(id)reference_lab_id→cl_reference_labs(id)site_id→pf_sites(id)updated_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)
cl_orders_delete(DELETE)cl_orders_insert(INSERT)cl_orders_select(SELECT)cl_orders_update(UPDATE)
cl_outcome_measures
CL-10: Patient-reported outcome measures (PROMs). One row per instrument administration per patient chart.
RLS: ✅ enabled (4 policies)
Foreign keys:
administered_by→pf_profiles(id)chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_outcome_measures_delete(DELETE)cl_outcome_measures_insert(INSERT)cl_outcome_measures_select(SELECT)cl_outcome_measures_update(UPDATE)
cl_pathway_definitions
CL-08 EN-28: Clinical pathway templates
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_pathway_definitions_delete(DELETE)cl_pathway_definitions_insert(INSERT)cl_pathway_definitions_select(SELECT)cl_pathway_definitions_update(UPDATE)
cl_pathway_milestones
RLS: ✅ enabled (4 policies)
Foreign keys:
completed_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)patient_pathway_id→cl_patient_pathways(id)updated_by→pf_profiles(id)
cl_pathway_milestones_delete(DELETE)cl_pathway_milestones_insert(INSERT)cl_pathway_milestones_select(SELECT)cl_pathway_milestones_update(UPDATE)
cl_pathway_progress
CL-08 EN-28: Patient progress through pathways
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)pathway_id→cl_pathway_definitions(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_pathway_progress_delete(DELETE)cl_pathway_progress_insert(INSERT)cl_pathway_progress_select(SELECT)cl_pathway_progress_update(UPDATE)
cl_pathway_templates
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)parent_template_id→cl_pathway_templates(id)updated_by→pf_profiles(id)
cl_pathway_templates_delete(DELETE)cl_pathway_templates_insert(INSERT)cl_pathway_templates_select(SELECT)cl_pathway_templates_update(UPDATE)
cl_pathway_variances
RLS: ✅ enabled (4 policies)
Foreign keys:
documented_by→pf_profiles(id)milestone_id→cl_pathway_milestones(id)organization_id→pf_organizations(id)patient_pathway_id→cl_patient_pathways(id)updated_by→pf_profiles(id)
cl_pathway_variances_delete(DELETE)cl_pathway_variances_insert(INSERT)cl_pathway_variances_select(SELECT)cl_pathway_variances_update(UPDATE)
cl_patient_charts
CL-01: Patient clinical chart shell. One chart per patient per organization.
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_clinician_id→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)patient_id→pf_patient_identities(id)primary_site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_patient_charts_delete(DELETE)cl_patient_charts_insert(INSERT)cl_patient_charts_select(SELECT)cl_patient_charts_update(UPDATE)
cl_patient_cohort_definitions
CL-54: Immutable, append-only definition history per cohort. Each new edit creates a new version row; prior versions are frozen for snapshot reproducibility.
RLS: ✅ enabled (2 policies)
Foreign keys:
cohort_id→cl_patient_cohorts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)
cl_patient_cohort_definitions_insert(INSERT)cl_patient_cohort_definitions_select(SELECT)
cl_patient_cohort_memberships
CL-54: Append-only snapshot table. One row per (cohort, version, chart, as_of_date). Idempotent: recompute for the same key tuple is a no-op.
RLS: ✅ enabled (3 policies)
Foreign keys:
chart_id→cl_patient_charts(id)cohort_id→cl_patient_cohorts(id)organization_id→pf_organizations(id)
cl_patient_cohort_memberships_delete(DELETE)cl_patient_cohort_memberships_insert(INSERT)cl_patient_cohort_memberships_select(SELECT)
cl_patient_cohorts
CL-54: Patient cohort registry. Each cohort is a versioned, named patient population definition (manual, rule-based, or query-based) used for HEDIS reporting, VBP attribution, and outreach campaigns.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_patient_cohorts_delete(DELETE)cl_patient_cohorts_insert(INSERT)cl_patient_cohorts_select(SELECT)cl_patient_cohorts_update(UPDATE)
cl_patient_pathways
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)enrolled_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→cl_pathway_templates(id)updated_by→pf_profiles(id)
cl_patient_pathways_delete(DELETE)cl_patient_pathways_insert(INSERT)cl_patient_pathways_select(SELECT)cl_patient_pathways_update(UPDATE)
cl_patient_submissions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)reviewed_by→pf_profiles(id)updated_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)
cl_patient_submissions_clinician_select(SELECT)cl_patient_submissions_clinician_update(UPDATE)cl_patient_submissions_portal_insert(INSERT)cl_patient_submissions_portal_select(SELECT)
cl_pdmp_configuration
CL-17: Org-level PDMP gateway configuration. One row per organization.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_pdmp_configuration_delete(DELETE)cl_pdmp_configuration_insert(INSERT)cl_pdmp_configuration_select(SELECT)cl_pdmp_configuration_update(UPDATE)
cl_pdmp_queries
CL-17: PDMP query audit trail per A.R.S. § 36-2606. Immutable — no soft delete. PHI table.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)prescription_id→cl_prescriptions(id)queried_by→pf_profiles(id)queried_on_behalf_of→pf_profiles(id)results_reviewed_by→pf_profiles(id)updated_by→pf_profiles(id)
cl_pdmp_queries_delete(DELETE)cl_pdmp_queries_insert(INSERT)cl_pdmp_queries_select(SELECT)cl_pdmp_queries_update(UPDATE)
cl_peer_encounters
CL-40: Peer recovery support encounter documentation linked to PM encounters
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)encounter_id→pm_encounters(id)organization_id→pf_organizations(id)patient_id→pm_patients(id)updated_by→pf_profiles(id)
cl_peer_encounters_delete(DELETE)cl_peer_encounters_insert(INSERT)cl_peer_encounters_select(SELECT)cl_peer_encounters_update(UPDATE)
cl_pending_lab_results
CL-09 Phase 2: Staging table for unsolicited lab results pending clinical review and linking
RLS: ✅ enabled (5 policies)
Foreign keys:
created_by→pf_profiles(id)lab_id→cl_reference_labs(id)linked_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)organization_id, linked_chart_id→cl_patient_charts(organization_id, id)organization_id, linked_order_id→cl_orders(organization_id, id)
cl_pending_lab_results_delete(DELETE)cl_pending_lab_results_delete_org(DELETE)cl_pending_lab_results_insert(INSERT)cl_pending_lab_results_select(SELECT)cl_pending_lab_results_update(UPDATE)
cl_pharmacies
RLS: ✅ enabled (4 policies)
Policies:
cl_pharmacies_delete(DELETE)cl_pharmacies_insert(INSERT)cl_pharmacies_select(SELECT)cl_pharmacies_update(UPDATE)
cl_prescriptions
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)medication_id→cl_medications(id)pharmacy_id→cl_pharmacies(id)site_id→pf_sites(id)
cl_prescriptions_delete(DELETE)cl_prescriptions_insert(INSERT)cl_prescriptions_select(SELECT)cl_prescriptions_update(UPDATE)
cl_problem_history
CL-46: Append-only audit trail for cl_problems status transitions.
RLS: ✅ enabled (1 policies)
Foreign keys:
changed_by→pf_profiles(id)organization_id→pf_organizations(id)problem_id→cl_problems(id)
cl_problem_history_select(SELECT)
cl_problem_status_history
RLS: ✅ enabled (1 policies)
Foreign keys:
organization_id→pf_organizations(id)problem_id→cl_problems(id)
cl_problem_status_history_select(SELECT)
cl_problems
CL-01: Patient problem list entries. Supports ICD-10 coding and clinical status tracking.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)managing_provider_id→pf_profiles(id)organization_id→pf_organizations(id)patient_id→pf_patient_identities(id)recorded_by→pf_profiles(id)updated_by→pf_profiles(id)
cl_problems_delete(DELETE)cl_problems_insert_v2(INSERT)cl_problems_select_v2(SELECT)cl_problems_update_v2(UPDATE)
cl_program_attendance_summaries
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)program_enrollment_id→cl_program_enrollments(id)updated_by→pf_profiles(id)
cl_program_attendance_summaries_delete(DELETE)cl_program_attendance_summaries_insert(INSERT)cl_program_attendance_summaries_select(SELECT)cl_program_attendance_summaries_update(UPDATE)
cl_program_enrollments
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)program_schedule_id→cl_program_schedules(id)updated_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)
cl_program_enrollments_delete(DELETE)cl_program_enrollments_insert(INSERT)cl_program_enrollments_select(SELECT)cl_program_enrollments_update(UPDATE)
cl_program_outcomes
CL-10: Program-level aggregated outcomes (HEDIS, dashboards).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)program_id→rh_programs(id)updated_by→pf_profiles(id)
cl_program_outcomes_delete(DELETE)cl_program_outcomes_insert(INSERT)cl_program_outcomes_select(SELECT)cl_program_outcomes_update(UPDATE)
cl_program_schedules
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_program_schedules_delete(DELETE)cl_program_schedules_insert(INSERT)cl_program_schedules_select(SELECT)cl_program_schedules_update(UPDATE)
cl_progress_notes
CL-04: Progress notes per AHCCCS Policy 940; soft-delete via deleted_at.
RLS: ✅ enabled (4 policies)
Foreign keys:
amended_from→cl_progress_notes(id)chart_id→cl_patient_charts(id)cosigned_by→pf_profiles(id)created_by→pf_profiles(id)note_940_override_by→users(id)organization_id→pf_organizations(id)signed_by→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_progress_notes_delete(DELETE)cl_progress_notes_insert(INSERT)cl_progress_notes_select(SELECT)cl_progress_notes_update(UPDATE)
cl_quality_measure_periods
CL-35: HEDIS and MA STARS quality measure period calculations
RLS: ✅ enabled (8 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
cl_qmp_delete(DELETE)cl_qmp_insert(INSERT)cl_qmp_select(SELECT)cl_qmp_update(UPDATE)cl_quality_measure_periods_insert(INSERT)cl_quality_measure_periods_no_delete(DELETE)cl_quality_measure_periods_select(SELECT)cl_quality_measure_periods_update(UPDATE)
cl_readmission_risk_scores
CL-29: Readmission risk assessments (0-100 scale) with configurable risk factors
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_readmission_risk_scores_delete(DELETE)cl_readmission_risk_scores_insert(INSERT)cl_readmission_risk_scores_select(SELECT)cl_readmission_risk_scores_update(UPDATE)
cl_redisclosure_log
CL-11-EN-01: Immutable append-only audit trail for 42 CFR Part 2 record disclosures. UPDATE/DELETE denied for all application roles.
RLS: ✅ enabled (2 policies)
Foreign keys:
consent_id→cl_electronic_consents(id)disclosed_by→pf_profiles(id)organization_id→pf_organizations(id)
cl_redisclosure_log_insert(INSERT)cl_redisclosure_log_select(SELECT)
cl_reference_labs
CL-09: Reference laboratory directory with integration configuration
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_reference_labs_delete(DELETE)cl_reference_labs_insert(INSERT)cl_reference_labs_select(SELECT)cl_reference_labs_update(UPDATE)
cl_reference_ranges
CL-09 EN-32: Organization-specific reference ranges for lab result interpretation
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
cl_reference_ranges_delete(DELETE)cl_reference_ranges_insert(INSERT)cl_reference_ranges_select(SELECT)cl_reference_ranges_update(UPDATE)
cl_referral_status_history
CL-12-EN-67: Append-only referral status history for closed-loop tracking
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)
cl_referral_status_history_delete(DELETE)cl_referral_status_history_insert(INSERT)cl_referral_status_history_select(SELECT)
cl_report_definitions
CL-15: Configurable clinical compliance report definitions (Joint Commission, CARF, HEDIS, AHCCCS, AZDHS, custom)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_report_definitions_delete(DELETE)cl_report_definitions_insert(INSERT)cl_report_definitions_select(SELECT)cl_report_definitions_update(UPDATE)
cl_report_runs
CL-15: Execution log for report generation runs; tracks status, parameters, and output document reference
RLS: ✅ enabled (4 policies)
Foreign keys:
generated_by→pf_profiles(id)organization_id→pf_organizations(id)report_definition_id→cl_report_definitions(id)
cl_report_runs_delete(DELETE)cl_report_runs_insert(INSERT)cl_report_runs_select(SELECT)cl_report_runs_update(UPDATE)
cl_review_appeals
CL-43: Tracks appeals filed against denied concurrent reviews.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)review_id→cl_concurrent_reviews(id)
cl_review_appeals_delete(DELETE)cl_review_appeals_insert(INSERT)cl_review_appeals_select(SELECT)cl_review_appeals_update(UPDATE)
cl_review_schedules
CL-43: Payer-specific concurrent review interval configuration.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
cl_review_schedules_delete(DELETE)cl_review_schedules_insert(INSERT)cl_review_schedules_select(SELECT)cl_review_schedules_update(UPDATE)
cl_risk_screenings
CL-07: Suicide risk screening records. Instruments: C-SSRS, PHQ-9 Item 9, ASQ, SAFE-T. SAFE-T score column is NULL by design (non-numeric instrument; FR-1.6).
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)screened_by→pf_profiles(id)updated_by→pf_profiles(id)
cl_risk_screenings_delete(DELETE)cl_risk_screenings_insert(INSERT)cl_risk_screenings_select(SELECT)cl_risk_screenings_update(UPDATE)
cl_risk_stratifications
CL-35: Patient risk stratification scores computed by the population health engine
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
cl_risk_strat_delete(DELETE)cl_risk_strat_insert(INSERT)cl_risk_strat_select(SELECT)cl_risk_strat_update(UPDATE)
cl_safety_plan_shares
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)safety_plan_id→cl_safety_plans(id)shared_by→pf_profiles(id)updated_by→pf_profiles(id)
rls_cl_safety_plan_shares_delete(DELETE)rls_cl_safety_plan_shares_insert(INSERT)rls_cl_safety_plan_shares_select(SELECT)rls_cl_safety_plan_shares_update(UPDATE)
cl_safety_plans
CL-07: Stanley-Brown safety plans with 6 components. Patient/clinician signatures via SignatureCanvas (Pattern A — Errata E-6). Versioning via superseded_by + status.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)clinician_id→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)superseded_by→cl_safety_plans(id)updated_by→pf_profiles(id)
cl_safety_plans_delete(DELETE)cl_safety_plans_insert(INSERT)cl_safety_plans_select(SELECT)cl_safety_plans_update(UPDATE)
cl_screening_administrations
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
cl_screening_admin_delete(DELETE)cl_screening_admin_insert(INSERT)cl_screening_admin_select(SELECT)cl_screening_admin_update(UPDATE)
cl_sdoh_screenings
CL-18: SDOH screening records (PRAPARE, AHC-HRSN, etc.) linked to patient charts
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)screened_by→pf_profiles(id)updated_by→pf_profiles(id)
cl_sdoh_screenings_delete(DELETE)cl_sdoh_screenings_insert(INSERT)cl_sdoh_screenings_select(SELECT)cl_sdoh_screenings_update(UPDATE)
cl_social_referrals
CL-18: Community resource referrals for identified social needs
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)referred_by→pf_profiles(id)screening_id→cl_sdoh_screenings(id)updated_by→pf_profiles(id)
cl_social_referrals_delete(DELETE)cl_social_referrals_insert(INSERT)cl_social_referrals_select(SELECT)cl_social_referrals_update(UPDATE)
cl_standing_order_executions
CL-44: Append-only nursing execution log for standing order protocols. UPDATE/DELETE forbidden via restrictive RLS.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)executed_by→pf_profiles(id)organization_id→pf_organizations(id)standing_order_id→cl_clinical_standing_orders(id)
cl_standing_order_executions_insert(INSERT)cl_standing_order_executions_no_delete(DELETE)cl_standing_order_executions_no_update(UPDATE)cl_standing_order_executions_select(SELECT)
cl_standing_order_protocols
CL-09 EN-30: Standing order protocols for automated/recurring lab orders
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→users(id)
cl_standing_order_protocols_delete(DELETE)cl_standing_order_protocols_insert(INSERT)cl_standing_order_protocols_select(SELECT)cl_standing_order_protocols_update(UPDATE)
cl_tefca_exchange_log
CL-16-EN-01: Append-only audit log tracking inbound and outbound TEFCA/QHIN exchange attempts and outcomes
RLS: ✅ enabled (4 policies)
Foreign keys:
consent_id→cl_consents(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_tefca_exchange_log_insert(INSERT)cl_tefca_exchange_log_select(SELECT)cl_tefca_exchange_log_service(ALL)cl_tefca_exchange_log_update(UPDATE)
cl_telehealth_consents
CL-24: Per-patient telehealth consent with annual renewal. Immutable for audit; no deleted_at. Revoke is append-only for non-admins via trigger.
RLS: ✅ enabled (4 policies)
Foreign keys:
captured_by→pf_profiles(id)chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_telehealth_consents_delete(DELETE)cl_telehealth_consents_insert(INSERT)cl_telehealth_consents_select(SELECT)cl_telehealth_consents_update(UPDATE)
cl_telehealth_sessions
CL-24: Clinical compliance wrapper around a PM-13 telehealth session. Holds safety checklist, jurisdictional state, connectivity log. Immutable for audit; no deleted_at.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)progress_note_id→cl_progress_notes(id)updated_by→pf_profiles(id)
cl_telehealth_sessions_delete(DELETE)cl_telehealth_sessions_insert(INSERT)cl_telehealth_sessions_select(SELECT)cl_telehealth_sessions_update(UPDATE)
cl_transitions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)organization_id, chart_id→cl_patient_charts(organization_id, id)organization_id, medication_reconciliation_id→cl_medication_reconciliations(organization_id, id)
cl_transitions_delete(DELETE)cl_transitions_insert(INSERT)cl_transitions_select(SELECT)cl_transitions_update(UPDATE)
cl_treatment_goal_bank
CL-03 Phase 3: Pre-built goal entries associated with treatment plan templates
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→cl_treatment_plan_templates(id)updated_by→pf_profiles(id)
cl_treatment_goal_bank_delete(DELETE)cl_treatment_goal_bank_insert(INSERT)cl_treatment_goal_bank_select(SELECT)cl_treatment_goal_bank_update(UPDATE)
cl_treatment_goals
CL-03: Treatment goals in patient words per AHCCCS Person-Centered Planning.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)plan_id→cl_treatment_plans(id)problem_id→cl_problems(id)updated_by→pf_profiles(id)
cl_treatment_goals_delete(DELETE)cl_treatment_goals_insert(INSERT)cl_treatment_goals_select(SELECT)cl_treatment_goals_update(UPDATE)
cl_treatment_interventions
CL-03: Specific interventions linked to treatment goals.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)goal_id→cl_treatment_goals(id)organization_id→pf_organizations(id)responsible_provider_id→pf_profiles(id)updated_by→pf_profiles(id)
cl_treatment_interventions_delete(DELETE)cl_treatment_interventions_insert(INSERT)cl_treatment_interventions_select(SELECT)cl_treatment_interventions_update(UPDATE)
cl_treatment_plan_signatures
CL-03: Immutable multi-disciplinary sign-off records.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)signer_id→pf_profiles(id)treatment_plan_id→cl_treatment_plans(id)updated_by→pf_profiles(id)
cl_treatment_plan_signatures_delete(DELETE)cl_treatment_plan_signatures_insert(INSERT)cl_treatment_plan_signatures_select(SELECT)cl_treatment_plan_signatures_update(UPDATE)
cl_treatment_plan_templates
CL-03 Phase 3: Pre-built treatment plan templates by service line/diagnosis with goal banks
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
cl_treatment_plan_templates_delete(DELETE)cl_treatment_plan_templates_insert(INSERT)cl_treatment_plan_templates_select(SELECT)cl_treatment_plan_templates_update(UPDATE)
cl_treatment_plans
CL-03: Treatment plans with AHCCCS review frequency auto-calculation.
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)clinician_signed_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)previous_plan_id→cl_treatment_plans(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_treatment_plans_delete(DELETE)cl_treatment_plans_insert(INSERT)cl_treatment_plans_select(SELECT)cl_treatment_plans_update(UPDATE)
cl_uds_interpretation_notes
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→users(id)encounter_id→pm_encounters(id)organization_id→pf_organizations(id)uds_order_id→cl_uds_orders(id)updated_by→users(id)
cl_uds_interp_delete(DELETE)cl_uds_interp_insert(INSERT)cl_uds_interp_select(SELECT)cl_uds_interp_update(UPDATE)
cl_uds_orders
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)cl_order_id→cl_orders(id)collector_id→users(id)created_by→users(id)encounter_id→pm_encounters(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→users(id)
cl_uds_orders_delete(DELETE)cl_uds_orders_insert(INSERT)cl_uds_orders_select(SELECT)cl_uds_orders_update(UPDATE)
cl_uds_results
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→users(id)organization_id→pf_organizations(id)uds_order_id→cl_uds_orders(id)updated_by→users(id)
cl_uds_results_delete(DELETE)cl_uds_results_insert(INSERT)cl_uds_results_select(SELECT)cl_uds_results_update(UPDATE)
cl_user_icd10_favorites
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)user_id→users(id)
cl_user_icd10_favorites_delete(DELETE)cl_user_icd10_favorites_insert(INSERT)cl_user_icd10_favorites_select(SELECT)cl_user_icd10_favorites_update(UPDATE)
cl_vital_signs
CL-22: Vital signs measurements (BP, HR, RR, temp, SpO2, pain)
RLS: ✅ enabled (4 policies)
Foreign keys:
chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_vital_signs_delete(DELETE)cl_vital_signs_insert(INSERT)cl_vital_signs_select(SELECT)cl_vital_signs_update(UPDATE)
cl_warm_handoffs
CL-29: Provider-to-provider warm handoff documentation with caller/receiver tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
caller_id→pf_profiles(id)chart_id→cl_patient_charts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)receiver_id→pf_profiles(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
cl_warm_handoffs_delete(DELETE)cl_warm_handoffs_insert(INSERT)cl_warm_handoffs_select(SELECT)cl_warm_handoffs_update(UPDATE)
cl_weno_directory_ingest_runs
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
cl_weno_directory_ingest_runs_delete(DELETE)cl_weno_directory_ingest_runs_insert(INSERT)cl_weno_directory_ingest_runs_select(SELECT)cl_weno_directory_ingest_runs_update(UPDATE)
cl_weno_launch_attempts
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)user_id→users(id)
cl_weno_launch_attempts_delete(DELETE)cl_weno_launch_attempts_insert(INSERT)cl_weno_launch_attempts_select(SELECT)cl_weno_launch_attempts_update(UPDATE)
cl_weno_newrx_sync_runs
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
cl_weno_newrx_sync_runs_delete(DELETE)cl_weno_newrx_sync_runs_insert(INSERT)cl_weno_newrx_sync_runs_select(SELECT)cl_weno_newrx_sync_runs_update(UPDATE)