Skip to content

mspandey/medgrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ MedGrid β€” Real-Time Hospital Resource Management

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.


πŸš€ Overview

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.


πŸ’‘ MedGrid Values

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.

✨ Key Features

πŸ›οΈ 1. Real-Time Bed Tracking

  • 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.

🩸 2. Blood Bank Integration

  • 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.

πŸš‘ 3. Ambulance Dispatch System

  • 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).

πŸ€– 4. RAG-Powered AI Chatbot

  • 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-instruct via Hugging Face Inference API.

πŸ₯ 5. Hospital Staff Portal

  • 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.

πŸ‘€ 6. Patient Portal

  • 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.

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  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    β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Frontend

Technology Purpose
React 18 + TypeScript UI Framework
Tailwind CSS Styling & Design System
Axios API Communication
React Router v6 Client-Side Routing
Lucide React Icons

Backend

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

πŸ“‹ Prerequisites

  • Node.js v18+
  • Python v3.9+
  • Git

βš™οΈ Getting Started

1. Clone the Repository

git clone https://github.com/Esingh-byte/medgrid.git
cd medgrid

2. Backend Setup

cd 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:8000

Environment 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"

3. Frontend Setup

Open a new terminal:

cd client

# Install dependencies
npm install

# Start the development server
npm run dev
# Frontend runs on http://localhost:5173

πŸ“‘ API Endpoints

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

πŸ—ΊοΈ Roadmap

  • 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

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is open source and available under the MIT License.


Made with ❀️ for better healthcare access

Team MedGrid β€” GitHub

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors