> ## 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.

# Population Health & Care Gap Management — Integration Documentation

> Spec: specs/cl/specs/CL-35-population-health-care-gap-management.md Status: Phase 2/3 ✅ Complete (2026-04-01) — Phase 2 schema parity gap closed 2026-05-11: cl…

**Spec:** `specs/cl/specs/CL-35-population-health-care-gap-management.md`
**Status:** Phase 2/3 ✅ Complete (2026-04-01) — Phase 2 schema parity gap closed 2026-05-11: `closure_type` + `risk_score_at_identification` deployed on `cl_care_gaps`; 4 `pop_health_*` settings columns deployed on `cl_module_settings`; UI wired (CloseGapDialog Select, GapDetailSheet display incl. system auto-close branch); RLS test stubs and `deriveCareGapCloseStatus` unit tests added.
**Last Updated:** 2026-05-11

***

## Integration Overview

CL-35 is a **consumer** of existing CL data sources (CL-02, CL-03, CL-07, CL-10, CL-15, CL-22, CL-26, CL-29) and a **producer** of new population health data (risk scores, care gaps, quality measure periods). It integrates cross-core with FA (Finance) via event contract for VBP payment adjustment and with FW (Workflow) via care gap closure events.

***

## Platform Foundation Dependencies

| PF Dependency                 | Integration Type  | Usage                                                                                                                                                                                                                                                                  |
| ----------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| PF-01 (Organizations & Sites) | Direct dependency | `organization_id` tenant isolation on all CL-35 tables                                                                                                                                                                                                                 |
| PF-02 (RBAC)                  | Direct dependency | Role-based access to work list, dashboards, measure views                                                                                                                                                                                                              |
| PF-30 (Permissions)           | Direct dependency | 6 permission keys (`cl.care-gaps.view/close`, `cl.risk-stratifications.view`, `cl.quality-measures.view/export`, `cl.population-dashboard.view`) — see [CL-35 spec § Security Considerations](../../../specs/cl/specs/CL-35-population-health-care-gap-management.md). |

***

## CL-Internal Data Sources (Read-Only)

| Source Spec                   | Data Read                                  | Tables/Entities                                                                 | Usage in CL-35                                                               |
| ----------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| CL-02 (Assessments)           | Assessment dates and types                 | `cl_assessments`                                                                | Gap rule: `assessment_expired`                                               |
| CL-03 (Treatment Planning)    | Plan last review date                      | `cl_treatment_plans`                                                            | Gap rule: `plan_not_reviewed`                                                |
| CL-07 (Risk Screening)        | Safety screening scores, PHQ-9/GAD-7 dates | `cl_risk_screenings`                                                            | Risk stratification (40% weight); gap rules: `overdue_phq9`, `overdue_gad7`  |
| CL-10 (Outcomes)              | Outcome trajectory data                    | `cl_outcome_measures`, `cl_program_outcomes`                                    | Risk stratification (30% weight); HEDIS numerator data                       |
| CL-15 (Quality Measures)      | Quality measure reporting                  | — (consumer of `cl_quality_measure_periods`)                                    | CL-35 computes HEDIS period results; CL-15 consumes for reporting dashboards |
| CL-21 (MOUD/OTP)              | MOUD adherence data                        | `cl_moud_enrollments`, `cl_moud_medication_events`, `cl_moud_monitoring_events` | Risk stratification (10% weight, optional; gated on 42 CFR Part 2 consent)   |
| CL-22 (Vital Signs)           | Metabolic data                             | `cl_vital_signs`                                                                | Risk stratification (20% weight)                                             |
| CL-26 (PROs)                  | PRO submission dates                       | — (CL-26 PRO tables not yet deployed; integration deferred)                     | Gap rule: overdue PRO completion (planned)                                   |
| CL-29 (Discharge & Aftercare) | Follow-up scheduling, discharge events     | `pm_encounters` (via `@/platform/scheduling`)                                   | Gap rule: `follow_up_not_scheduled`; HEDIS FUH/FUM                           |

***

## Event Contracts

### Events Published

**1. `cl_quality_measure_period_calculated`**

* **Publisher:** CL-35 (Phase 3)

* **Subscribers:** FA (Finance — VBP payment adjustment)

* **Payload Schema:**

  ```typescript theme={null}
  {
    organization_id: string;        // UUID
    measure_id: string;             // e.g. 'AMM', 'FUH'
    measure_type: 'HEDIS' | 'MA_STARS';
    period_start: string;           // ISO date
    period_end: string;             // ISO date
    denominator_count: number;
    numerator_count: number;
    rate: number;                   // 0.0000–1.0000
    calculated_at: string;          // ISO timestamp
  }
  ```

* **Integration doc:** [CL-FA-VBP-QUALITY-DATA-PIPELINE.md](CL-FA-VBP-QUALITY-DATA-PIPELINE.md)

**2. `cl_care_gap_closed`** (Phase 2)

* **Publisher:** CL-35
* **Subscribers:** FW (Workflow — event automation)
* **Channel:** `cl_events`
* **Integration doc:** [CL-FW-EVENT-AUTOMATION-INTEGRATION.md](CL-FW-EVENT-AUTOMATION-INTEGRATION.md)

### Events Consumed

None — CL-35 reads data via direct queries to CL-internal tables, not events.

***

## API Contracts

No external APIs exposed. Internal edge functions:

* `cl-risk-stratification-cron`: Batch risk score calculation (Phase 2)
* `cl-care-gap-rules`: Batch gap rule evaluation (Phase 1)
* `cl-hedis-measure-calculation`: HEDIS period calculation (Phase 3)
* Population dashboard aggregate queries (Phase 3)

***

## Platform Integration Layer Usage

| Layer       | Import Path              | Usage                                                                           |
| ----------- | ------------------------ | ------------------------------------------------------------------------------- |
| Scheduling  | `@/platform/scheduling`  | Read encounter context for `pm_encounters` (discharge events, contact tracking) |
| Permissions | `@/platform/permissions` | `useHasPermission('cl.care-gaps.view')` etc.                                    |
| Table v2    | `@/platform/table-v2`    | Work list UI (TanStack Table v8)                                                |

***

## Security Considerations

* All data access RLS-gated via `cl_has_org_access(organization_id, auth.uid())`
* Population dashboard aggregates enforce small-cell suppression (n \< 5 → `"<5"`)
* No PHI in event payloads (quality measure periods are aggregate counts)
* Edge function logs must not contain patient identifiers

***

## References

* [CL-35 Spec](../../../specs/cl/specs/CL-35-population-health-care-gap-management.md)
* [CL-FA-VBP-QUALITY-DATA-PIPELINE.md](CL-FA-VBP-QUALITY-DATA-PIPELINE.md)
* [CL-FW-EVENT-AUTOMATION-INTEGRATION.md](CL-FW-EVENT-AUTOMATION-INTEGRATION.md)
* [CROSS\_CORE\_INTEGRATIONS.md](CROSS_CORE_INTEGRATIONS.md)
