Source: https://quadevs.com/case/document-reformat/

Title: Clinical document conversion at scale: PDF, CDA | quadevs

[Home](https://quadevs.com/)/ [Cases](https://quadevs.com/cases/)/ Document reformat at scale

# Document reformat at scale

A streaming pipeline with a fixed memory budget that converts clinical document sets between PDF, TIFF, DOCX, structured XML and CDA. Headings and tables survive the conversion, and each step records the input and output hashes so it can be replayed.

## What is clinical document conversion?

Clinical document conversion moves sets of medical documents between formats such as PDF, TIFF, DOCX, structured XML and CDA. Headings, tables and lists stay intact. At scale it needs streaming within a fixed memory budget and an audit record for every step, so any result can be reproduced.

## Files of tens of thousands of pages

A clinical operator had to convert document sets between PDF, TIFF, DOCX, structured XML and CDA. One input could run to tens of thousands of pages, and conversion in memory crashed on the larger files. Structure came through some formats and not others. With no audit trail, an analyst could not prove that a value came from the original file.

## Streaming adapters with hashes per step

We built a .NET pipeline in which every format adapter follows one streaming contract. Large documents are processed a page at a time, and memory stays within its budget. Headings, tables and lists carry across conversions wherever the target format supports them. Each step writes an audit record with the input hash, the output hash and the adapter version.

## Stack and engineering choices

- .NET streaming pipeline.
- Memory-bounded format adapters.
- PDF + TIFF + DOCX + CDA hops.
- Structure preservation.
- Per-step audit records.
- Hash-based reproducibility.
- Replay from audit trail.

## Every value traceable to its source

Files that used to crash the conversion now run as expected. Structure survives each conversion, so analysts no longer fix the format by hand afterwards. A replay against the audit trail traces any output value back to its input.

1. [What is clinical document conversion?](https://quadevs.com/case/document-reformat/#definition)
2. [Files of tens of thousands of pages](https://quadevs.com/case/document-reformat/#problem)
3. [Streaming adapters with hashes per step](https://quadevs.com/case/document-reformat/#approach)
4. [Stack and engineering choices](https://quadevs.com/case/document-reformat/#engineering)
5. [Every value traceable to its source](https://quadevs.com/case/document-reformat/#outcome)

Category
:   Healthcare · ETL

Stack
:   - .NET
    - streaming
    - CDA
    - PDF

Service [Healthcare document processing and medical OCR](https://quadevs.com/healthcare/medical-document-ocr/)

 [Previous caseScan and fax image clean-up](https://quadevs.com/case/scan-fax-enhance/) [Next caseMobile medication selector](https://quadevs.com/case/mobile-medication/)

## Related work

[### Multi-clinic web platform

Healthcare · web  Next.js · headless · Twilio · ADA View case](https://quadevs.com/case/multi-clinic-web/)   [### FHIR · TEFCA · USCDI integration

Healthcare · interop  FHIR R4 · SMART v2.1 · TEFCA · USCDI v3 · Da Vinci · CARIN BB · US Core View case](https://quadevs.com/case/fhir-tefca-uscdi/)   [### HEDIS measurement pipeline

Healthcare · pipeline  .NET · MSSQL · NewRelic · HEDIS View case](https://quadevs.com/case/hedis-pipeline/)

[Send a brief. Reply within 1 business day](https://quadevs.com/contact/)  [or email hello@quadevs.com](mailto:hello@quadevs.com)
