Document Service — Epics
Service: document-service Epic prefix: DOC-EPIC Last updated: 2026-04-18
Epics
DOC-EPIC-01 — Template Library Management
| Field | Value |
|---|---|
| Issue type | Epic |
| Summary | Build template CRUD: draft → publish lifecycle, versioning, tenant/facility scope |
| Status | To Do |
| Priority | Must |
| Labels | service:document, domain:clinical_documents, slice:S0 |
| Components | template-crud, template-versioning, migrations |
| Fix version | M0 |
| FR references | FR-DOC-001, FR-DOC-002, FR-DOC-003, FR-DOC-004, FR-DOC-005, FR-DOC-006 |
| Legacy FR refs | FR-DMS-001..006 (PLAT-DMS SPEC.md §3.1) |
| Dependencies | — |
| Rollup status | Not started |
Business outcome: Enable clinical and administrative teams to build, version, and publish standardized document templates for prescriptions, lab requisitions, reports, letters, and consent forms.
Description:
The template library is the foundation of the document-service. Templates go through a governed draft → publish lifecycle with semantic versioning. Published versions are immutable. Templates have effectiveFrom / effectiveTo scheduling. Tenant Admins manage templates via a designer UI; the service exposes CRUD APIs. All lifecycle changes emit NATS events for audit. Platform reference templates (origin=platform) cannot be edited by tenants; they can only be forked.
Stories: DOC-US-001, DOC-US-002, DOC-US-003
DOC-EPIC-02 — Server-Side PDF Generation
| Field | Value |
|---|---|
| Issue type | Epic |
| Summary | Synchronous and async PDF generation from FHIR-bound templates; no PHI in client rendering |
| Status | To Do |
| Priority | Must |
| Labels | service:document, domain:clinical_documents, slice:S0 |
| Components | pdf-renderer, fhir-binding, render-jobs, idempotency |
| Fix version | M0 |
| FR references | FR-DOC-007, FR-DOC-008, FR-DOC-009, FR-DOC-011, FR-DOC-012, FR-DOC-013, FR-DOC-014 |
| Legacy FR refs | FR-DMS-007..015 (PLAT-DMS SPEC.md §3.1) |
| Dependencies | DOC-EPIC-01, interop-service |
| Rollup status | Not started |
Business outcome: Clinicians can generate compliant, branded PDF documents (prescriptions, lab requisitions, referral letters) populated from live patient FHIR data without PHI leaving the server.
Description:
PDF generation resolves FHIR bindings server-side (Patient, Encounter, clinical context resources), renders the template definition into a PDF, stores bytes in object storage (AES-256), creates FHIR DocumentReference + Binary, and returns a presigned download URL. Synchronous for interactive flows (p95 < 5 s); asynchronous render jobs for batch/heavy documents with pollable status. Idempotency via clientMutationId supports offline replay. An input snapshot hash enables audit and regeneration analysis.
Stories: DOC-US-004, DOC-US-005, DOC-US-006
DOC-EPIC-03 — Document Upload and Ingestion
| Field | Value |
|---|---|
| Issue type | Epic |
| Summary | Upload scanned records; mandatory virus scan; FHIR registration on pass |
| Status | To Do |
| Priority | Must |
| Labels | service:document, domain:clinical_documents, slice:S0 |
| Components | upload-ingestion, virus-scanner, object-storage |
| Fix version | M0 |
| FR references | FR-DOC-023 |
| Legacy FR refs | FR-DMS-023 (PLAT-DMS SPEC.md §3.2), FR-DM-001 |
| Dependencies | DOC-EPIC-02 (object storage patterns) |
| Rollup status | Not started |
Business outcome: Clinical staff can digitize paper records (scanned PDFs/images) by uploading them to the platform, where they are virus-scanned and indexed as FHIR DocumentReference resources.
Description:
Upload is a two-step flow: initiate (returns staged upload URL) + finalize (triggers ClamAV scan). Clean files are moved to permanent storage and a DocumentReference is created. Infected files are quarantined and a document.upload.quarantined.v1 security event is emitted. The ClamAV connection is part of the health readiness check; uploads are blocked if ClamAV is unavailable.
Stories: DOC-US-007, DOC-US-008
DOC-EPIC-04 — Artifact Management and Audit
| Field | Value |
|---|---|
| Issue type | Epic |
| Summary | Document list/search, versioned supersession, signed URL access, audit on every access |
| Status | To Do |
| Priority | Must |
| Labels | service:document, domain:clinical_documents, slice:S1 |
| Components | artifact-search, presigned-urls, audit |
| Fix version | M1 |
| FR references | FR-DOC-016, FR-DOC-018, FR-DOC-019, FR-DOC-020, FR-DOC-021, FR-DOC-022 |
| Legacy FR refs | FR-DMS-016..022 (PLAT-DMS SPEC.md §3.2), FR-DM-003 |
| Dependencies | DOC-EPIC-02 |
| Rollup status | Not started |
Business outcome: Clinicians can search a patient's full document history and download documents securely; every access is auditable for compliance and HIPAA accounting of disclosures.
Description:
Document list/search APIs expose FHIR DocumentReference search by patient, encounter, category, and date range. Downloads return presigned URLs (default 15 min TTL). Supersession creates a new artifact with relatesTo + Provenance; the original remains addressable for retention. Every view, download, print, and export emits an audit event. Secure sharing (portal) follows platform-approved patterns only.
Stories: DOC-US-009, DOC-US-010
DOC-EPIC-05 — Platform Reference Form Catalog
| Field | Value |
|---|---|
| Issue type | Epic |
| Summary | Ship and maintain first-class platform templates; immutable for tenants; fork workflow |
| Status | To Do |
| Priority | Must |
| Labels | service:document, domain:clinical_documents, slice:S0 |
| Components | platform-templates, fork-workflow, reference-forms |
| Fix version | M0 |
| FR references | FR-DOC-029, FR-DOC-030, FR-DOC-031, FR-DOC-032 |
| Legacy FR refs | FR-DMS-029..032 (PLAT-DMS SPEC.md §3.3) |
| Dependencies | DOC-EPIC-01 |
| Rollup status | Not started |
Business outcome: Every tenant has access to a curated catalog of jurisdiction-appropriate reference forms (General Test Requisition, prescriptions, etc.) from day one, with stable platformFormKey values that drive contract tests and interoperability.
Description:
Platform reference templates ship with the product, flagged origin=platform. They have stable platformFormKey values. Tenants cannot edit them in place; they fork to create a tenant-owned copy. Platform upgrades deliver new template versions via semver; tenants may pin versions. The General Test Requisition is the canonical lab requisition reference and drives golden PDF contract tests.
Stories: DOC-US-011, DOC-US-012
DOC-EPIC-06 — RTL/Multilingual PDF Rendering and Branding
| Field | Value |
|---|---|
| Issue type | Epic |
| Summary | RTL (Pashto/Dari) PDF rendering; embedded fonts; tenant branding from config-service |
| Status | To Do |
| Priority | Must |
| Labels | service:document, domain:clinical_documents, slice:S1 |
| Components | pdf-renderer, rtl-support, branding |
| Fix version | M1 |
| FR references | FR-DOC-026 |
| Legacy FR refs | FR-DMS-026 (PLAT-DMS SPEC.md §3.2), FR-L10N-006 |
| Dependencies | DOC-EPIC-02, config-service |
| Rollup status | Not started |
Business outcome: Clinical documents generated for Afghan providers render correctly in Pashto (ps-AF), Dari (fa-AF), and mixed Arabic/Latin numerics, supporting the national eHealth mandate for multilingual clinical records.
Description:
PDFs embed Noto Nastaliq Urdu and Noto Sans fonts. Layout direction (rtl / ltr) is resolved from config-service design tokens for the request locale. Mixed-direction numerics use Unicode bidi algorithm. Tenant branding (logo, header, watermark) merges from config-service token map. Golden PDF contract tests verify RTL rendering per reference form.
Stories: DOC-US-013, DOC-US-014