Skip to content

Adarsh290406/CareMate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Š CareMate AI

An AI-first medication adherence platform for patients, caregivers, and doctors β€” combining real-time health monitoring, computer vision pill identification, predictive non-adherence detection, and a full family care ecosystem.

React Firebase Gemini Groq PWA


🌍 The Problem

Medication non-adherence costs the healthcare system billions annually and is a leading cause of preventable hospitalizations. For elderly patients, chronic disease sufferers, and families managing care across distances β€” tracking medications, identifying pills, and catching missed doses before they become emergencies is brutally hard.

CareMate AI solves this end-to-end: from pill identification via camera to AI-predicted non-adherence before it happens.


✨ Key Features

πŸ€– AI & Intelligence

# Feature Model
7 Real-time Risk Score Engine Groq Llama 3
8 Predictive Non-Adherence Detection Groq AI
9 Drug Interaction Checker Groq JSON Mode
11 Weekly AI Health Narrative Groq AI
17 Anomaly Explainer ("Why is my score low?") Groq AI
18 Missed Dose Impact Simulator Groq AI
19 Personalized Schedule Optimizer Groq AI
23 Pill Photo Identification Gemini 1.5 Flash Vision
25 Pre-Appointment Doctor Summary Groq AI
30 Prescription OCR Scanner Gemini 1.5 Flash Vision
39 Medication Encyclopedia Groq AI
42 Brand β†’ Generic β†’ Composition Converter Groq AI
44 Pill Verification from Photo Gemini Vision

🏠 Patient Dashboard

  • Real-time health & risk scores with animated progress rings
  • Daily medication adherence streak tracking
  • AI-generated daily briefings
  • Smart refill alerts and low-stock warnings
  • Emergency SOS with AI-generated paramedic summary
  • Voice command mode (mark doses, query schedule)

πŸ‘¨β€πŸ‘©β€πŸ‘§ Care Ecosystem

  • Family Circle β€” Invite caregivers & family members
  • In-App Chat β€” Secure messaging between patient and caregiver
  • Remote Medication Management β€” Caregivers can view/edit patient medications
  • Live Alerts β€” Real-time missed dose notifications across the care network
  • Video Call β€” Video link integration for patient-caregiver consultations

πŸ₯ Doctor Dashboard

  • Population-wide adherence analytics
  • Patient risk score surveillance
  • Critical intervention AI nudges
  • Prescription management and editing
  • Patient detail modals with embedded medical history

πŸ†˜ Emergency Tools

  • Emergency QR Medical ID (offline-safe)
  • AI-generated paramedic briefing on SOS trigger
  • Emergency QR Lockscreen Wallpaper generator
  • Public emergency profile URL (/emergency-profile/:id)

πŸ“± PWA & Accessibility

  • Full Progressive Web App with offline support
  • Push notification reminders
  • Elderly Mode β€” large fonts, simplified UI
  • Multi-language support (English / Hindi)
  • Dark mode with system preference detection
  • PDF report export

πŸ—οΈ Tech Stack

Layer Technology
Frontend React 19 + TypeScript + Vite
Styling Tailwind CSS v4 + Custom Design System
Animations Motion (Framer Motion)
Backend / Database Firebase Firestore (real-time)
Auth Firebase Authentication
Storage Firebase Storage
AI β€” Vision Google Gemini 1.5 Flash
AI β€” Logic / Chat Groq Llama 3 70B (8192 ctx)
PWA vite-plugin-pwa + Workbox
Charts Recharts
PDF jsPDF
QR Codes qrcode.react
Server Express + tsx

πŸ‘₯ User Roles

CareMate supports three distinct roles, each with tailored onboarding and a dedicated dashboard:

Role Description Dashboard
Patient Primary user managing their own medications Home Dashboard
Caregiver Family member or nurse monitoring a patient remotely Care Network
Doctor Healthcare provider with population-level analytics Medical Command

πŸ“Š Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              CareMate PWA               β”‚
β”‚         (React + Vite + TSX)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚                β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚Firebase β”‚    β”‚   AI Layer  β”‚
β”‚Firestoreβ”‚    β”‚             β”‚
β”‚  Auth   β”‚    β”‚ Gemini 1.5  β”‚ ← Vision (Pill ID, OCR)
β”‚ Storage β”‚    β”‚   Flash     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚             β”‚
               β”‚  Groq Llama β”‚ ← Logic (Risk, Chat, Drugs)
               β”‚    3 70B    β”‚
               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Getting Started

Prerequisites

1. Clone & Install

git clone https://github.com/YOUR_USERNAME/caremate-ai.git
cd caremate-ai
npm install

2. Configure Environment Variables

cp .env.example .env

Edit .env:

GEMINI_API_KEY=your_gemini_api_key
GROQ_API_KEY=your_groq_api_key
APP_URL=http://localhost:3000

3. Configure Firebase

cp firebase-applet-config.example.json firebase-applet-config.json

Edit firebase-applet-config.json with your Firebase project details:

{
  "projectId": "your-project-id",
  "appId": "your-app-id",
  "apiKey": "your-firebase-web-api-key",
  "authDomain": "your-project.firebaseapp.com",
  "firestoreDatabaseId": "(default)",
  "storageBucket": "your-project.firebasestorage.app",
  "messagingSenderId": "your-sender-id",
  "measurementId": ""
}

