Skip to content

A smart prescription analysis tool that uses Google Vision and HuggingFace NER to extract medical data. It verifies prescriptions against a custom dataset for dosage and age safety, checks for drug interactions with IBM Watson, and generates patient-friendly summaries. Built with a Streamlit frontend and FastAPI backend.

Notifications You must be signed in to change notification settings

Risspecct/Medify

Repository files navigation

⚕️ Medify – AI-Powered Prescription Analyzer

An intelligent healthcare assistant that extracts, analyzes, verifies, and summarizes medical prescriptions using AI, machine learning, and cloud services.


🚀 Features

🔍 Prescription Analysis

  • OCR with Google Cloud Vision API

    • Extracts text from uploaded or captured prescription images.
    Screenshot 2025-08-30 132053
  • Biomedical Named Entity Recognition (NER) with HuggingFace Transformers

    • Identifies medications, dosages, and symptoms from free-text prescriptions.
    image

🧪 Drug Interaction Analysis

  • AI-powered backend using Google Gemini (Generative AI).
  • Detects potential drug–drug interactions with structured risk levels (🔴 High, 🟡 Moderate, 🟢 Low). Screenshot 2025-08-30 132157

✅ Prescription Verification

  • Matches medications against a curated dosage dataset.

  • Verifies:

    • Symptom appropriateness
    • Age safety
    • Dosage safety (mg/kg)
Screenshot 2025-08-30 132328 image

📊 Dosage Guidelines

  • Fetches standardized dosage ranges, intervals, and safety notes from dataset.
  • Personalized to patient’s age and weight.
Screenshot 2025-08-30 132510

🌿 Alternatives & Remedies

  • Suggests alternative medications.
  • Provides home remedies for common conditions from an internal knowledge base.
Screenshot 2025-08-30 132546

🤖 AI-Powered Summary

  • Generates a final patient-friendly report consolidating:

    • Verification results
    • Dosage guidelines
    • Alternative remedies
  • Uses Google Gemini summarization for clear, simple medical summaries.

Screenshot 2025-08-30 132625

🏗️ Tech Stack

  • 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:

    • pandas for data processing
    • requests for API calls
    • dotenv for environment management

📂 Project Structure

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

⚙️ Setup & Installation

1️⃣ Clone Repo

git clone https://github.com/Risspecct/Medify.git
cd medify

2️⃣ Create Virtual Environment

python -m venv venv
source venv/bin/activate   # Mac/Linux
venv\Scripts\activate      # Windows

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Configure Environment

Copy .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.csv

5️⃣ Run Backend

cd backend
uvicorn main:app --reload

API will be available at: http://127.0.0.1:8000/docs

6️⃣ Run Frontend

streamlit run frontend/app.py

📖 Usage Flow

  1. Upload a prescription (image, photo, or text).
  2. Extract entities (NER + OCR).
  3. Run Drug Interaction Check.
  4. Perform Manual Verification with dataset.
  5. Fetch Dosage Guidelines.
  6. Explore Alternatives & Remedies.
  7. Generate a Final AI-Powered Summary.

⚠️ Disclaimer

This tool is for educational and research purposes only. It is not a substitute for professional medical advice. Always consult a qualified doctor before taking any medication.

About

A smart prescription analysis tool that uses Google Vision and HuggingFace NER to extract medical data. It verifies prescriptions against a custom dataset for dosage and age safety, checks for drug interactions with IBM Watson, and generates patient-friendly summaries. Built with a Streamlit frontend and FastAPI backend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •