Note: This project is a Capstone Project for Seneca College. Disclaimer: This software is provided for educational purposes only as part of a student capstone project. It is not intended for medical, diagnostic, or commercial use. Use at your own risk.
MedScan is a local-first medication management application designed to help elderly users manage their medications safely and effectively. The system uses computer vision to identify pills and OCR to read prescription information.
- π― Pill detection using YOLOv8
- π Prescription text extraction using Tesseract OCR
- β° Medication reminders and scheduling
- π΄ Senior-friendly user interface
- πΎ Local-first operation (no cloud dependencies)
- π± Offline functionality
- π Excel-based history tracking with JSON backup
- π Comprehensive logging system
- π Synchronized data storage
medscan/
βββ frontend/ # Frontend application
β βββ index.html # Main page
β βββ scan.html # Pill scanning page
β βββ reminder.html # Reminder settings page
β βββ history.html # Medication history page
β βββ static/ # Static assets
β βββ style.css # Main stylesheet
β βββ script.js # Frontend JavaScript
β
βββ backend_flask/ # Flask backend application
β βββ app.py # Main Flask application
β βββ requirements.txt # Python dependencies
β βββ utils/ # Utility modules
β βββ predict.py # Pill detection logic
β βββ ocr.py # Prescription text extraction
β βββ history_manager.py # History tracking with sync
β βββ train_yolo.py # YOLOv8 training script
β
βββ models/ # ML models
β βββ yolov8/ # YOLOv8 models
β
βββ memory/ # Local storage
β βββ medication_history.xlsx # Excel history file
β βββ medication_history.json # JSON backup file
β
βββ README.md # This file
- Python 3.8 or higher
- Tesseract OCR installed on your system
- Webcam or camera for pill scanning
- Modern web browser
- Clone the repository:
git clone https://github.com/Masoud-Masoori/MedScan.git
cd MedScan- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
cd backend_flask
pip install -r requirements.txt- Install Tesseract OCR:
- Windows: Download and install from https://github.com/UB-Mannheim/tesseract/wiki
- Linux:
sudo apt-get install tesseract-ocr - macOS:
brew install tesseract
- Start the Flask server:
cd backend_flask
python app.py- Open your web browser and navigate to:
http://localhost:5000
- Use the application:
- Click "Scan Pill" to identify a medication
- Set reminders for medication times
- View medication history
- Export history to Excel
- Uses YOLOv8 for accurate pill identification
- Works with various pill shapes and colors
- Provides confidence scores
- Real-time detection with webcam support
- Extracts text from prescription images
- Identifies medication names, dosages, and instructions
- Supports multiple prescription formats
- Set custom medication schedules
- Daily, weekly, or custom frequency
- Visual and audio notifications
- Excel-based storage for medication history
- JSON backup for data redundancy
- Automatic synchronization between storage formats
- Status tracking (taken/pending)
- Export functionality
- Comprehensive logging system for debugging
- Automatic synchronization between Excel and JSON formats
- Backup system to prevent data loss
- Logging system for tracking operations
- Error handling and recovery
The application includes a comprehensive logging system that tracks:
- Application startup and shutdown
- Pill detection operations
- History management operations
- File synchronization events
- Error conditions and recovery attempts
Logs can be found in the application's console output and can be redirected to a file if needed.
The application includes robust error handling for:
- File operations
- Data synchronization
- Pill detection
- OCR processing
- History management
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- YOLOv8 by Ultralytics
- Tesseract OCR
- Flask framework
- Python logging system