Population Health Service — AI Integration
Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services
1. Current AI Calls
The population-health-service has one active AI integration in the roadmap: natural-language cohort builder. All other analytical functions use deterministic rule engines.
| # | Purpose | AI Gateway endpoint | Prompt template | Moderation | HITL required | Phase |
|---|---|---|---|---|---|---|
| 1 | NL-to-cohort DSL conversion | POST /api/v1/ai/completions via ai-gateway-service | pophealth-cohort-nl-to-dsl-v1 | Input/output content filter | Yes — analyst must review and approve generated DSL before save | S3/roadmap |
1.1 NL-to-Cohort DSL (Roadmap, Phase S3)
Purpose: Allow analysts to describe a cohort in natural language (e.g., "women aged 25–49 with two or more ANC visits in the last year who have not had a postpartum visit") and have the AI generate the structured CohortExpressionNode JSON.
Flow:
HITL gate: The draft DSL is never auto-saved. The analyst must explicitly review and approve before the cohort definition is persisted. This is a mandatory human-in-the-loop step.
Moderation policy:
- Input: user prompt screened for PII/PHI leak attempt before forwarding to ai-gateway.
- Output: generated DSL validated against cohort schema; invalid DSL is not returned to client.
- Refused completions emit
ai_gateway.completion.refused.v1; analyst receives an error with fallback to manual DSL editor.
AIProvenance: Generated DSL includes a _aiGenerated: true and _aiModel: "<model-id>" metadata field in the cohort definition, retained for audit.
2. Non-AI Analytical Functions
The following capabilities use deterministic rule engines, not AI:
| Function | Implementation |
|---|---|
| Risk scoring | Configurable clinical risk models (points-based or logistic weights configured per tenant) |
| Care-gap detection | Rule-based gap engine driven by protocol definitions (HEDIS, QOF, MoPH) |
| Quality metric computation | Deterministic numerator/denominator/exclusion calculators |
| De-identification | Algorithmic k-anonymity + Laplace noise (ε-DP) — no AI |
| DHIS2 indicator mapping | Static indicator-to-data-element mapping configured per indicator family |
No AI is used in the de-identification pipeline. Any future use of ML models for re-identification risk scoring would require a separate security review and explicit HITL gate.