Catalog / Document Intelligence / DOC-007

Medical record & lab report extraction

Turn scanned or PDF lab reports, discharge letters and medical records into structured, coded data (FHIR, LOINC, ICD-10) for clinicians, hospitals, insurers and patients.

Practices, hospitals, insurers and patients still receive a large share of clinical information as PDF, fax or paper: lab reports, discharge letters, findings. Document AI reads these pages, extracts values and diagnoses into a structured, coded form (FHIR, LOINC, ICD-10) and shows every value next to its source for quick human verification. The benefit is less manual transcription and searchable records; the price is strict handling of health data (GDPR Art. 9) and, depending on the purpose, medical-device or AI Act high-risk rules.

Problem & value

  • Today: lab reports from external labs, discharge letters and referrals arrive as PDF, fax or paper and are filed or retyped by staff. Values are not machine-readable, so trends, alerts and decision support cannot use them.
  • AI value: extraction of analytes, units, reference ranges and flags; coding of diagnoses and medications from free text; pre-filling of the record for review; indexing for search.
  • Regulatory pull: the European Health Data Space (EHDS) Regulation entered into force on 26 March 2025; patient summaries must be exchangeable across the EU from March 2029 and lab results, medical images and discharge reports from March 2031. Legacy PDFs have to be converted into the structured formats these regimes require [1].
  • Quantified benefits: this file deliberately states no generic accuracy or time-saving figure. Published numbers depend on document mix and language; measure on your own samples (see KPIs).

Variants

  • Outpatient practice / MVZ / laboratory network: import of external lab reports and referral letters into the practice management system.
  • Hospital: discharge-letter and historic-record digitisation for the hospital information system and clinical research (with DOC-018 de-identification).
  • Insurers and claims: extraction from medical certificates, invoices and reports for claims handling (boundary to DOC-017 and DOC-001); decisions on benefits become high-risk, see below.
  • Pharma / clinical trials: source-document extraction and case-report-form pre-filling.
  • Private use: patients photograph lab results and get a structured timeline and plain-language explanation; records may be kept in the electronic patient record (ePA).

How it works

  1. intake (fax/email/scanner/KIM/portal/photo)
  2. classification (lab report | discharge letter | referral | other; DOC-008)
  3. OCR + layout parsing (tables, reference-range columns, handwriting stamps)
  4. extraction against a schema (VLM or document model)
  5. JSON
  6. normalisation (analyte
  7. LOINC, unit
  8. UCUM, diagnosis
  9. ICD-10-GM, drug
  10. ATC)
  11. validation (plausibility ranges, unit consistency, patient identity match, duplicate check)
  12. human review of low-confidence fields with source highlight (human-in-the-loop)
  13. export (FHIR DiagnosticReport + Observation, HL7 v2, practice-system API) + audit log
  • Parsing: tables with units and reference ranges are the main source of errors; layout-aware parsers keep row/column structure [5].
  • Extraction: a vision-language model returns JSON constrained by a schema; free-text sections use an LLM or a clinical NER model.
  • Coding: terminology lookup (retrieval over code systems) instead of letting a model guess codes.
  • Human-in-the-loop: mandatory for patient identity, critical values and any value that triggers a clinical action. The FHIR DiagnosticReport/Observation model is the natural target: a report references atomic Observations, coded with LOINC [4].

Data preparation

Data: lab reports (PDF, fax, scan), discharge and referral letters, findings and free-text notes, plus reference exports (HL7 v2, LDT, GDT) and code systems (LOINC, ICD-10-GM, ATC). In practices and hospitals these live in the practice or hospital information system, the DMS, e-mail or KIM inboxes, fax servers and paper files.

Typical gaps: fax-quality scans, lab-specific table layouts, local analyte names and units, missing patient identifiers, duplicates, free-text abbreviations and strict access rights per department.

