
AI-Powered Medical Billing & CGHS Rate Adjudication Engine
AI-assisted healthcare billing and claim adjudication POC system for MOIL (Manganese Ore India Limited), automating medical bill OCR, CGHS rate list compliance, and fraud discrepancy detection with Large Vision Language Models (LVLMs).

Where things stood

MOIL (Manganese Ore India Limited) is a Miniratna state-owned manganese ore mining company headquartered in Nagpur, India. The company manages medical reimbursements and healthcare claims for thousands of employees, dependents, and retirees across empaneled hospitals.
Medical bills arrive in fragmented formats—scanned invoices, discharge summaries, handwritten pharmacy slips, and diagnostic reports. Billing officers had to manually cross-reference thousands of line items against official Central Government Health Scheme (CGHS) rate schedules, checking NABH/non-NABH ceilings, ICU caps, and non-reimbursable consumables.
- Voluminous medical bills processed manually with multiple weeks of reimbursement delay
- Frequent financial leakage from hospital overbilling, duplicate charges, unapproved tests, and unauthorized consumables
- Non-standard procedure descriptions and handwritten medicines hindering straightforward rate matching
- Strict PSU audit scrutiny requiring verifiable legal and regulatory justifications for every deduction
- Sovereign data security requirements prohibiting sensitive employee health records from leaking to public cloud APIs
Delays penalized retired and active employees awaiting reimbursement, while undetected overbilling caused significant annual financial losses for the public enterprise.
What we set out to achieve
- Accept and ingest multi-format medical documentation (PDF, scans, pharmacy receipts, discharge summaries)
- Extract structured line-item data (patient, hospital, dates, procedures, investigations, charges) via MinerU and Qwen2-VL-1.2B LVLM
- Normalize non-standard handwritten or typed descriptions to standardized CGHS procedure codes using medspacy and FuzzyWuzzy
- Build a deterministic CGHS Rate List rule engine covering NABH/non-NABH tariffs, room rents, ICU caps, and surgical packages
- Detect overbilling, duplicate items, and unauthorized charges with full decision explainability
- Empower MOIL auditors with an interactive Human-in-the-Loop review workspace and automated audit reporting
- Ensure 100% on-premise deployment with SQLite, Nginx, and Cloudflare Tunnel guaranteeing sensitive health data remains sovereign
How we ran the engagement
Medical Bill Document Ingestion
Built ingestion pipelines accepting PDFs, scans, camera captures, and lab slips with automated de-skewing, noise reduction, and pypdfium2/Pillow pre-processing.
MinerU & Qwen2-VL Extraction
Applied MinerU (opendatalab v0.1.18) and the Qwen2-VL-1.2B Large Vision Language Model (LVLM) to extract complex tabular layouts, handwriting, and key-value charges from medical invoices.
Clinical NLP & Fuzzy Matching
Engineered FuzzyWuzzy Levenshtein distance calculations and medspacy clinical NLP pipelines with spaCy (en_core_web_sm) to normalize OCR extractions (e.g., 'Pleural Tapin' to 'Pleural Tapping') to standard CGHS procedure masters.
CGHS Rate List Rule Engine
Encoded the official CGHS rate catalog into an algorithmic rule engine applying NABH/non-NABH rates, ICU caps, and consumable exclusions.
Discrepancy Detection & Adjudication
Engineered algorithms flagging overbilling, unbundling, duplicate test entries, and non-reimbursable consumables with clear variance calculations.
FastAPI, PyTorch & Quantization
Engineered high-performance async FastAPI (v0.110.0) with Uvicorn (v0.29.0) and PyTorch with bitsandbytes quantization, enabling heavy LVLM inference on local consumer GPUs (e.g., RTX 4070).
SQLite & Cloudflare Secure Tunnel
Deployed with embedded SQLite (sqlite3), Nginx reverse proxy, and Cloudflare Tunnel for secure remote review access without opening firewall ports on the local network.
What we built
MinerU & Qwen2-VL Vision-Language Extraction
Ingests scanned invoices, discharge summaries, and receipts. The MinerU layout engine and Qwen2-VL-1.2B Vision Language Model accurately parse complex document layouts, extract line-item medical tables, and handle handwritten medicines better than traditional OCR.
- State-of-the-art vision-language extraction using MinerU (opendatalab v0.1.18) and Qwen2-VL-1.2B
- High-speed PDF-to-image rendering via pypdfium2 and image pre-processing with Pillow (PIL)
- HTML layout structure cleanup and table parsing using BeautifulSoup4
Clinical NLP & Fuzzy Matching (medspacy & FuzzyWuzzy)
Automates the intelligent matching of dirty hospital text against official CGHS rate schedules. Levenshtein string distance and specialized clinical entity recognition resolve non-standard spelling variants, medical acronyms, and pharmaceutical terms.
- FuzzyWuzzy & python-Levenshtein distance matching handling misspelled medical bills
- medspacy & spaCy (en_core_web_sm) clinical NLP pipeline for medical entity recognition
- Deterministic CGHS rate list verification covering 1,800+ procedures, NABH tariffs, and ICU limits
FastAPI Backend & Quantized PyTorch Engine
The core computational backbone runs on modern asynchronous Python. Heavy vision-language models run locally with GPU quantization, allowing the entire AI stack to execute efficiently on consumer-grade hardware.
- Asynchronous FastAPI (v0.110.0) backend with Uvicorn ASGI server for responsive processing
- PyTorch execution backend utilizing NVIDIA CUDA acceleration and bitsandbytes quantization
- Pandas data transformation engine for structured financial reconciliation and tabular reports
Zero-Port Sovereign Deployment (SQLite, Nginx & Cloudflare Tunnel)
Engineered for security and operational ease. Medical claims and audit trails reside in an embedded zero-configuration database, safely exposed for auditor review via authenticated Cloudflare Tunnels without opening public firewall ports.
- Serverless zero-configuration SQLite database with native Python sqlite3 ORM
- Nginx high-performance reverse proxy routing API requests and serving React 19 UI
- Cloudflare Tunnel & DNS security managing end-to-end SSL encryption with zero open ports


