Document Service — AI Integration
Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services
1. AI Integration Status
Scoped optional AI-assist features — no direct vendor AI SDK calls. All AI calls route through ai-gateway-service per platform standard.
2. AI Calls List
| # | Purpose | Route | Prompt template | Moderation | HITL |
|---|---|---|---|---|---|
| AI-DOC-01 | Template wording suggestions | ai-gateway-service /v1/ai/complete | doc-template-wording-suggest-v1 | Platform content filter | Yes — user must accept before saving |
| AI-DOC-02 | Layout field placement hints | ai-gateway-service /v1/ai/complete | doc-template-layout-hint-v1 | Platform content filter | Yes — advisory only |
| AI-DOC-03 | Field binding suggestion (FHIR path) | ai-gateway-service /v1/ai/complete | doc-template-binding-suggest-v1 | Platform content filter | Yes — user confirms binding before publish |
3. Constraints and Guardrails
| Constraint | Detail |
|---|---|
| No autonomous submission | AI output is advisory until explicitly accepted by the user in the template designer UI; no autonomous publish |
| No direct vendor SDK | All AI calls via ai-gateway-service; no direct Anthropic/OpenAI SDK in this service |
| No PHI in AI prompts | Template definition contains structural/wording elements only; FHIR binding paths are synthetic keys (e.g. Patient.name), not actual patient data |
| Offline degradation | Cloud AI unavailable offline; UI displays "AI assist unavailable — please enter field names manually" per FR-AI-008 |
| Moderation | All AI output passes through platform content filter before display |
| Audit | AI-assisted template changes are flagged in the template version definition.aiAssistedFields[] metadata |
4. HITL Flow
5. Future AI Capabilities (Out of Scope v1)
| Capability | Notes |
|---|---|
| Structured data extraction from scanned PDFs (OCR + NLP) | Requires separate governance; optional integration behind interface |
| AI-assisted document summary for patient portal | Route through ai-gateway; HITL review by clinician |