Preparation steps: 1. Map sources and data flows and decide the pilot scope (PREP-002, PREP-005). 2. Pseudonymise a sample set for development and testing (PREP-022); real data only in the approved environment. 3. Collect sample reports per lab and document type and have clinicians create gold-standard annotations (PREP-018, PREP-016). 4. Build mapping lists for local analyte names, units and abbreviations (PREP-015). 5. Load code-system terminologies for retrieval-based coding. 6. Define identity-matching rules and classify documents first (DOC-008). 7. Check legal basis and permissions (PREP-025, PREP-024).

Tools: terminology servers, FHIR toolkits, OCR/layout parsers, pseudonymisation scripts.

Effort share: 40-50 percent; expert annotation and terminology mapping dominate. See DOC-014, DOC-018 and GUIDE-003.

Implementation paths

Which path for whom

  • SMB: Path A. Practices should use certified, EU-hosted modules or add-ons for their practice system rather than operate sensitive health data processing themselves.
  • Enterprise: Path C. Hospitals and insurers handle special-category health data at volume, often have a shared AI platform, and want data to stay in their own data centre.
  • Developer: Path B. Vendors building medical software can start on EU-region APIs with a signed AVV and move to self-hosting when volume or customers demand it.
  • Public: Path C. Public hospitals and authorities need sovereign operation and procurement-compliant, auditable stacks.
  • Private: Path A. Patients get the best usability from certified apps that organise their own reports; local tools are an option for technical users.
  • Clinical NLP / health text mining: Averbis (Germany, health text mining for German clinical text), John Snow Labs Spark NLP for Healthcare, Amazon Comprehend Medical, Microsoft Azure AI Language "Text Analytics for health".
  • Document capture with medical focus: ECM/DMS and input-management vendors in German healthcare (e.g. DMS modules of practice and hospital systems); general IDP platforms such as ABBYY Vantage or Hyland. Check: EU hosting or on-premises, processor agreement (AVV) with health-data clauses, FHIR/HL7/GDT interfaces, certification by the PVS/KIS vendor.
  • Choose A when: the practice or hospital system vendor already offers an import module; the integration into the record system is then the hardest part and is best left to the vendor.
  • Vendor claims on accuracy should be validated on your own documents before purchase.

Path B — Build on cloud APIs

  • Parsing: Azure AI Document Intelligence (layout/read models, EU regions) [3], Google Document AI (EU location), Mistral OCR / Document AI (French provider; API with annotations for structured output) [2].
  • Extraction: frontier multimodal LLMs with JSON-schema outputs in EU regions (Anthropic Claude via AWS Bedrock or Google Vertex EU, Gemini on Vertex EU, Azure OpenAI EU data zone, Mistral).
  • Terminology and storage: FHIR stores (Azure Health Data Services, Google Cloud Healthcare API, AWS HealthLake).
  • Needed: signed AVV, no training on inputs, EU-only processing, and for Germany a check against §203 StGB (professional secrecy) and the §393 SGB V cloud requirements (C5 attestation) for statutory-health-insurance data.
  • Choose B when: you build a product or an in-house pipeline and accept cloud processing of health data after legal review.

Path C — Self-host (open source)

  • Parsing: Docling (MIT; local, air-gap capable; Granite-Docling-258M VLM) [5], PaddleOCR / PaddleOCR-VL, MinerU, olmOCR.
  • Models: open VLMs and LLMs such as Qwen3-VL / Qwen3, Mistral Small, Llama-family, and medical models like Google MedGemma 27B (text and multimodal, Gemma 3-based, usable under the Health AI Developer Foundations terms, not for direct diagnosis) [6]. Serve with vLLM, constrain output with JSON schema.
  • De-identification before any external step: Microsoft Presidio (MIT; text, images, DICOM; no guarantee of finding all PII) [7]. Terminology: ICD-10-GM from BfArM, LOINC, SNOMED CT.
  • Hardware: HW3 (one 48–96 GB GPU) for a ~27–32B model; HW2 is enough for a small VLM plus rule-based validation at low volume. Ops effort: GPU server, monitoring, patching, backup.
  • Choose C when: data may not leave the hospital or practice network (typical in Germany).

