This project documents the development of Radius, a hyper-local, decentralized disaster relief platform. It focuses on connecting people in immediate proximity during crises by enabling real-time resource sharing and SOS broadcasting without relying on complex external infrastructure.
The code is organized into core backend and frontend components, each handling a specific aspect of the application:
- FastAPI Server: Acts as the central traffic controller, handling API requests for creating posts and fetching nearby data.
- Geospatial Logic: Implements the Haversine Formula manually to calculate precise distances between users and resources on a spherical surface.
- Static File Serving: Automatically serves the frontend files, enabling a unified deployment structure.
- Database Management: Handles connections to the SQLite database to store and retrieve live alerts.
- Automatic Initialization: A standalone script that initializes the
lifeline.dbSQLite database. - Schema Design: Creates the
poststable with fields for geolocation (lat,lon), item type (REQUEST/OFFER), and descriptions. - Seeding: Includes logic to insert dummy data for immediate testing upon setup.
- Command Center (
index.html): A desktop-first dashboard for NGOs and responders. It integrates Leaflet.js to visualize all active requests on an interactive map. - Field Unit (
mobile.html): A lightweight, mobile-first interface designed for victims or volunteers to quickly broadcast their location and needs. - Client Logic (
app.js): Manages the browser'snavigator.geolocationAPI to capture precise coordinates and performs asynchronousfetchcalls to the backend. - Responsive Styling (
styles.css): Uses modern CSS to ensure the app works on both large dashboard screens and small mobile devices, with color-coded badges for "Requests" (Red) and "Offers" (Green).
To run this project, you need Python installed on your machine. The system relies on the following lightweight libraries:
fastapiuvicornpydantic
You can run the platform locally by following these steps:
- Install Dependencies:
pip install -r requirements.txt
- Initialize the Database:
python setup_db.py
- Start the Server:
uvicorn main:app --reload --host 0.0.0.0 --port 8000
- Access the Platform:
- Dashboard: Open
http://localhost:8000in your browser. - Mobile: Connect your phone to the same Wi-Fi and visit
http://<YOUR_LAPTOP_IP>:8000/static/mobile.html.
- Dashboard: Open
- Python (FastAPI): High-performance backend logic.
- SQLite: Zero-configuration, serverless database engine.
- Leaflet.js: Interactive maps for the command center.
- HTML5/CSS3: Semantic markup and responsive design.
- JavaScript (ES6): Async/Await logic and DOM manipulation.
Radius β’ Created by Pushti Kadia