Emergency Location Services Uncovered


A Project by Sanat Kulkarni and Aditya Dutt
๐๐ฝ Objective :- The app will enable emergency operators to send a link to the victim/bystander, which, when clicked, fetches their location and relays it to the nearest ambulance. Additionally, it contains ERP portal for operators and administrators to manage and monitor emergency responses.
Table of Contents
Introduction
The Emergency Location Management System is a comprehensive solution designed to streamline the management of emergency operators, ambulances, and cases. This system is built to enhance the efficiency and effectiveness of emergency response teams by providing real-time data and automated processes.
Key Objectives
Efficiency: Reduce response times by providing operators with real-time information and automated tools.
Accuracy: Ensure precise location tracking of ambulances and operators to facilitate quick dispatch and coordination.
Accountability: Maintain detailed records of all operations, including case management, operator activities, and ambulance usage.
About the Decisions
React.js (Frontend):
Chosen for its component-based architecture, which facilitates building complex, reusable UI elements like dashboards and tables. Its large community support, extensive libraries (e.g., react-leaflet), and efficient rendering (virtual DOM) make it suitable for interactive applications. State management libraries help manage application complexity.
Node.js/Express.js (Backend):
Selected due to its non-blocking I/O model, making it efficient for handling concurrent connections (important for location updates). JavaScript ecosystem alignment with the frontend simplifies development (full-stack JS). Large npm registry provides readily available packages for authentication (JWT), database interaction, email, etc. Well-suited for building REST APIs.
MongoDB/PostgreSQL (Choose One):
MongoDB: Its flexible schema is advantageous for storing potentially varied case information and user profiles. Built-in geospatial capabilities are sufficient for storing and querying coordinates.
PostgreSQL with PostGIS: Offers robust ACID compliance and relational integrity. PostGIS provides powerful geospatial functions beyond simple storage, potentially useful for future enhancements like proximity queries or route analysis.
JWT (JSON Web Tokens):
Used for authentication as it provides a stateless mechanism. Once the user logs in, the frontend stores the token and sends it with each request, eliminating the need for server-side session management and simplifying scalability.
Architectural Decisions
Multi-Tiered Architecture:
Adopted to enforce separation of concerns. The frontend handles presentation, the backend manages business logic and data access, and the database handles persistence. This makes the system easier to develop, test, maintain, and potentially scale different tiers independently.
RESTful APIs:
Chosen as the communication standard between frontend and backend due to its simplicity, statelessness, and wide adoption. It allows for clear definition of resources and actions.
Location Sharing Mechanism
Link-Based Approach:
Preferred over requiring a dedicated mobile app installation for callers/drivers because it maximizes accessibility. Anyone with a smartphone browser can use it instantly without prior setup, which is crucial in emergency situations.
Email Delivery (Demo):
Used as the initial delivery method as it's straightforward to implement. SMS is a critical alternative for future development, potentially offering faster delivery and higher open rates in emergencies.
Browser Geolocation API:
Leveraged as the standard, cross-platform way to access device location services directly from the web page, avoiding the need for native code.
Authentication and Authorization
Role-Based Access Control (RBAC):
Implemented to ensure users can only access functionalities relevant to their roles (Admin vs. Operator). The user's role is typically embedded within the JWT and checked by backend middleware on protected routes.
Mapping Technology Selection
OpenStreetMap (OSM) & Leaflet.js:
Chosen primarily because they are open-source and free to use, avoiding the potentially high costs associated with commercial mapping platforms like Google Maps Platform for extensive usage (especially tile serving and tracking). Leaflet is a lightweight, flexible, and widely used JavaScript library for interactive maps, well-suited for displaying markers and potentially routes.
Google Maps (Redirection):
Used for showing a specific case location, via URL redirection (maps.google.com
?q=...
). This leverages Google's familiar interface and powerful search/direction features for the operator without incurring API costs for simple point visualization.
Data Management Strategy
Unique identifiers (UUIDs) are used for cases and location links to ensure security and prevent trivial guessing of links.
Location data is timestamped to provide context.
Case status (active, closed, etc.) helps operators manage workflow.
Ambulance status (available, busy) aids in dispatch decisions.
Real-time Communication Approach
Ambulance Tracking:
Periodic polling (driver's device repeatedly sending location via HTTPS POST). This allows the driver's device to maintain a persistent connection to the backend and push location updates instantly, enabling smoother, near real-time tracking visualization on the operator's map with less overhead.
Getting Started
System Requirements
Web browser (Chrome, Firefox, Safari, Edge)
Internet connection
Installation
- Clone the repository:
git clone <https://github.com/SanatKulkarni/Emergency-Location.git>
- Navigate to the project directory:
cd emergency-location
- Install dependencies:
npm install
- Start the development server:
npm run dev
User Roles
Admin
Admins have access to the Admin Dashboard, where they can manage operators, ambulances, and cases.
Operator
Operators have access to the Operator Dashboard, where they can manage active cases and view available ambulances.
Features
Admin Dashboard
Overview: View statistics on total operators, total cases, active cases, and total ambulances.
Manage Operators: Add, edit, and delete operators.
Manage Ambulances: Add, edit, and delete ambulances.
Manage Cases: Add, edit, and delete cases.
Operator Dashboard
Active Cases: View and manage active cases.
Available Ambulances: View available ambulances.
Automatic Email Sending
- Email Notifications: Automatically send emails when a person calls for an Ambulance.
Automatic Location Fetching
- Location Tracking: Automatically fetch and push the location data of ambulances and operators to the server.
Ambulance Tracking
- Real-Time Tracking: Monitor the real-time location of ambulances on a map.
Detailed Instructions
Sign In
Navigate to the sign-in page.
Enter your email and password.
Click the "Sign In" button.
Based on your role, you will be redirected to the appropriate dashboard.
Managing Operators
Navigate to the "Operators" section in the Admin Dashboard.
Add Operator:
Click the "Add Operator" button.
Fill in the operator details in the modal form.
Click "Save" to add the operator.
Edit Operator:
Click the "Edit" button next to the operator you want to edit.
Update the operator details in the modal form.
Click "Save" to update the operator.
Delete Operator:
Click the "Delete" button next to the operator you want to delete.
Confirm the deletion in the prompt.
Managing Ambulances
Navigate to the "Ambulances" section in the Admin Dashboard.
Add Ambulance:
Click the "Add Ambulance" button.
Fill in the ambulance details in the modal form.
Click "Save" to add the ambulance.
Edit Ambulance:
Click the "Edit" button next to the ambulance you want to edit.
Update the ambulance details in the modal form.
Click "Save" to update the ambulance.
Delete Ambulance:
Click the "Delete" button next to the ambulance you want to delete.
Confirm the deletion in the prompt.
Managing Cases
Navigate to the "Cases" section in the Admin Dashboard.
Add Case:
Click the "Add Case" button.
Fill in the case details in the modal form.
Click "Save" to add the case.
Edit Case:
Click the "Edit" button next to the case you want to edit.
Update the case details in the modal form.
Click "Save" to update the case.
Delete Case:
Click the "Delete" button next to the case you want to delete.
Confirm the deletion in the prompt.
Profile Management
Navigate to the "Profile" section.
View and update your profile details.
Save any changes made to your profile.
Automatic Email Sending
The system will automatically send emails when a person calls for an Ambulance.
Ensure your email address is correctly provided to receive notifications.
Automatic Location Fetching
The system will automatically fetch and push the location data of ambulances and operators to the server.
Ensure location services are enabled on your device for accurate tracking.
Ambulance Tracking
Navigate to the "Ambulance Tracking" section in the Operator Dashboard.
View the real-time location of all available ambulances on the map.
Click on an ambulance marker to view its details, including current status and location coordinates.
Logging Out
Click the "Logout" button in the dashboard.
Confirm the logout action.
Troubleshooting
Failed to load data: Ensure you have a stable internet connection. If the problem persists, contact support.
Sign-in issues: Verify your email and password. If you forgot your password, use the password recovery option.
Location fetching issues: Ensure location services are enabled on your device and you have granted the necessary permissions.
Contact Support
For further assistance, please contact our support team at aditya_dutt@srmap.edu.in or sanatshantanu_kulkarni@srmap.edu.in.
Subscribe to my newsletter
Read articles from Sanat Kulkarni directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