Path D — Custom training

Worthwhile for recurring local formats (a lab network's own report layouts, German discharge-letter conventions, abbreviations) or to cut costs at high volume. Needs a few hundred to a few thousand manually verified, de-identified documents with field-level labels, fine-tuning of a small VLM or an encoder NER model (text-classifier), a held-out test set per document type and an ethics/data-protection approval for the training data. Prefer rules for structured lab tables; train for narrative text.

State of the art (2026)

  • Parsing: layout-aware VLM parsers (Docling with Granite-Docling, Mistral OCR, PaddleOCR-VL, Azure layout models) read complex tables far better than classic OCR; the remaining issues are multi-page tables, handwriting, stamps, low-quality fax scans and rotated pages [3][5].
  • Medical LLMs: open medical models such as MedGemma (27B text, 27B multimodal; EHRQA 86.3 / 90.5 as reported by the model card) show strong results on medical question answering and record tasks, but the card itself warns that results depend on the prompt and that outputs need independent verification [6].
  • Standards: FHIR R4/R5 DiagnosticReport and Observation with LOINC coding are the target formats [4]; in Germany the MIO specifications of the KBV and the ePA infrastructure of gematik define national structured formats (verify current versions for your case).
  • Limits and failure modes: wrong unit or decimal separator (a decimal comma misread as a thousands separator), swapped rows in tables, wrong patient (mixed pages in a fax batch), hallucinated values for illegible text, mis-coded diagnoses, negation and uncertainty in free text ("kein Hinweis auf ..."), and silent errors that look plausible. Mitigations: schema validation, unit/plausibility checks, dual extraction by two methods with disagreement review, source highlighting.

Shared resources & combinations

  • Shared building blocks: document parsing and VLM extraction stack (DOC-001, DOC-014), classification and input management (DOC-008), de-identification (DOC-018), validation layer, review UI, audit log, terminology server, FHIR store, one GPU server (HW3) shared across the document family.
  • Natural combinations: DOC-008 (route incoming mail), DOC-018 (anonymise for research or model training), DOC-014 (generic table extraction), DOC-017 (bank/payslip analysis uses the same pattern for another domain), AGENT-004 (agentic follow-up such as booking a re-test or notifying the physician; keep a human in the loop). Records chatbots over the structured data need RAG components (vector-db, embedding-text) that this file does not require.

Effort, cost & KPIs

  • A: weeks to a few months, mostly integration, validation and data-protection impact assessment (DPIA); licence per document or per seat.
  • B: 2–4 months for an MVP including terminology mapping and review UI; cost driven by page volume, model choice and legal review.
  • C: 3–6 months with GPU hardware and operations; lower marginal cost, higher fixed cost.
  • D: adds annotation effort (clinician time is the expensive part) and a validation study.
  • KPIs: field-level precision/recall by field type (patient ID, analyte, value, unit, flag), critical-value miss rate (target zero, measured on a test set), share of documents processed without correction, review time per document, coding accuracy against clinician coding, number of identity mix-ups, and time from receipt to availability in the record.

People & change

Involve from the start: management and the medical lead (liability, scope), the practice or ward staff who will review, IT and IT security (hosting, KIM, access), the DPO, legal and compliance (medical device and professional secrecy questions), the data owner of the clinical systems and the works or staff council.

Works council: depends, leaning yes in hospitals. Review queues, audit logs and error statistics per user are suited to monitor behaviour, so §87(1) no. 6 BetrVG typically applies (BAG: objective suitability suffices); §90(1) no. 3 requires early information, and the council may call an AI expert under §80(3). Public hospitals fall under the staff council (Personalrat). See GUIDE-004.

Data protection: health data is special-category data under Art. 9 GDPR; a DPIA is very likely, an AVV is mandatory and the DPO should be involved before any test with real data (GUIDE-005). Add security measures from GUIDE-013.

AI literacy: support staff in understanding extraction errors, unit confusion and automation bias (AI Act Art. 4; GUIDE-006).

Pilot and communication: start with one lab report type and a small, willing team, run in shadow mode, and measure field accuracy and correction time (GUIDE-009, GUIDE-008).

Concerns: patient safety (clinicians always confirm identity and critical values), job fears (relief from transcription) and trust (show source highlighting).

Risks, regulation & compliance

  • GDPR: health data is special-category data (Art. 9(1)). Processing for care rests on Art. 9(2)(h) with professional-secrecy safeguards (Art. 9(3)); research uses Art. 9(2)(j) or consent (Art. 9(2)(a)) [8]. A DPIA (Art. 35), an AVV and a records-of-processing entry are required. German practices also face §203 StGB and Landes- and church-specific hospital data protection laws.
  • EU AI Act: classification depends on purpose. Pure transcription and structuring of documents for staff review is typically minimal risk, or falls under the Art. 6(3) derogation for narrow procedural or preparatory tasks, which must be documented and registered [9]. It becomes high-risk if it is a medical device or safety component under Annex I (Art. 6(1)), or is used for Annex III uses such as eligibility for public healthcare benefits, emergency patient triage or health-insurance risk pricing [10]. Profiling of persons is always high-risk.
  • MDR (Regulation (EU) 2017/745): software that only stores, converts or displays data is not a medical device, but extraction with an intended purpose of diagnosis, prognosis or therapy decisions (for example automatic flagging of abnormal values for treatment) can qualify as medical device software under MDCG 2019-11 and rule 11. Define the intended purpose narrowly and document it.
  • Other: EHDS (secondary use only via health data access bodies, no re-identification) [1]; medical-record retention and §630f BGB documentation duties in Germany; the original document must remain the legally relevant record.
  • Mitigations: human verification, EU/on-prem hosting, encryption, role-based access, audit logs, no use of patient data to train third-party models, de-identification before cloud use.

Getting started

  1. Collect 200–500 representative documents, de-identified and legally cleared, covering the worst cases (fax, tables across pages, handwriting); have a clinician label a gold set.
  2. Define the intended purpose in writing (transcription aid vs. decision support) and check AI Act / MDR classification and DPIA with the data protection officer before processing real data.
  3. Benchmark two or three parsers on the gold set (Docling, Azure Document Intelligence, Mistral OCR) and one VLM extraction prompt with JSON schema; measure field-level errors, not just text accuracy.
  4. Build the review screen with source highlight and hard validation rules (units, ranges, patient match) and run it in shadow mode next to manual entry.
  5. Integrate via FHIR or the record-system interface, then roll out document type by document type.

Sources

  1. European Commission – European Health Data Space Regulation (EHDS): https://health.ec.europa.eu/ehealth-digital-health-and-care/european-health-data-space-regulation-ehds_en
  2. Mistral AI documentation – Document AI / OCR: https://docs.mistral.ai/capabilities/document_ai/
  3. Microsoft Learn – Azure Document Intelligence overview: https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/overview
  4. HL7 FHIR – DiagnosticReport: https://www.hl7.org/fhir/diagnosticreport.html
  5. Docling project (IBM/LF AI & Data, MIT): https://github.com/docling-project/docling
  6. Google MedGemma 27B model card: https://huggingface.co/google/medgemma-27b-it
  7. Microsoft Presidio: https://github.com/microsoft/presidio
  8. GDPR Art. 9: https://gdpr-info.eu/art-9-gdpr/
  9. EU AI Act Art. 6: https://artificialintelligenceact.eu/article/6/
  10. EU AI Act Annex III: https://artificialintelligenceact.eu/annex/3/