Skip to content
kaushal1902Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

ResQNet — Smart Emergency Response Platform

ResQNet is a full-stack Django prototype for a Smart Emergency Response Platform. It streamlines emergency routing, hospital bed tracking, and communication between emergency services and medical facilities to minimize response times.


🚀 Key Features

  • Role-Based Dashboards: Customized interfaces and access controls for four distinct roles:
    • Regular User: Request emergency/non-emergency ambulances, track real-time dispatches, and check partner hospital facilities.
    • Ambulance Provider: Manage ambulance fleets, assign drivers, communicate with hospital portals, calculate real-time routing, and request bed reservations.
    • Hospital Staff: Track available General/ICU/Ventilator beds, accept/deny incoming patient transfer requests, and manage staff/doctor specialties.
    • Admin / Developer: View platform analytics, coordinate network performance, and manage site configurations.
  • Intelligent Routing & Dispatch:
    • Find the nearest hospital or ambulance station based on real-time coordinates.
    • Real-time routing geometry, distance, and duration estimations powered by the OpenRouteService API.
    • Interactive maps using Leaflet.js and OpenStreetMap.
    • Geocoding addresses to coordinates using geopy (customized for the Mumbai metropolitan region).
    • Route sharing via messaging (e.g., WhatsApp route links).
  • Hospital Bed Allocation: Live updates for general, ICU, and ventilator bed availability, including bed reservation/locking capabilities during emergency transfers.
  • Offline/PWA Features: Progressive Web App integration with service workers (sw.js) and a custom offline page (offline.html) for resilient operation.
  • Live Messaging system: Direct chat channel between ambulance operators and target hospitals.

🛠️ Tech Stack

  • Backend: Django 5.1.5 + Django REST Framework (DRF)
  • Database: SQLite (local dev database db.sqlite3 included/migrated)
  • Frontend: Vanilla CSS + Semantic HTML templates + Vanilla JS (integrated directly in Django)
  • Maps & Geolocation: Leaflet.js, OpenStreetMap, geopy (geodesic distance calculations & geocoding)
  • API Integrations: OpenRouteService (matrix operations and directions)

📂 Project Structure

ResQNet/
│
├── core/                       # Core Django application files
│   ├── management/             # Custom Django management commands (load initial data, seed plans, etc.)
│   ├── migrations/             # Database migrations
│   ├── models.py               # Database schemas (User, Hospital, Ambulance, Driver, Booking, etc.)
│   ├── routing_service.py      # Core routing logic (OpenRouteService + geopy wrapper)
│   ├── serializers.py          # DRF serializers for API endpoints
│   ├── urls.py                 # Core app path routes and API endpoints
│   └── views.py                # Template views and REST views
│
├── resqnet_django/             # Project-wide settings and URL configuration
│   ├── settings.py             # App settings (CORS, Databases, App Config, custom Middleware)
│   └── urls.py                 # Core routing dispatcher
│
├── templates/                  # Responsive HTML templates (Dashboard layouts, auth, maps, etc.)
├── static/                     # Static files (Service Worker files, placeholder maps, assets)
├── manage.py                   # Django CLI utility
├── start_django.bat            # Windows startup script
├── requirements.txt            # Python dependencies list
└── .gitignore                  # Git untracked pattern file

⚙️ Quick Start (Local Setup)

Prerequisites

  • Python 3.10+ installed and added to your system PATH.

Option 1: Automatic Run (Windows)

Double-click start_django.bat or run it from a PowerShell terminal:

.\start_django.bat

This batch script will automatically check Python, install dependencies, run migrations, and spin up the development server.

Option 2: Manual Run

  1. Create and activate a virtual environment:
    python -m venv .venv
    # On Windows (PowerShell):
    .\.venv\Scripts\Activate.ps1
    # On macOS/Linux:
    source .venv/bin/activate
  2. Install dependencies:
    pip install -r requirements.txt
  3. Run migrations:
    python manage.py migrate
  4. Seed Initial Data (Hospitals, Doctors, and Ambulances):
    python manage.py load_initial_data
    # Optionally load Mumbai-specific dataset and locations
    python manage.py update_mumbai_data
    python manage.py seed_plans
  5. Start the server:
    python manage.py runserver
    Access the app at: http://localhost:8000

👤 Demo User Accounts

You can log in with the following default accounts created via seed commands:

Role Username Password
Admin admin password123 or admin123
Ambulance Provider Create via /register/ or use seeded ambulance profiles
Hospital Staff Create via /register/ or use seeded hospital profiles

🔌 API Endpoints Reference

Bookings

  • GET /api/bookings/ — List all bookings
  • POST /api/bookings/create/ — Create a new emergency booking
  • GET /api/bookings/<booking_id>/ — Get details of a specific booking
  • POST /api/bookings/<booking_id>/status — Update booking status (pending, assigned, in_progress, completed, cancelled)
  • POST /api/bookings/<booking_id>/accept/ — Hospital/Ambulance accept booking
  • POST /api/bookings/<booking_id>/assign/ — Assign ambulance to booking

Routing & Maps

  • POST /api/routing/calculate-route/ — Get route coordinates, duration, and distance between coordinates
  • POST /api/routing/estimate-price/ — Estimate trip price based on distance and vehicle type
  • GET /api/routing/find-nearest-ambulance/ — Find the nearest available ambulance to a coordinate
  • GET /api/routing/find-nearest-hospital/ — Find the nearest hospital with available beds to a coordinate
  • POST /api/routing/ambulance/<ambulance_id>/location/ — Update live location of an ambulance
  • GET /api/routing/ambulance-locations/ — Get all live ambulance coordinates

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages