Skip to content

codesbysuraj/GramHealth-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฅ GramHealth AI

A multilingual healthcare platform providing AI-powered symptom analysis, doctor appointments, medicine ordering, and voice-enabled health assistance for rural communities.

โœจ Features

๐Ÿค– AI Health Assistant

  • Real-time Symptom Analysis: AI-powered analysis using OpenRouter/Gemini
  • Voice Agent: Voice-enabled health consultation via WebSocket
  • Urgency Detection: Automatic triage (Low/Medium/High/Emergency)
  • Chat History: Persistent conversation tracking

๐Ÿ‘จโ€โš•๏ธ Healthcare Services

  • Doctor Directory: Browse and book appointments with verified doctors
  • Medicine Store: Order medicines with stock management
  • Order Tracking: Real-time order status updates
  • SOS Emergency: Quick access emergency button

๐ŸŒ Multilingual Support

  • 3 Languages: English, Hindi (เคนเคฟเค‚เคฆเฅ€), Marathi (เคฎเคฐเคพเค เฅ€)
  • Complete Translation: All UI elements, medical terms, and responses
  • Easy Switching: One-click language change

๐Ÿ“ฑ Mobile Optimized

  • Responsive Design: Optimized for all screen sizes
  • Touch-Friendly: 44px minimum touch targets
  • Progressive Web App: Offline support via service worker
  • Fast Loading: Code-splitting and lazy loading

๐Ÿ” Authentication & Security

  • Firebase Auth: Secure user authentication
  • Role-Based Access: Admin and user roles
  • Protected Routes: Secure admin dashboard
  • Environment Variables: Sensitive data protection

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • Firebase Account (for authentication & database)
  • API Keys (OpenRouter, Gemini, Serper)

1๏ธโƒฃ Clone Repository

git clone <your-repo-url>
cd GramHealth

2๏ธโƒฃ Backend Setup

# Create virtual environment
python -m venv .venv
.venv\Scripts\activate  # Windows
# source .venv/bin/activate  # macOS/Linux

# Install dependencies
cd backend
pip install -r requirements.txt

# Configure environment
copy .env.example .env  # Windows
# cp .env.example .env  # macOS/Linux

# Edit .env file with your API keys
# OPENROUTER_API_KEY=your_key_here
# GEMINI_API_KEY=your_key_here
# SERPER_API_KEY=your_key_here

# Run Flask server
python app.py

Backend runs on http://localhost:5000

3๏ธโƒฃ Voice Agent Setup (Optional)

cd backend
python voice_agent.py

Voice agent WebSocket runs on ws://localhost:8002

4๏ธโƒฃ Frontend Setup

cd terna
npm install

# Optional: Configure frontend environment
copy .env.example .env.local  # Windows
# cp .env.example .env.local  # macOS/Linux

# Run development server
npm run dev

Frontend runs on http://localhost:5173

๐Ÿ“ Project Structure

GramHealth/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ app.py              # Flask API server
โ”‚   โ”œโ”€โ”€ voice_agent.py      # FastAPI voice WebSocket
โ”‚   โ”œโ”€โ”€ requirements.txt    # Python dependencies
โ”‚   โ””โ”€โ”€ .env.example        # Environment template
โ”‚
โ”œโ”€โ”€ terna/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/     # Reusable React components
โ”‚   โ”‚   โ”œโ”€โ”€ pages/          # Admin pages
โ”‚   โ”‚   โ”œโ”€โ”€ locales/        # Translation files (en/hi/mr)
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx         # Main homepage
โ”‚   โ”‚   โ”œโ”€โ”€ Doctor.jsx      # Doctor directory
โ”‚   โ”‚   โ”œโ”€โ”€ Medicine.jsx    # Medicine store
โ”‚   โ”‚   โ”œโ”€โ”€ Cart.jsx        # Shopping cart
โ”‚   โ”‚   โ”œโ”€โ”€ MyOrders.jsx    # Order history
โ”‚   โ”‚   โ”œโ”€โ”€ AskAI.jsx       # AI chat interface
โ”‚   โ”‚   โ”œโ”€โ”€ VoiceAgent.jsx  # Voice consultation
โ”‚   โ”‚   โ””โ”€โ”€ firebase.js     # Firebase config
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ public/
โ”‚   โ”‚   โ””โ”€โ”€ sw.js           # Service worker
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ vite.config.js
โ”‚
โ”œโ”€โ”€ .gitignore
โ””โ”€โ”€ README.md

๐Ÿ”‘ API Keys Setup

OpenRouter (AI Chat)

  1. Sign up at openrouter.ai
  2. Get API key from Keys page
  3. Add to backend/.env: OPENROUTER_API_KEY=sk-or-v1-...

Gemini (Voice Agent)

  1. Get API key from Google AI Studio
  2. Add to backend/.env: GEMINI_API_KEY=...

Serper (Web Search)

  1. Sign up at serper.dev
  2. Get API key from dashboard
  3. Add to backend/.env: SERPER_API_KEY=...

Firebase (Auth & Database)

  1. Create project at Firebase Console
  2. Enable Authentication (Email/Password, Google)
  3. Create Firestore Database
  4. Update terna/src/firebase.js with your config

๐Ÿ› ๏ธ Tech Stack

Frontend

  • React 19 + Vite 7 - Fast modern development
  • React Router 7 - Client-side routing
  • Firebase - Authentication & Firestore database
  • i18n - Multilingual support

Backend

  • Flask 3 - REST API server
  • FastAPI - WebSocket voice agent
  • LangGraph - AI workflow orchestration
  • OpenRouter - Multi-model AI access
  • Gemini - Voice agent AI

DevOps

  • Git - Version control
  • npm/pip - Package management
  • Service Worker - Offline support

๐Ÿ“ฑ Build for Production

Frontend

cd terna
npm run build
npm run preview  # Test production build

Backend

# Use production WSGI server
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 app:app

๐Ÿ”’ Security Notes

  • โš ๏ธ Never commit .env files - Already excluded in .gitignore
  • โš ๏ธ Firebase config in firebase.js is safe - Client-side keys are meant to be public
  • โœ… API keys use environment variables - Keep .env files private
  • โœ… Role-based access control - Admin routes protected

๐ŸŒ Deployment

Frontend (Vercel/Netlify)

  1. Connect GitHub repository
  2. Set build command: cd terna && npm run build
  3. Set publish directory: terna/dist
  4. Add environment variables if needed

Backend (Railway/Render)

  1. Connect GitHub repository
  2. Select backend folder
  3. Add environment variables (API keys)
  4. Deploy!

๐Ÿค Contributing

  1. Fork repository
  2. Create feature branch: git checkout -b feature-name
  3. Commit changes: git commit -m 'Add feature'
  4. Push to branch: git push origin feature-name
  5. Open Pull Request

๐Ÿ“„ License

This project is for educational purposes. Modify as needed.

๐Ÿ†˜ Support

For issues or questions, please open a GitHub issue.

๐Ÿ™ Acknowledgments

  • OpenRouter for AI model access
  • Firebase for backend infrastructure
  • React & Vite communities
  • Rural healthcare workers inspiration

Built with โค๏ธ for rural healthcare accessibility

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published