Architecture at a glance
Before and after
Before
- 3 to 4 weeks of manual paper verification per hospitalization claim batch
- Frequent financial leakage from undetected hospital overbilling and unapproved tests
- Manual CGHS rate book flipping prone to human fatigue and calculation errors
- Disputes over deductions due to lack of transparent, explainable audit breakdowns
After
- Automated claim auditing completed in minutes instead of weeks
- Instant discrepancy detection for overbilling, duplicates, and non-reimbursable items
- Algorithmic CGHS rate application covering NABH tariffs and room rent caps
- Clear, explainable reasoning for every adjustment with human-in-the-loop signoff
What it meant commercially
Dramatic Turnaround Acceleration
Reimbursement processing time collapsed from nearly a month to under an hour, significantly boosting employee and retiree satisfaction across MOIL units.
Zero Financial Leakage
Automated verification against official CGHS rate caps protects MOIL from systemic hospital overcharges, saving millions in unjustified healthcare expenditures.
“The AI Medical Billing POC has demonstrated how automated CGHS rate validation and Document AI can eliminate claim backlogs while ensuring complete transparency and zero leakage.”
Capabilities behind this work
Common questions
How does the system handle handwritten or poorly scanned medical bills?
The ingestion pipeline uses computer vision pre-processing (deskew, contrast enhancement, noise removal) and multi-engine OCR trained on medical typography. When OCR confidence on handwritten text falls below a threshold, the system flags the specific field for human auditor verification.
Can MOIL billing officers override or adjust AI recommendations?
Yes. The system is fundamentally designed around Human-in-the-Loop (HITL) review. Officers can inspect the AI's reasoning, edit adjudicated amounts, add custom notes, and approve or reject claims before final disbursement.
How are changes in the official CGHS Rate List managed?
The CGHS Rate Engine uses a versioned tariff catalog. When the Ministry of Health publishes updated rate circulars or NABH revisions, administrators upload the new tariff schedule without requiring any code changes.
Is any employee healthcare data sent to external cloud APIs?
No. The entire system is engineered for sovereign on-premise deployment. All OCR models, rate databases, and audit logs execute within MOIL's internal data center or private virtual cloud.
Related case studies
Ready to build the future?
Let's discuss how technology can accelerate your business.


