Skip to content

DOCX Generation Microservice

Overview

In life sciences environments, validation packages and quality deliverables must frequently be published as formatted Microsoft Word (.docx) documents suitable for regulatory archival, physical printing, or formal sign-off.

The platform provides a dedicated ASP.NET Core microservice (docx-service/) running in container hybrid-rag-docx-service on host port 5055 (internal container port 5050).

Key Capabilities

  • Document Formatting Standards:
    • Implements formal corporate and regulatory document typography.
    • Generates standardized document header blocks with Document ID, Version, Effective Date, Title, and Confidentiality Notices.
    • Builds structured tables with styled header rows, bordered cells, and automated column width distribution.
    • Appends 21 CFR Part 11 Electronic Signature Blocks displaying Signer Name, Role, Date/Time (UTC), Signature Meaning, and Cryptographic SHA-256 Manifest Digest.
  • Service Endpoints:
    • GET /api/health: Health status probe returning 200 OK.
    • POST /api/docx/generate: Generates a fully formatted .docx binary stream from a structured JSON document payload.

API Integration

The Python backend communicates with docx-service through standard HTTP client calls configured via DOCX_SERVICE_URL=http://docx-service:5050.

Example payload structure sent to /api/docx/generate:

{
"document_type": "VALIDATION_SUMMARY_REPORT",
"document_code": "VSR-LIMS-2026-001",
"revision": "1.0",
"title": "Validation Summary Report for Cloud LIMS v5.0",
"author": "Validation Lead Engineer",
"system_code": "LIMS",
"sections": [
{
"title": "1.0 Executive Summary",
"content": "This report summarizes the qualification activities..."
},
{
"title": "2.0 Traceability Matrix",
"table_data": {
"headers": ["Requirement ID", "Specification", "Test Protocol", "Status"],
"rows": [
["URS-LIMS-001", "FS-LIMS-001", "IQ-LIMS-001", "Passed"],
["URS-LIMS-002", "FS-LIMS-002", "OQ-LIMS-001", "Passed"]
]
}
}
],
"signatures": [
{
"signer_name": "Quality Assurance Director",
"role": "QA Approval",
"timestamp": "2026-09-06T12:00:00Z",
"manifest_hash": "a8f5c...3e1d"
}
]
}

The endpoint returns the compiled .docx binary stream with Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document.