AI-Powered Medical Report Processing with Google Gemini

Mutanex needed a solution to automate the extraction of patient information and laboratory test results from medical reports. With reports arriving as PDFs and images in different formats, the system needed to identify relevant clinical data and convert it into a standardized structure for further processing.

Transcloud engineered a medical report extraction workflow that combines document processing with generative AI to convert laboratory reports into structured, machine-readable data. Google Cloud Document AI extracts content from PDFs and images, while Gemini interprets the extracted information, resolves variations in medical test naming, and maps the results to a standardized JSON schema. Custom Python processing filters irrelevant document metadata to improve processing efficiency. MedGemma was evaluated during model selection to determine the most suitable approach for the workflow.

99%99.85%400+
successful extractionDataset optimization done to achieve maximum level of token optimizationreal-world reports tested

Key Challenges

Variations in laboratory reports: Different laboratories used different layouts, table structures, and field names, making consistent data extraction difficult.

Inconsistent medical terminology: The same medical test could appear under different names. Extracted values needed to be mapped to consistent fields without losing their associated units or normal ranges.

Structured data requirements: Extracting text alone was insufficient. The solution needed to organize patient details and test results into a predefined JSON structure that downstream applications could consume.

Processing efficiency: Document parsing generated layout information and metadata that were unnecessary for the final output, increasing the volume of information sent to the AI model.

Solution

AI-Powered Document Understanding

Transcloud used Google Cloud Document AI to process medical report PDFs and images, extracting text, tables, and labelled fields. This provided a structured representation of the report content for further interpretation.

Google Gemini then processed the extracted information against a predefined master JSON schema. The schema specified the required patient details, medical test names, results, units, and normal ranges.

Custom Python processing orchestrated these stages, filtered the extracted content, and helped map the information into the required structure. This approach reduced dependence on fixed document layouts and individual extraction rules.

Google Gemini and MedGemma Evaluation

The solution incorporated an evaluation of Google’s MedGemma, a medical-domain model, to determine its suitability for the requirements of medical report processing.

The assessment distinguished between medical-domain understanding and the document parsing capabilities required to extract information from varied PDFs and images. For this workflow, Transcloud retained Document AI for document extraction and Gemini for interpreting the extracted content and generating structured JSON.

This architecture aligned the document processing and language model components with their respective tasks rather than relying on a single model to handle the entire workflow.

Optimized AI Processing

Transcloud further optimized the workflow by filtering Document AI’s response before passing it to Gemini. Instead of sending the complete response, including unnecessary page coordinates and layout metadata, the pipeline retained only relevant tables and labelled fields.

For one sample report, this reduced the data sent to Gemini from 18.5 MB to 28 KB, approximately 99.85% less input data. The reduction lowered the volume of information processed by the model and created the potential to reduce API costs, depending on actual token usage and pricing.

Standardized Output and Quality Control

The extracted information was mapped to the client’s predefined JSON schema to maintain consistency across reports from different laboratories.

The workflow also included confidence scores for individual extracted values, helping identify fields that might require manual verification before downstream use.

Results:

  • Over 99% successful extraction: Failure rate below 1% across more than 400 tested medical reports.
  • 99.85% less input data: Optimized the token usage by reducing the data sent to Gemini from 18.5 MB to 28 KB for every report.
  • Automated medical data extraction: Processed patient information and laboratory test results from PDFs and images.
  • Consistent JSON output: Standardized information across different report layouts and medical terminology.
  • Lower processing overhead: Removed unnecessary document metadata before AI processing, with potential API cost benefits.
  • Improved quality control: Included field-level confidence scores to flag values that may need manual verification.

Why Transcloud

Transcloud combined Google Cloud AI services with custom processing logic to address the practical challenges of medical document extraction. By separating document parsing from contextual interpretation and optimizing the data passed between components, the team developed a more efficient workflow for converting varied laboratory reports into standardized, machine-readable information.

Stay Updated with Latest Case Studies

    You May Also Like

    Building a Centralized Data Platform for a National / GOV Pension Organization

    225M+

    Records Unified

    Read More
    AWS EKS cost optimization across 100+ Kubernetes clusters using compute rightsizing, cost visibility, and resource cleanup

    Establishing Cost Transparency and Cost Reduction Across Amazon EKS

    20%

    Cost reduced

    Read More