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

# Integration Contract

> Defines integration boundaries for drug-drug interaction (DDI) checking in clinical medication workflows, including external vendor calls and internal consumer…

## Purpose

Defines integration boundaries for drug-drug interaction (DDI) checking in clinical medication workflows, including external vendor calls and internal consumers.

## Upstream Trigger

* Medication add/edit in CL-05 reconciliation workflow
* Pre-transmission validation in CL-06 e-prescribing flow

## External API Contract

### Request

* Organization and site context
* Candidate medication code
* Active medication code set for encounter context

### Response

* Interaction severity (`contraindicated`, `severe`, `moderate`, `minor`)
* Interacting medication references
* Clinical effect summary
* Recommended action text
* **Part 2 gating (application layer):** When SUD-tagged meds are withheld from the vendor payload, the
  service returns `excludedMedications[]` (RxCUI + reason) and `sudMedicationsExcludedForConsent` for the
  non-blocking indicator (CL-05-EN-01 FR-4.2).

### Non-Functional Constraints

* p95 alert resolution target under 500ms for in-workflow rendering
* Failure mode returns non-blocking warning unless local policy requires hard stop

## Internal Contract

### CL-05 Consumer

* Renders severity-tagged alerts during medication selection
* Requires override workflow for severe/contraindicated interactions

### CL-06 Consumer

* Blocks or gates e-prescribing send action when unresolved high-severity interactions exist

### CL-08 Relationship (CDS Framework)

* CL-08 owns the CDS rule framework; its `drug_interaction` rule type delegates to CL-05-EN-01's DDI query service for vendor-backed interaction data
* CL-08 EN-29 (Alert Fatigue Analytics) consumes `cl_ddi_overrides` via **direct table query** (not event-driven) for override frequency analysis
* **No event contract required:** CL-08 reads from `cl_ddi_overrides` directly within the same core (CL); no cross-core event needed
* This spec does not modify CL-08 tables (`cl_cds_rules`, `cl_cds_alerts`) or rules

### CL-11 Dependency (42 CFR Part 2 Consent)

* DDI queries involving SUD-tagged medications invoke `cl_has_sud_consent(p_chart_id)` (chart-scoped, SECURITY DEFINER) before including those medications in external API payloads
* If consent is absent, SUD medications are excluded from the DDI query and a non-blocking indicator is shown
* **Trade-off:** Without consent, excluded SUD RxCUIs can yield incomplete interaction checks vs. other
  meds until consent is captured — intentional; surface clearly to clinicians.
* Override records for SUD medications include a consent reference for Part 2 disclosure logging

### PM-10 Downstream Usage

* May consume documented override metadata for prior authorization context
* No PM ownership transfer; this spec remains CL-owned

## Data Persistence Boundary

* Overrides stored in `cl_ddi_overrides`
* Tenant isolation via `organization_id` and RLS policies
* Override auditability includes actor, timestamp, and optional cosigner metadata

## Security and Compliance Notes

* Minimum-necessary data payloads for external calls
* No PHI in logs or test fixtures
* Jurisdiction-sensitive policy behavior configured via PF-96 profile, not hardcoded constants
* **Go-live:** Clinical + compliance sign-off (CL-05-EN-01 Compliance Review) before production DDI
  enforcement for SUD populations.

## Related Specs

* `specs/cl/specs/CL-05-EN-01-drug-drug-interaction-checking.md`
* `specs/cl/specs/CL-05-medication-management-reconciliation.md`
* `specs/cl/specs/CL-06-e-prescribing-controlled-substances.md`
* `specs/cl/specs/CL-08-clinical-decision-support.md` — CDS rule framework; `drug_interaction` rule type delegates to this spec
* `specs/cl/specs/CL-11-consent-management-42cfr-part2.md` — Part 2 consent gating for SUD medications
