Back to Projects

Automated Invoice Processing (White Label Ready)

How I built an AI-powered document extraction and matching system that reduced manual data processing by 90% for medical law firms across UK, Europe, and Gulf regions. Designed for agencies to resell to their enterprise clients.

⚡
90%
Time Saved
đź’°
60%
Cost Reduction
📊
98.5%
Accuracy Rate

The Problem

Agency clients—medical law firms across UK, Europe, and Gulf regions—were drowning in thousands of scanned medical documents and client records. Each firm had dedicated staff members spending 40+ hours weekly manually opening documents, extracting critical client information (client name, client ID, date of birth, date of accident, claim amounts, MRI reports, medical records), and cross-referencing this data against massive spreadsheets containing thousands of client records. This manual process was not only time-consuming and expensive but also prone to human errors that could impact case outcomes. Law firms needed a scalable solution to process multiple documents simultaneously, extract structured data accurately, and automatically match it against existing client databases with confidence scoring. Agencies recognized this as a high-value opportunity to offer white-label solutions to their enterprise clients.

The Engineering Solution

I developed a comprehensive intelligent document processing system using Google Document AI that enables medical law firms to upload multiple scanned documents simultaneously, automatically extract structured client data (names, IDs, dates, amounts, medical reports), and intelligently match extracted information against spreadsheet databases using advanced fuzzy matching algorithms. The system provides real-time matching scores and percentage accuracy, allowing legal teams to quickly identify discrepancies and validate client information without manual intervention.

Architecture Overview

The system architecture features a React.js frontend with multi-file upload capabilities and real-time progress tracking, a FastAPI backend with async processing queues for handling bulk document uploads, Google Cloud Document AI for OCR and intelligent data extraction from scanned medical documents, PostgreSQL database for storing extracted data and client records, a fuzzy matching engine using Python's rapidfuzz library for intelligent data comparison, and a comprehensive dashboard displaying extraction results, matching scores, and confidence percentages. The system processes documents in parallel batches, ensuring scalability for law firms handling thousands of documents monthly.

Technical Challenges & Solutions

Challenge 1:

Extracting accurate data from poor-quality scanned medical documents with varying formats, handwriting, and image quality was critical for legal accuracy.

My Solution:

I implemented a sophisticated pre-processing pipeline using Python/OpenCV that automatically enhances image quality through noise reduction, contrast optimization, deskewing, and resolution upscaling. This preprocessing step improved Document AI extraction accuracy by 18%, ensuring reliable data extraction even from low-quality scans commonly found in medical records.

Challenge 2:

Matching extracted client data against spreadsheet records required handling variations in name spellings, date formats, and data inconsistencies common in legal databases.

My Solution:

I developed a custom fuzzy matching algorithm using rapidfuzz that compares multiple fields simultaneously (name, ID, dates) with configurable similarity thresholds. The system uses weighted scoring across different data points, handles common variations (e.g., 'John Smith' vs 'J. Smith'), and provides percentage match scores. This intelligent matching reduced false negatives by 95% compared to exact string matching.

Challenge 3:

Processing thousands of documents simultaneously while maintaining system performance and providing real-time feedback to users.

My Solution:

I architected an async processing system with Redis-based job queues that distributes document processing across multiple workers. The system processes documents in parallel batches, provides real-time progress updates via WebSocket connections, and includes automatic retry logic for failed extractions. This architecture enables law firms to upload and process 500+ documents simultaneously without performance degradation.

Challenge 4:

Ensuring data security and compliance with legal data protection regulations (GDPR for Europe, UK data protection laws, and regional regulations for Gulf countries).

My Solution:

I implemented end-to-end encryption for document storage, role-based access controls, comprehensive audit logging, and data retention policies compliant with GDPR and regional legal requirements. All extracted data is stored securely with encryption at rest, and the system includes automatic data anonymization features for sensitive medical information.

Tech Stack

PythonFastAPIReact.jsGoogle Cloud Document AIPostgreSQLOpenCVRapidFuzzRedisDockerAWS