MedClear is a Flask-based web application designed to simplify the understanding of lab reports, prescriptions, and combined medical documents. It extracts text from PDFs and images, organizes the content using a Groq-powered language model, translates the results into the user’s preferred language, supports follow-up queries, and allows the final analysis to be exported as a PDF.
Medical disclaimer: MedClear is for education and readability only. It does not replace a licensed doctor, pharmacist, radiologist, or emergency service.
It currently supports:
- Uploading or pasting medical report text.
- Extracting text from:
- PDF files
- PNG / JPG / JPEG images
- TIFF / TIF images
- BMP images
- Detecting whether a document is primarily:
- a lab report
- a prescription
- a combined report
- or a more general medical document
- Generating a structured explanation with:
- overall assessment
- severity tag
- extracted lab results
- highlighted findings
- medications and patient notes
- lifestyle suggestions
- summary
- translated report output
- Supporting bilingual follow-up answers:
- the app answers in English first
- then adds the selected-language translation when applicable
- Allowing one-click PDF export of the generated evaluation.
- Supporting dark mode and light mode in the UI.
MedClear extracts text before sending anything to the LLM:
- PDFs are processed with PyMuPDF.
- Images are processed with Pillow + pytesseract OCR.
- On Windows, the app checks common Tesseract install paths automatically.
The backend asks the model to return strict JSON with fields for:
report_typepatientoverall_assessmentseveritylab_resultsfindingsmedicationslifestyle_changessummaryfollow_up_suggestionsdisclaimertranslated_report
The current UI includes:
- upload / paste workflow
- report mode indicator
- patient detail cards
- lab review table with status colors
- prescription review cards
- findings section
- lifestyle section
- summary section
- translated report section
- follow-up question workflow
- PDF download button
MedClear currently exposes these output languages from the backend:
- English
- Hindi
- Spanish
- French
- German
- Arabic
- Tamil
- Telugu
- Bengali
- Marathi
- Gujarati
- Kannada
- Malayalam
- Punjabi
- Urdu
- Chinese (Simplified)
- Japanese
- Portuguese
- Russian
- Korean
- Python
- Flask
- Flask-CORS
- python-dotenv
- PyMuPDF
- Pillow
- pytesseract
- Groq Python SDK
- HTML
- CSS
- Vanilla JavaScript
The app currently defaults to:
llama-3.3-70b-versatile
This can be changed through the LLM_MODEL environment variable.
MedClear/
├── app.py
├── requirements.txt
├── README.md
├── templates/
│ └── index.html
└── static/
├── css/
│ └── style.css
└── js/
└── app.js
Install or prepare the following before running the app:
- Python 3.10+ recommended
- pip
- Tesseract OCR if you want image OCR support
- A Groq account
- A Groq API key
git clone https://github.com/ThisWasAryan/MedClear.git
cd MedClearpython3 -m venv .venv
source .venv/bin/activatepython -m venv .venv
.venv\Scripts\Activate.ps1If PowerShell blocks activation, run:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypasspip install -r requirements.txtYou need a Groq API key before the app can analyze reports.
- Create or sign in to your Groq account.
- Open the Groq Console keys page:
https://console.groq.com/keys - Create a new API key.
- Copy the key immediately.
Official Groq docs also reference using GROQ_API_KEY as the environment variable name and recommend keeping keys in environment variables or secret managers, not in frontend code.
Sources:
- https://console.groq.com/docs
- https://console.groq.com/docs/production-readiness/security-onboarding
After cloning the repo, this is the step where you should paste your Groq key.
- Open
.env - Find the
GROQ_API_KEY=line - Replace the placeholder / empty value with your real Groq key
- Save the file
- Then proceed to running the app
Do not commit your real .env file to GitHub.
python app.pyThe local development server runs at:
http://127.0.0.1:5000
- Open MedClear in your browser.
- Upload a file or paste medical text.
- Choose the output language.
- Click Generate evaluation.
- Review the result sections:
- overall assessment
- patient details
- report mode
- lab review
- prescription review
- key findings
- lifestyle changes
- summary
- translated report
- Ask follow-up questions if needed.
- Download the evaluation as a PDF.
Returns the main web UI.
Returns the supported output languages.
Returns API/server status and whether the Groq key is configured.
Uploads a file, extracts text, and returns:
- filename
- extracted text
- character count
- word count
Accepts JSON input and returns the structured AI evaluation.
Example payload:
{
"text": "medical report text here",
"language_code": "hi",
"language_name": "Hindi"
}Alias route for direct text analysis.
Answers a follow-up question grounded in the existing structured analysis.
MedClear works well for many simple and medium-complexity reports, but there are still important limitations:
- OCR quality depends heavily on image clarity.
- Large reports can still be truncated before analysis.
- The LLM may miss tests, ranges, or medication details in noisy documents.
- The app is not a diagnostic system.
- The PDF export uses browser print behavior, so final styling can vary slightly by browser.
- Follow-up answers are grounded in the generated analysis, so errors in the original extraction can carry forward.
- Very complex hospital records, pathology reports, or highly specialized reports may need manual review.
Depending on environment and machine setup:
- OCR may fail if Tesseract is not installed correctly.
- The Groq SDK must be available in the Python environment.
- If
GROQ_API_KEYis missing or invalid, AI analysis will not run. - Proxy-restricted environments may fail to install or call dependencies/services.
Suggested next steps for the project:
- add automated tests for backend routes and prompt parsing
- add stronger validation for extracted lab values and ranges
- support chunking / merging for very long reports
- improve OCR preprocessing for low-quality scans
- add authentication and audit controls for real deployments
- add stricter PDF export formatting independent of browser print dialogs
- add optional model switching in the UI for complex reports
- add structured monitoring for failed extractions and invalid AI output
MedClear is an educational assistant.
It should not be used:
- as a substitute for a licensed clinician
- for emergency triage
- for medication changes without medical supervision
- as the only basis for interpreting a serious lab abnormality
If a report appears urgent, critical, or alarming, the user should contact a qualified medical professional immediately.
MedClear is a Groq-powered, structured medical-report review tool with:
- PDF/image/text intake
- OCR and PDF extraction
- lab + prescription aware output
- translated summaries
- bilingual follow-up answers
- PDF export
- dark/light theme support
- a cleaner clinical UI