4. Deploy Firestore Security Rules

npx firebase-tools deploy --only firestore:rules

5. Run

npm run dev
# App available at http://localhost:3000

πŸ”‘ API Key Setup

Gemini (Vision AI β€” pill identification & OCR)

  1. Go to Google AI Studio
  2. Click Create API Key
  3. Paste into GEMINI_API_KEY in your .env

Groq (Fast text AI β€” risk scores, chat, drug interactions)

  1. Go to Groq Console
  2. Click Create API Key
  3. Paste into GROQ_API_KEY in your .env

Firebase

  1. Go to Firebase Console
  2. Create a new project
  3. Enable Authentication β†’ Email/Password
  4. Create a Firestore Database (start in test mode, then apply the included rules)
  5. Go to Project Settings β†’ Web App and copy the config values

πŸ“ Project Structure

caremate-ai/
β”œβ”€β”€ public/                         # PWA assets (icons, manifest)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/                 # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ AddMedModal.tsx         # Add medication with AI interaction check
β”‚   β”‚   β”œβ”€β”€ MainLayout.tsx          # App shell with bottom navigation
β”‚   β”‚   β”œβ”€β”€ NotificationCenter.tsx  # Real-time alert popover
β”‚   β”‚   β”œβ”€β”€ Onboarding.tsx          # Multi-step registration (all 3 roles)
β”‚   β”‚   └── PillReminderOverlay.tsx # Dose reminder push overlay
β”‚   β”œβ”€β”€ hooks/                      # Firebase real-time data hooks
β”‚   β”‚   β”œβ”€β”€ useAuth.ts
β”‚   β”‚   β”œβ”€β”€ useMedications.ts
β”‚   β”‚   β”œβ”€β”€ useMedSchedule.ts
β”‚   β”‚   β”œβ”€β”€ useAlerts.ts
β”‚   β”‚   └── useRiskScore.ts
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ firebase.ts             # Firebase initialization
β”‚   β”‚   β”œβ”€β”€ gemini.ts               # All AI functions (Gemini + Groq)
β”‚   β”‚   └── utils.ts                # Utility helpers
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ Home.tsx                # Patient dashboard
β”‚   β”‚   β”œβ”€β”€ Meds.tsx                # Medication management
β”‚   β”‚   β”œβ”€β”€ DoctorDashboard.tsx     # Doctor command center
β”‚   β”‚   β”œβ”€β”€ CaregiverDashboard.tsx  # Caregiver care network
β”‚   β”‚   β”œβ”€β”€ PillScanner.tsx         # Vision AI pill identifier
β”‚   β”‚   β”œβ”€β”€ PrescriptionOCR.tsx     # OCR prescription scanner
β”‚   β”‚   β”œβ”€β”€ DrugConverter.tsx       # Brand-to-generic converter
β”‚   β”‚   β”œβ”€β”€ DoseSimulator.tsx       # Missed dose impact simulator
β”‚   β”‚   β”œβ”€β”€ ScheduleOptimizer.tsx   # AI schedule optimizer
β”‚   β”‚   β”œβ”€β”€ Encyclopedia.tsx        # Medication encyclopedia
β”‚   β”‚   β”œβ”€β”€ FamilyCircle.tsx        # Family monitoring
β”‚   β”‚   β”œβ”€β”€ FamilyChat.tsx          # In-app messaging
β”‚   β”‚   β”œβ”€β”€ VoiceAssistant.tsx      # Voice command interface
β”‚   β”‚   β”œβ”€β”€ EmergencyQR.tsx         # Emergency QR Medical ID
β”‚   β”‚   └── Profile.tsx             # Settings & profile
β”‚   └── services/
β”‚       β”œβ”€β”€ aiService.ts            # Higher-level AI service layer
β”‚       └── notificationService.ts  # Push notification helpers
β”œβ”€β”€ functions/
β”‚   └── src/index.ts                # Firebase Cloud Functions (missed dose detection)
β”œβ”€β”€ firestore.rules                 # Firestore security rules
β”œβ”€β”€ .env.example                    # Environment variable template
β”œβ”€β”€ firebase-applet-config.example.json
└── vite.config.ts                  # Vite + PWA configuration

πŸ”’ Security

  • All Firestore reads/writes enforced by firestore.rules
  • API keys are server-side only β€” never exposed to the client
  • Firebase Authentication required for all data access
  • Role-based access control for doctor/caregiver data queries
  • Emergency QR profile is public but contains only non-sensitive summary data

πŸ§ͺ Scripts

npm run dev      # Start development server (localhost:3000)
npm run build    # Build for production
npm run start    # Start production server
npm run lint     # TypeScript type checking
npm run clean    # Remove dist folder

πŸ™ Acknowledgements

  • Google Gemini β€” Vision AI for pill identification and OCR
  • Groq β€” Ultra-fast LLM inference for real-time health analytics
  • Firebase β€” Real-time database, auth, and cloud functions
  • Lucide React β€” Icon library
  • Motion β€” Animation library

πŸ“„ License

MIT License β€” see LICENSE for details.


CareMate AI β€” Taking the guesswork out of health management.

About

crop disease detection using ResNet-18 | 89% accuracy | SIH 2025

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages