Information Extraction from Handwritten Health Insurance Forms


For the Austrian Health Insurance Fund (in German: Österreichische Gesundheitskasse, ÖGK) dida developed a custom, on-premise AI solution to automate the extraction of handwritten data from insurance forms with over 97% accuracy.

Input

Thousands of scanned, handwritten forms per week (e.g., childcare benefit applications) containing insurance numbers and IBANs.

Output

Structured JSON data with extracted fields, achieving >97% recognition accuracy for insurance numbers.

Goal

Eliminate manual data entry bottlenecks while adhering to strict on-premise and CPU-only infrastructure constraints.


Introduction


The Austrian Health Insurance Fund, the major health insurance provider of Austria with 7.5M members, partnered with dida to automate the processing of incoming postal forms. While printed text was easily handled by existing tools, handwritten fields - specifically insurance numbers and IBANs - created a significant bottleneck requiring manual transcription. dida developed a custom, high-security AI solution that runs entirely on-premise, transforming a repetitive manual workflow into an automated API service.


Starting Point


Our client manages health insurance for a significant portion of the population. Their "Classification and Extraction" team handles a massive influx of physical mail, such as applications for childcare benefits or prescription fee exemptions. While their existing licensed OCR software handled printed text reliably, it failed significantly with handwriting.

Pain Points

Existing tools struggled significantly with handwriting, achieving a recognition rate of less than 10% for insurance numbers. This forced employees to manually decipher and type out 10-digit insurance numbers and long IBANs, a tedious process highly prone to fatigue and human error. Consequently, the manual workflow lacked scalability and could not keep up with the increasing volume of incoming mail without the need to hire additional staff.

Graphic 1: Artificial example of handwritten IBAN number (clear handwriting)

Challenges

The project faced strict technical and regulatory constraints. Due to GDPR data privacy requirements and infrastructure limitations, no cloud services could be utilized, and the production environment was restricted to CPU servers without GPUs.

Beyond infrastructure, the AI model had to master specific European handwriting nuances, such as distinguishing between a European '1' and '7', which frequently confused standard models trained on US datasets. Additionally, Graphic 2 shows four anonymized examples of handwriting where even human assessments can fail.

Graphic 2: Anonymized examples of handwritten insurance numbers (unclear handwriting)

Finally, unpredictable user behavior added complexity, as applicants often wrote outside the designated boxes, used incorrect formats, or crowded digits into small spaces.

Graphic 3: Artificial example of typical error in filling out forms


Solution


dida designed a containerized, two-stage computer vision pipeline that localizes and extracts handwritten fields with high precision.

The project was divided into four distinct phases:

  • Data Preparation: Processing raw scans and generating labels (using both manual and synthetic methods).

  • Model Training: Developing separate models for layout recognition and handwriting OCR.

  • Evaluation: Rigorous testing against validation datasets and end-to-end process checks.

  • Operation: Deploying the solution as a dockerized service on client infrastructure.

dida built a REST API service encapsulated in a Docker container. This service accepts document images, processes them through the AI pipeline, and returns a structured JSON containing the extracted text and confidence scores. It operates independently of the internet, ensuring full data privacy.

Results

The solution achieved a recognition rate of over 97% for handwritten insurance numbers. It operates efficiently on standard CPUs, with a processing time of approximately 2 seconds per document. Upon completion, the client received the full source code, trained model weights, Docker containers, and a Windows executable for standalone testing.


Technical Background


Data preparation

We received approximately 4,000 scanned forms from the client and employed a mix of strategies to train the models. Using the open-source tool Label Studio, we manually annotated layouts and transcribed handwritten fields. To overcome data scarcity and improve robustness, we generated synthetic datasets that combined various background noises with handwritten digits. Additionally, an automated pipeline was implemented to standardize the input images, ensuring consistent training conditions.

We curated specific datasets tailored to different tasks. For layout recognition, we utilized nearly 100 forms for training and over 1,000 for validation. The handwritten insurance numbers dataset consisted of approximately 700 training samples and a similar number for validation, while the handwritten IBAN dataset included over 100 samples for both training and validation. To supplement these real-world examples, we generated over 10,000 synthetic examples for both insurance numbers and IBANs.

Data preparation was performed on dida's self-hosted infrastructure using a server dedicated to the data pipeline and Label Studio.

AI model development

We utilized a two-stage approach using pre-trained open-source models as a foundation. For the Layout Model, we employed the RT-DETR (Real-Time Detection Transformer), to locate specific fields on the page. For the OCR Model, we used Microsoft's TrOCR (Transformer-based Optical Character Recognition), to read the text within the located fields.

Both models were fine-tuned on the specific domain data of the client forms. We utilized MLflow to track metrics during training runs and DVC (Data Version Control) to manage dataset versions. Additionally, hyperparameter tuning was performed to carefully balance accuracy with the inference speed constraints.

Training was conducted on high-performance, self-hosted hardware to ensure data never left dida's secure environment.

Operations

The final deliverable is a Docker container running on the client's infrastructure with a REST API interface. The hardware is optimized for CPU-only inference, meaning no GPUs are required in production. To achieve a processing time of approximately 2 seconds per page (with 2 fields), the service scales effectively with 8 CPU cores. Furthermore, the container is stateless and requires no external internet connection, ensuring strict data privacy.

Results and metrics

Layout recognition

The model demonstrated a high ability to correctly find the fields on the page (Intersection over Union > 80%), achieving a Precision > 97% and a Recall of > 98%.

Handwriting recognition

For OCR, the system returns 4 candidates. Since insurance numbers and IBANs have checksums, the system can automatically validate which candidate is correct. We achieved a > 97% accuracy for insurance numbers and a slightly worse result for IBANs, noting that IBANs are significantly longer and harder to write within the box constraints.

End-to-end evaluation

In a real-world test of around 100 forms, > 90% were processed completely correctly, while in the majority of the error cases, the handwriting recognition was correct, but the user had entered invalid data (e.g., wrong format), requiring manual review. Only 1% in this test suffered from an OCR error due to poor scan quality.

Assets

The client received full documentation and source code for the REST API, data processing, and training. We also delivered Docker images for the service, the trained model weights, and the evaluation datasets.

Related projects