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.
- 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.
- Backend: Django 5.1.5 + Django REST Framework (DRF)
- Database: SQLite (local dev database
db.sqlite3included/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)
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
- Python 3.10+ installed and added to your system
PATH.
Double-click start_django.bat or run it from a PowerShell terminal:
.\start_django.batThis batch script will automatically check Python, install dependencies, run migrations, and spin up the development server.
- Create and activate a virtual environment:
python -m venv .venv # On Windows (PowerShell): .\.venv\Scripts\Activate.ps1 # On macOS/Linux: source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Run migrations:
python manage.py migrate
- 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 - Start the server:
Access the app at: http://localhost:8000
python manage.py runserver
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 |
GET /api/bookings/— List all bookingsPOST /api/bookings/create/— Create a new emergency bookingGET /api/bookings/<booking_id>/— Get details of a specific bookingPOST /api/bookings/<booking_id>/status— Update booking status (pending, assigned, in_progress, completed, cancelled)POST /api/bookings/<booking_id>/accept/— Hospital/Ambulance accept bookingPOST /api/bookings/<booking_id>/assign/— Assign ambulance to booking
POST /api/routing/calculate-route/— Get route coordinates, duration, and distance between coordinatesPOST /api/routing/estimate-price/— Estimate trip price based on distance and vehicle typeGET /api/routing/find-nearest-ambulance/— Find the nearest available ambulance to a coordinateGET /api/routing/find-nearest-hospital/— Find the nearest hospital with available beds to a coordinatePOST /api/routing/ambulance/<ambulance_id>/location/— Update live location of an ambulanceGET /api/routing/ambulance-locations/— Get all live ambulance coordinates