Connecting Hospitals. Saving Lives. A smart platform providing real-time bed availability, blood inventory tracking, ambulance dispatch, and AI-powered hospital recommendations for government and private hospitals.
MedGrid is a state-of-the-art healthcare management platform designed to bridge the gap between hospitals, ambulances, and patients. By providing real-time data on bed availability and blood inventory, MedGrid ensures that no time is lost when it matters most.
Whether you are a hospital administrator managing ICU beds, an ambulance driver en route to an emergency, or a patient searching for the nearest hospital β MedGrid serves as your intelligent healthcare companion.
| Value | What It Means for Us |
|---|---|
| β‘ Speed | Every second counts in a medical emergency. MedGrid ensures real-time data is always one click away. |
| π Transparency | Patients and ambulances see live, accurate data β no guesswork, no outdated records. |
| π€ Accessibility | Designed for government hospitals and rural clinics, not just private healthcare. |
| π§ Intelligence | AI-powered recommendations and a RAG chatbot make complex decisions simple. |
| π©Έ Community | Blood donor registration connects citizens directly to hospitals that need them. |
| π Reliability | A system that works when it matters most β during emergencies, disasters, and critical care. |
- Live Availability: Track ICU, General, NICU, and Emergency beds across all registered hospitals in real time.
- Staff Portal: Hospital staff can toggle bed availability, manage departments, and batch-save updates with a single click.
- Patient View: Patients can see available beds at any hospital before arriving.
- Live Inventory: Real-time blood unit counts for all 8 blood groups (A+, Aβ, B+, Bβ, AB+, ABβ, O+, Oβ).
- Blood Donor Registration: Citizens can register as blood donors via a comprehensive form.
- Email Confirmation: Donors automatically receive a confirmation email with the nearest hospital's details and next steps.
- Emergency Case Management: Ambulances can raise emergency cases and get matched to the best hospital.
- AI Hospital Recommendation: AI recommends the optimal hospital based on location, bed availability, and blood group.
- Real-Time ETA: Tracks ambulance status (Pending β Enroute β Arrived β HandedOver).
- Intelligent Q&A: Ask about hospitals, doctors, bed availability, and blood inventory in natural language.
- ChromaDB Vector Store: Powered by Sentence Transformers + ChromaDB for semantic search.
- LLM Integration: Uses
microsoft/Phi-3-mini-4k-instructvia Hugging Face Inference API.
- Profile Management: Update hospital details, specialties, and operating hours.
- Doctor Management: Add doctors, toggle on-shift/on-call status.
- Patient Records: View and manage patient medical records.
- Emergency Dashboard: Real-time emergency case notifications with accept/confirm workflow.
- Hospital Search: Search hospitals by name or location.
- Hospital Details: View beds, blood inventory, doctors, and patient reviews.
- Review System: Submit star ratings and comments for hospitals.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend Layer β
β React + TypeScript + Tailwind CSS β
β ββββββββββββ ββββββββββββ ββββββββββββββββββββββ β
β βDashboard β βStaffPortalβ βPatient/Ambulance β β
β ββββββββββββ ββββββββββββ ββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REST API (Axios)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend Layer (Django) β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββ β
β β Hospitals APIβ β Chatbot API β β Auth API β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Data & AI Layer β
β ββββββββββββ ββββββββββββ ββββββββββββββββββββββ β
β β SQLite DBβ β ChromaDB β β HuggingFace LLM β β
β ββββββββββββ ββββββββββββ ββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Technology | Purpose |
|---|---|
| React 18 + TypeScript | UI Framework |
| Tailwind CSS | Styling & Design System |
| Axios | API Communication |
| React Router v6 | Client-Side Routing |
| Lucide React | Icons |
| Technology | Purpose |
|---|---|
| Django 6 + DRF | REST API Framework |
| SQLite | Database |
| ChromaDB | Vector Database for RAG |
| Sentence Transformers | Embeddings (all-MiniLM-L6-v2) |
| Hugging Face | LLM (Phi-3-mini-4k-instruct) |
| Django Email (SMTP) | Blood Donor Email Notifications |
- Node.js v18+
- Python v3.9+
- Git
git clone https://github.com/Esingh-byte/medgrid.git
cd medgridcd medgrid_server
# Create and activate virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# Mac/Linux
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run migrations
python manage.py migrate
# (Optional) Seed sample data
python seed_apro_data.py
# Start the server
python manage.py runserver
# Backend runs on http://localhost:8000Environment Variables (optional, for full features):
| Variable | Description |
|---|---|
HF_TOKEN |
Hugging Face API token (for RAG chatbot LLM) |
EMAIL_HOST_USER |
Gmail address (for blood donor emails) |
EMAIL_HOST_PASSWORD |
Gmail App Password |
Set them in your terminal before running the server:
# Windows PowerShell
$env:HF_TOKEN="your_hf_token"
$env:EMAIL_HOST_USER="your@gmail.com"
$env:EMAIL_HOST_PASSWORD="your_app_password"Open a new terminal:
cd client
# Install dependencies
npm install
# Start the development server
npm run dev
# Frontend runs on http://localhost:5173| Method | Endpoint | Description |
|---|---|---|
GET |
/api/hospitals/ |
List all hospitals |
POST |
/api/hospitals/ |
Register a new hospital |
GET/PATCH |
/api/hospitals/:id/ |
Get or update hospital details |
POST |
/api/auth/login |
Hospital login |
POST |
/api/auth/patient/login |
Patient login |
POST |
/api/auth/patient/register |
Patient registration |
POST |
/api/auth/ambulance/login |
Ambulance login |
POST |
/api/beds/:id/toggle |
Toggle bed availability |
POST |
/api/doctors/:id/toggle |
Toggle doctor shift/call status |
POST |
/api/blood-donation |
Register blood donor + send email |
GET |
/api/ai-recommendation |
AI hospital recommendation |
POST |
/api/chat/ |
RAG Chatbot query |
GET/POST |
/api/emergencies/ |
Emergency case management |
GET/POST |
/api/reviews/ |
Hospital reviews |
- Hospital Registration & Authentication
- Real-Time Bed Tracking (ICU, General, NICU, Emergency)
- Blood Inventory Management
- Blood Donor Registration with Email Confirmation
- Ambulance Dispatch & Emergency Management
- RAG-Powered AI Chatbot
- AI Hospital Recommendation Engine
- Patient Portal & Review System
- Staff Portal with Batch Save
- Mobile App (React Native)
- Google Maps Integration for Live Tracking
- SMS Notifications for Emergencies
- Government Hospital API Integration
- Multi-language Support (Hindi, Tamil, etc.)
- Access the admin portal with
- user name-medgrid_admin
- password- AmishaPandey
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Made with β€οΈ for better healthcare access
Team MedGrid β GitHub