Skip to content

sai-jagdale/MedGuard-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ MedGuard AI: Real-Time Counterfeit & Expired Medicine Detection

πŸ’‘ Overview

MedGuard AI is an intelligent, Django-based web application designed to combat the severe challenge of counterfeit and substandard drugs. It provides a fast, reliable, and multi-modal solution for real-time drug authentication directly at the point of care

The system uses an Agentic AI Workflow to verify medicine authenticity and automatically check for expiry, empowering consumers and healthcare professionals to make informed, instantaneous decisions


✨ Key Features

1. Tri-Input Verification System

Users can verify a drug using three flexible input modes:

  • Text Search (Entering the medicine name)
  • Image Upload (Uploading a photo of the medicine package)
  • Barcode/QR Code Scan (Enabling rapid product identifier retrieval)

2. Agentic AI Workflow

The system is built on specialized, cooperating AI agents orchestrated by the Intake Agent (views.py)

  • OCR Agent: Uses Google Cloud Vision API to accurately extract text from complex packaging.
  • Barcode Agent: Decodes 1D/2D barcodes/QR codes and cross-verifies identifiers with MajorProjectDataset.csv for authenticity
  • Extraction Agent: Uses Regular Expressions (Regex) to isolate key data: MFG Date, EXP Date, and Price (MRP)
  • Search Agent: Employs TheFuzz library for fuzzy string matching, handling spelling or OCR errors
  • Summary Agent: Uses a Local LLM (Ollama - phi-3) to generate a concise, structured summary (8-point or 5-point) of the verified data

3. Automated Safety Check

  • The system automatically compares the extracted Expiry Date against the current date
  • If expired, a clear "⚠️ EXPIRED MEDICINE" warning is issued

4. Multi-User Platform

  • Includes secure login and signup.
  • Offers personalized search history management, allowing users to revisit or delete past verifications

πŸ’» Technologies Used

Category Technology Purpose / Library
Backend Django Framework (Python 3.10+) Multi-user web application foundation
OCR / Vision Google Vision API Image-based text detection
Barcode Pyzbar / OpenCV Decoding 1D/2D Barcodes and QR Codes
LLM / AI Ollama (phi-3-mini) Local LLM for summary generation and RAG core
Fuzzy Matching TheFuzz Handling spelling errors and variations
Data Processing Pandas, NumPy, Regex Data extraction, matching, and manipulation
Database SQLite3 / PostgreSQL Data storage and history tracking
Frontend HTML, CSS, JavaScript, Bootstrap User Interface design

Project File Structure

🌳 Project Structure

This project follows a standard Django structure, organized around the main project folder (medguard_project) and the primary application (medicinebot). The Agentic AI workflow logic is contained within the medicinebot/agents/ directory. MEDGUARD_AI/ β”œβ”€β”€ medguard_project/ # Main Django Project Configuration β”‚ β”œβ”€β”€ init.py β”‚ β”œβ”€β”€ asgi.py β”‚ β”œβ”€β”€ settings.py β”‚ β”œβ”€β”€ urls.py β”‚ └── wsgi.py β”œβ”€β”€ medicinebot/ # Primary Django Application (The core logic) β”‚ β”œβ”€β”€ agents/ # Agentic AI Workflow Implementation β”‚ β”‚ β”œβ”€β”€ barcode_agent.py # Decodes and verifies barcodes/QR codes β”‚ β”‚ β”œβ”€β”€ extraction_agent.py # Regex for MFG, EXP, and Price data β”‚ β”‚ β”œβ”€β”€ ocr_agent.py # Google Cloud Vision API integration β”‚ β”‚ β”œβ”€β”€ search_agent.py # TheFuzz fuzzy matching logic β”‚ β”‚ └── summary_agent.py # Ollama LLM summarization logic β”‚ β”œβ”€β”€ management/ β”‚ β”‚ └── commands/ β”‚ β”œβ”€β”€ migrations/ β”‚ β”œβ”€β”€ static/ β”‚ β”‚ └── medicinebot/ β”‚ β”‚ └── images/ β”‚ β”‚ └── logo.png β”‚ β”œβ”€β”€ templates/ β”‚ β”‚ └── medicinebot/ β”‚ β”‚ β”œβ”€β”€ account-history.html β”‚ β”‚ β”œβ”€β”€ base.html β”‚ β”‚ β”œβ”€β”€ home.html # Tri-input interface β”‚ β”‚ β”œβ”€β”€ login.html β”‚ β”‚ └── signup.html β”‚ β”œβ”€β”€ admin.py β”‚ β”œβ”€β”€ apps.py β”‚ β”œβ”€β”€ forms.py β”‚ β”œβ”€β”€ models.py # Database schemas (e.g., Search History, User) β”‚ β”œβ”€β”€ tests.py β”‚ β”œβ”€β”€ urls.py β”‚ └── views.py # Intake Agent (The Orchestrator) β”œβ”€β”€ ScreenShots/ # Project output and testing screenshots β”œβ”€β”€ .gitattributes β”œβ”€β”€ .gitignore β”œβ”€β”€ gcloud_key.json # Google Cloud Vision API Credentials β”œβ”€β”€ MajorProjectDataset.csv # Local knowledge base for verification β”œβ”€β”€ db.sqlite3 # Local Development Database β”œβ”€β”€ manage.py # Django Command Utility β”œβ”€β”€ requirements.txt # Python Dependencies └── venv/ # Python Virtual Environment

License

This repository is licensed under the All Rights Reserved terms.
You are free to view the code, but reproduction, modification, or reuse is not permitted without permission.

Credits Built by Sai Jagdale ✨

About

MedGuard AI is an intelligent 🧠, Django-based web app that uses a multi-agent AI workflow (OCR, Barcode, LLM) to instantly verify medicine authenticity, check for expiry ⚠️, and generate clear safety summaries for consumers and healthcare professionals.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors