Skip to main content

Document Service — Epics

Service: document-service Epic prefix: DOC-EPIC Last updated: 2026-04-18


Epics

DOC-EPIC-01 — Template Library Management

FieldValue
Issue typeEpic
SummaryBuild template CRUD: draft → publish lifecycle, versioning, tenant/facility scope
StatusTo Do
PriorityMust
Labelsservice:document, domain:clinical_documents, slice:S0
Componentstemplate-crud, template-versioning, migrations
Fix versionM0
FR referencesFR-DOC-001, FR-DOC-002, FR-DOC-003, FR-DOC-004, FR-DOC-005, FR-DOC-006
Legacy FR refsFR-DMS-001..006 (PLAT-DMS SPEC.md §3.1)
Dependencies
Rollup statusNot 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

FieldValue
Issue typeEpic
SummarySynchronous and async PDF generation from FHIR-bound templates; no PHI in client rendering
StatusTo Do
PriorityMust
Labelsservice:document, domain:clinical_documents, slice:S0
Componentspdf-renderer, fhir-binding, render-jobs, idempotency
Fix versionM0
FR referencesFR-DOC-007, FR-DOC-008, FR-DOC-009, FR-DOC-011, FR-DOC-012, FR-DOC-013, FR-DOC-014
Legacy FR refsFR-DMS-007..015 (PLAT-DMS SPEC.md §3.1)
DependenciesDOC-EPIC-01, interop-service
Rollup statusNot 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

FieldValue
Issue typeEpic
SummaryUpload scanned records; mandatory virus scan; FHIR registration on pass
StatusTo Do
PriorityMust
Labelsservice:document, domain:clinical_documents, slice:S0
Componentsupload-ingestion, virus-scanner, object-storage
Fix versionM0
FR referencesFR-DOC-023
Legacy FR refsFR-DMS-023 (PLAT-DMS SPEC.md §3.2), FR-DM-001
DependenciesDOC-EPIC-02 (object storage patterns)
Rollup statusNot 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

FieldValue
Issue typeEpic
SummaryDocument list/search, versioned supersession, signed URL access, audit on every access
StatusTo Do
PriorityMust
Labelsservice:document, domain:clinical_documents, slice:S1
Componentsartifact-search, presigned-urls, audit
Fix versionM1
FR referencesFR-DOC-016, FR-DOC-018, FR-DOC-019, FR-DOC-020, FR-DOC-021, FR-DOC-022
Legacy FR refsFR-DMS-016..022 (PLAT-DMS SPEC.md §3.2), FR-DM-003
DependenciesDOC-EPIC-02
Rollup statusNot 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

FieldValue
Issue typeEpic
SummaryShip and maintain first-class platform templates; immutable for tenants; fork workflow
StatusTo Do
PriorityMust
Labelsservice:document, domain:clinical_documents, slice:S0
Componentsplatform-templates, fork-workflow, reference-forms
Fix versionM0
FR referencesFR-DOC-029, FR-DOC-030, FR-DOC-031, FR-DOC-032
Legacy FR refsFR-DMS-029..032 (PLAT-DMS SPEC.md §3.3)
DependenciesDOC-EPIC-01
Rollup statusNot 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

FieldValue
Issue typeEpic
SummaryRTL (Pashto/Dari) PDF rendering; embedded fonts; tenant branding from config-service
StatusTo Do
PriorityMust
Labelsservice:document, domain:clinical_documents, slice:S1
Componentspdf-renderer, rtl-support, branding
Fix versionM1
FR referencesFR-DOC-026
Legacy FR refsFR-DMS-026 (PLAT-DMS SPEC.md §3.2), FR-L10N-006
DependenciesDOC-EPIC-02, config-service
Rollup statusNot 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