An intelligent healthcare assistant that extracts, analyzes, verifies, and summarizes medical prescriptions using AI, machine learning, and cloud services.
Extracts text from prescription images using Google Cloud Vision API and identifies key medical entities like medications, dosages, and symptoms using a HuggingFace Biomedical NER model.
- AI-powered backend using Google Gemini (Generative AI).
- Detects potential drugβdrug interactions with structured risk levels (π΄ High, π‘ Moderate, π’ Low).

Cross-references prescription details against a curated medical dataset to verify:
- Symptom Appropriateness: Checks if the medication is a valid treatment for the indicated symptom.
- Age Safety: Ensures the patient's age is within the recommended range for the drug.
- Dosage Safety: Validates the prescribed dosage (in mg/kg) against safe limits.
Fetches standardized dosage ranges, intervals, and critical safety notes for a given medication, personalized to the patientβs age.
Suggests alternative medications and provides relevant home remedies for common conditions, sourced from an internal knowledge base.
-
Generates a final patient-friendly report consolidating:
- Verification results
- Dosage guidelines
- Alternative remedies
-
Uses Google Gemini summarization for clear, simple medical summaries.
-
Frontend: Streamlit
-
Backend: FastAPI
-
AI Models: HuggingFace Transformers (
d4data/biomedical-ner-all), Google Gemini (Generative AI) -
OCR: Google Cloud Vision API
-
Dataset:
dosage.csv+ curated alternative medicines dataset -
Other Libraries:
pandasfor data processingrequestsfor API callsdotenvfor environment management
medify/
βββ README.md
βββ docker-compose.yml
βββ render.yaml
βββ .env.example
β
<<<<<<< Updated upstream
βββ backend/ # FastAPI backend
β βββ Dockerfile
β βββ requirements.txt
β βββ main.py # Entry point for backend
β βββ data_processors/ # Data preprocessing utilities
β β βββ dosage.py
β β βββ prescription.py
β βββ routers/ # API routes
β β βββ ai_router.py
β β βββ drug_info.py
β βββ watson_ai/ # IBM Watson AI integration
β βββ ai_config.py
β βββ interactions.py
β βββ summarizer.py
=======
βββ backend/
β βββ main.py # FastAPI entrypoint
β βββ routers/ # API endpoints
β βββ data_processors/ # Dosage & prescription validation
β βββ watson_ai/ # Gemini AI integration (Gemini client lives here)
>>>>>>> Stashed changes
β
βββ datasets/ # Project datasets
β βββ alt_dataset.py
β βββ dosage.csv
β βββ ner_dataset.py
β
βββ frontend/ # Streamlit/Frontend app
βββ Dockerfile
βββ requirements.txt
βββ app.py # Entry point for frontend
βββ features/ # Core frontend features
βββ ai_services.py
βββ alternative.py
βββ ner.py
βββ ocr.py
βββ verification_client.py
git clone https://github.com/Risspecct/Medify.git
cd medifyCopy the example environment file and fill in your API keys and configuration details.
cp .env.example .envUpdate the .env file with your credentials:
# For backend/main.py
WATSON_API_KEY="your_watson_api_key"
WATSON_PROJECT_ID="your_watson_project_id"
WATSON_URL="your_watson_region_url"
DOSAGE_FILE_PATH="datasets/dosage.csv"
# For frontend/app.py
FAST_API_URL="http://127.0.0.1:8000"
GCP_SERVICE_ACCOUNT_JSON='{...your_gcp_json...}'This is the easiest way to start both the frontend and backend services.
docker-compose up --build- Streamlit Frontend: http://localhost:8501
- FastAPI Backend Docs: http://localhost:8000/docs
Click to view manual setup instructions
python -m venv venv
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activateInstall dependencies for both the frontend and backend:
pip install -r frontend/requirements.txt
pip install -r backend/requirements.txtCopy .env.example β .env and set:
GENAI_API_KEY=your_genai_api_key
GEMINI_MODEL_ID=models/gemini-1.5
FAST_API_URL=http://127.0.0.1:8000
DOSAGE_FILE_PATH=datasets/dosage.csvcd backend
uvicorn main:app --reloadstreamlit run frontend/app.py- Upload Prescription: Start by uploading an image, taking a photo, or pasting text from a prescription.
- Extract Entities: OCR + NER to identify medications, symptoms, and dosages.
- Check Drug Interactions: AI-powered interaction risk check.
- Verify Prescription: Validate symptoms, age safety, and dosage.
- Fetch Guidelines: Get standardized dosage info.
- Find Alternatives: Explore alternatives & home remedies.
- Generate Summary: AI-generated, patient-friendly report.
This tool is for educational and research purposes only. It is not a substitute for professional medical advice. Always consult a qualified doctor before making any healthcare decisions.