-
MediPlain (English): Deterministic Python extraction of 11 lab tests with color-coded status pills and exact PDF source lines.
-
Plain-language summary, Questions to Ask Your Doctor, and hands-free gTTS audio playback.
-
Full native-script Marathi (Devanagari) UI localization—from sidebar controls and disclaimer to status badges and table headers.
-
Localized Marathi plain-language explanation, doctor questions, and spoken regional audio.
Inspiration
Diagnostic lab reports are the first step in almost every medical decision, yet they are written for pathologists rather than patients. Reports arrive as dense, multi-column PDFs packed with clinical abbreviations (HbA1c, TSH, LDL, Serum Creatinine), unfamiliar units, and lab-specific reference intervals. In India—where roughly 89% of the population does not speak English (2011 Census)—patients and elderly caregivers often leave clinics anxious or paste sensitive lab PDFs into generic AI chatbots.
Standard LLMs fail dangerously here: they misalign multi-column PDF tables, hallucinate decimal values, substitute generic internet reference ranges instead of the lab's printed interval, and blur the line between plain-language education and unsafe medical diagnosis. We built MediPlain to prove that healthcare AI can be hallucination-safe, auditable, and accessible in regional Indian languages.
What it does
MediPlain converts digital diagnostic lab PDFs into verified, plain-language health summaries across 8 Indian languages in native scripts, complete with hands-free audio narration:
- Verified Lab Values Table: Displays every extracted test name, measured value, printed range, computed status badge (
Normal,Low, orHigh), and the verbatim PDF Source Line for instant verification. - 1-Click Sample Reports: Includes built-in CBC & Lipid Panel and Diabetes & Thyroid samples for immediate testing.
- Plain-Language Summary & Doctor Prep: Explains what each biomarker measures in everyday terms and generates 4 tailored questions for the patient to ask their licensed doctor.
- Hands-Free Audio: Generates spoken audio playback so elderly or low-literacy users can listen to their summary hands-free.
How we built it
MediPlain follows a strict "deterministic-first, AI-second" architecture that separates mathematical truth from language generation:
- Deterministic PDF Extraction (
Python+pdfplumber): Parses raw text directly from the uploaded PDF to extract each test name, numeric value (v), unit, and printed reference interval ([L, U]), preserving the exact source line. - Mathematical Range Flagging: Before any AI model is called, Python evaluates each value deterministically: $$v < L \implies \text{Low}, \qquad L \le v \le U \implies \text{Normal}, \qquad v > U \implies \text{High}$$
- Constrained LLM Translation (
Gemini 3.8 Flash): Only the verified, de-identified JSON—never raw unparsed PDF text—is passed to Gemini under strict non-diagnostic system guardrails to produce calm, educational explanations and doctor questions. - Offline Glossary Fallback & Localization: If no API key is configured or the network drops, a built-in deterministic medical glossary takes over automatically. The full UI, status badges, and
gTTSaudio output adapt across 8 Indian languages (English, Marathi, Hindi, Telugu, Tamil, Bengali, Gujarati, and Kannada).
Challenges we ran into
- Messy multi-column lab PDFs: Real diagnostic reports vary widely in spacing, units, and range formatting, requiring careful regex and line-level parsing in
pdfplumberso values never drift across rows. - Model deprecation mid-build:
gemini-2.5-flashreturned404during testing, so we migrated the pipeline togemini-3.8-flashand strengthened the offline glossary fallback so the app remains 100% functional without an API key. - Full native-script localization: Translating only the summary wasn't enough—we refactored the entire Streamlit interface, sidebar controls, status pills, and audio player into native Indian scripts (such as Devanagari for Marathi and Hindi) so non-English users can navigate end-to-end.
What we learned
- In high-stakes domains like healthcare, LLMs should never do math or extract critical numbers from raw PDFs—deterministic code should own the facts, while LLMs handle empathy and plain-language communication.
- Showing the verbatim PDF Source Line next to every AI-explained value builds immediate trust for both patients and clinicians.
What's next for MediPlain
- OCR support for scanned or phone-photographed paper lab reports.
- Offline neural TTS (such as lightweight regional voice models) for zero-connectivity clinic kiosks.
- Longitudinal trend tracking across multiple uploaded reports to help patients visualize biomarker changes before follow-up visits.
Built With
- accessibility
- gemini
- google-gemini-api
- gtts
- healthcare
- multilingual
- natural-language-processing
- pdfplumber
- python
- responsible-ai
- streamlit