This project is a comprehensive solution developed in 24 hours as part of a hackathon. It enables families to manage and receive medicine reminders for their members, using OCR-based prescription processing and an integrated scheduling system that sends voice reminders through Google Home speakers. The system uses Next.js, FastAPI, MongoDB, Python scripts, and various APIs to provide a seamless experience for users.
- User-friendly Web App: Built using Next.js and TailwindCSS, the frontend allows users to manage their family members' medicine schedules and prescriptions.
- OCR and Speech-to-Text for Prescriptions: The app supports both image-based OCR (using EasyOCR) and voice dictation for prescription entry, which is processed by the Gemini API to extract relevant details like medicine name, dosage, and frequency.
- Medicine Scheduling: The system stores medicine schedules for each family member and integrates with Google Home to send voice reminders without requiring the wake word.
- Decentralized Schedule Management: Medicine schedules and family details are stored in a local
schedule.jsonfile, which is synced with the MongoDB Atlas cloud for persistence. - Scheduler Script: A Python-based scheduler reads from the
schedule.jsonfile and triggers reminders at specified times, sending them to the Google Home speaker via Home Assistant. - Admin and User Flow: Admins can manage schedules for different family members, adding, viewing, and modifying medicine routines via an intuitive interface.
- Frontend: Next.js, TailwindCSS, GSAP (for animations)
- Backend: FastAPI (Python)
- Database: MongoDB Atlas (NoSQL Cloud DB)
- OCR & APIs:
- EasyOCR (for text extraction from images)
- Speech to Text for Audio Input of Prescriptions
- Gemini API (for parsing medicine details from OCR and speech)
- Scheduler: Python script that reads the
schedule.jsonfile and creates reminders - Home Automation: Home Assistant API integration for Google Home speaker
- Authentication: Custom authentication flow for users to securely log in and manage family data
- Users interact via the web app, which provides:
- Family member management
- Prescription uploading (via OCR or voice)
- Viewing and editing medicine schedules
- Animated UI elements for a smooth user experience
- The FastAPI server handles:
- OCR: Uploading prescriptions and extracting text using EasyOCR which is then processed with Gemini API.
- Speech-to-Text: Receiving transcribed text from voice dictation and processing it with Gemini API.
- JSON Management: Maintaining and updating the
schedule.jsonfile, which holds user, family, and medicine schedule data. - Sync with MongoDB: Storing medicine schedules in MongoDB Atlas for persistence.
- A separate Python script reads from the
schedule.jsonfile and creates reminders for each family member at the appropriate times. - Integrates with Home Assistant to push reminders to a Google Home speaker using the Google Cast API, allowing the speaker to announce the medicine reminders without the wake word.
The schedule.json file is the backbone of the system, storing all user and medicine data in a structured format:
{
"user_email@example.com": {
"family_members": {
"family_member_name": {
"dob": "YYYY-MM-DD",
"meal_times": {
"breakfast": "HH:MM",
"lunch": "HH:MM",
"dinner": "HH:MM"
},
"schedules": [
{
"medicine": "Medicine Name",
"dosage": "Dosage Info",
"times": ["HH:MM", "HH:MM"]
}
]
}
}
}
}- User: Stores user profile, email, and linked family members.
- Members: Stores information about family members of a certain user - like their name, mealtimes and so on.
- Medicine: Stores medicines linked to family members with fields for name, dosage, times, etc.
- Node.js (for Next.js)
- Python 3.8+ (for FastAPI and Python scripts)
- MongoDB Atlas account (or local MongoDB instance)
- Home Assistant setup (with Google Home speaker integration)
-
Clone the repository:
git clone https://github.com/username/repo-name.git cd interface npm install -
Configure environment variables: Create a
.env.localfile and add your MongoDB Atlas connection string, FastAPI URL, and other secrets:NEXTAUTH_URL=http://localhost:8000 NEXTAUTH_SECRET= MONGODB_URI=mongodb+srv://your_mongodb_atlas_connection_string GEMINI_API=Gemini_API_KEY GOOGLE_CLIENT_ID GOOGLE_CLIENT_SECRET
-
Start the development server:
npm run dev
- Move into the backend directory:
cd model - Install dependencies:
pip install easyocr pydantic schedule uvicorn google.generativeai opencv pymongo bson
- Start the FastAPI server:
python server.py
- Ensure the scheduler can access the
schedule.jsonfile. - Run the script:
python scheduler.py
- Follow the Home Assistant setup guide to integrate with Google Home speakers.
- Once setup, ensure that the Home Assistant API is accessible by FastAPI.
- To test the system, start both the frontend and backend, then upload a prescription or dictate medicine instructions via the web app.
- Verify that:
- The OCR and Gemini API successfully process the input.
- Medicine schedules are stored in MongoDB and
schedule.json. - Reminders are triggered on Google Home as per the schedule.
For detailed API documentation, visit:
- FastAPI: Once the server is running, navigate to
http://localhost:8000/docsto see auto-generated API docs.
- Ensure environment variables containing sensitive information are not committed to version control.
- Use HTTPS for secure data transmission in production.
- Authentication Enhancements: Implement OAuth for enhanced security.
- Mobile App: Create a mobile app version of the web app.
- Multiple Languages: Add support for multiple languages for voice reminders.
We welcome contributions! Please read the contributing guidelines for details.
- Kabeer Ahmed Merchant
- Varad Deshpande
- Sushant Jadhav