Skip to main content

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.

#PurposeAI Gateway endpointPrompt templateModerationHITL requiredPhase
1NL-to-cohort DSL conversionPOST /api/v1/ai/completions via ai-gateway-servicepophealth-cohort-nl-to-dsl-v1Input/output content filterYes — analyst must review and approve generated DSL before saveS3/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:

FunctionImplementation
Risk scoringConfigurable clinical risk models (points-based or logistic weights configured per tenant)
Care-gap detectionRule-based gap engine driven by protocol definitions (HEDIS, QOF, MoPH)
Quality metric computationDeterministic numerator/denominator/exclusion calculators
De-identificationAlgorithmic k-anonymity + Laplace noise (ε-DP) — no AI
DHIS2 indicator mappingStatic 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.