Data Driven Real-Time Delhi Flood Risk Monitoring & Management System
Live Demo: https://pravah-proj.vercel.app/
A comprehensive, data-driven dashboard designed to help city administrators monitor, predict, and manage urban flood risks in real-time. It integrates rainfall data, drainage capacity, and citizen complaints to generate dynamic risk scores for 250 municipal wards in Delhi.
- Real-Time Risk Engine β Dynamic algorithm calculating risk scores (0-100) based on rainfall (mm), drainage capacity (%), and active complaints.
- Interactive City Map β Visualizes 250 wards with color-coded risk markers (Red/Yellow/Green) and pulse animations for high-risk zones.
- Dual-Role Interface β
- Citizen Portal: Submit geo-tagged waterlogging complaints bala
- Admin Dashboard: Monitor KPIs, view ward-level analytics, and update infrastructure status.
- Professional Visualization β Clean, government-grade UI with data-dense tables and actionable insights.
- Dual Themes β Both light mode and dark mode implemented to suit all users.
- Simulated IoT Data β Realistic, synchronized datasets for Rainfall and Drainage across all Delhi zones.
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β IoT Sensors β β Citizen β β Admin β
β (Rain/Drain) β β Reporting β β Actions β
ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Data Aggregation Layer β
β (CSV / In-Memory State Store) β
ββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Risk Engine (Python) β
β Formula: (Drainage * 0.5) + (Rain * 0.3) + (Logs * 0.2)β
ββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β REST API ββββββΆβ Frontend ββ βββΆβ Leaflet Maps β
β (FastAPI) β β (HTML/JS) β β (Visuals) β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
Pravah/
βββ backend/
β βββ data/
β β βββ wards.csv # 250 Ward Geo-coordinates & Zones
β β βββ rainfall.csv # Live Rainfall Data (mm)
β β βββ drainage.csv # Infrastructure Capacity (%)
β β βββ complaints.csv # Citizen Report Log
β β
β βββ src/
β β βββ main.py # FastAPI Entry Point & CORS
β β βββ config.py # Settings & Constants
β β βββ models.py # Pydantic Schemas
β β βββ services/
β β βββ api.py # API Route Handlers
β β βββ data_loader.py # CSV Parsing & Merging Logic
β β βββ risk_engine.py # Risk Calculation Algorithm
β β βββ admin_ops.py # Admin Action Logic
β β
β βββ requirements.txt # Python Dependencies
β
βββ frontend/
β βββ css/
β β βββ styles.css # Main Theme & Responsive Rules
β β βββ admin.css # Dashboard Specific Styles
β β
β βββ js/
β β βββ common.js # API Config & Utilities
β β βββ admin.js # Dashboard Logic & Maps
β β βββ dashboard.js # Citizen Map & Reporting
β β βββ complaints.js # Form Handling
β β βββ login.js # Auth Logic
β β
β βββ index.html # Landing Page
β βββ admin.html # Main Admin Control Room
β βββ dashboard.html # Citizen Reporting Page
β βββ login.html # Admin Login Gate
β βββ about.html # About The Project
β
βββ README.md
- Python 3.9+
- Web Browser(Desktop Mode for now)
- Git
# Clone the repository
git clone https://github.com/prabhatbhatiaa/pravah.git
cd pravah
# Backend Setup
cd backend
python -m venv venv
.\venv\Scripts\activate # Windows
# source venv/bin/activate # Mac/Linux
# Install dependencies
pip install -r requirements.txt# Start Uvicorn Server
uvicorn src.main:app --reload1. Open the frontend folder.
2. Open index.html via Live Server (VS Code Extension) or simply double-click it.
3. Important: Ensure frontend/js/common.js points to http://localhost:8000 for local development.- Landing Page β : Public access to project overview.
- About Us Page β : Public accessto the details of the project.
- Citizen Dashboard β Public access to view map & report issues.
- Admin Portal β : Restricted access via Session Storage.
GET /api/wardsβ Returns full GeoJSON of all 250 wards with calculated risk.GET /api/risk-summaryβ Returns aggregate stats (High Risk count, Total Wards).POST /api/complaintβ Submit a new citizen complaint.
GET /api/admin/overviewβ Returns detailed tabular data sorted by risk.POST /api/admin/update-drainageβ Update drainage capacity for a specific ward.
The Risk Engine (risk_engine.py) calculates a score (0-100) for every ward in real-time
- Drainage Factor (50%): Inverse of capacity. Lower drainage = Higher risk.
- Rainfall Factor (30%): Normalized against a critical threshold (150mm).
- Complaint Factor (20%): Active complaints boost the risk score significantly.
Final Score = (Drainage_Risk * 0.5) + (Rainfall_Risk * 0.3) + (Complaint_Risk * 0.2)- FastAPI β High-performance Python framework.
- Pandas β Data manipulation and CSV handling.
- Uvicorn β ASGI Server.
- HTML5 / CSS3 β Responsive layout with CSS Variables.
- Vanilla JavaScript β Logic without heavy frameworks.
- Leaflet.js β Interactive Maps & Marker rendering.
- Render β Python Backend Hosting.
- Vercel β Static Frontend Hosting.
fastapi
uvicorn
pandas
pydantic
python-multipartpip install -r backend/requirements.txt- Session Storage Auth β Basic client-side session management for the hackathon prototype.
- CORS Configuration β Backend restricted to specific origins in production.
Map not loading:
- Check if the Backend URL in
frontend/js/common.jsmatches your running server. - Ensure no trailing slash in the API base URL (e.g.,
https://api.comnothttps://api.com/).
Admin page redirects to login:
- Ensure you actually logged in via
login.html to set the session key. - Check browser console for
sessionStorageerrors.
High latency on first load:
- The backend is hosted on a free Render instance which spins down after inactivity. The first request might take 50 seconds to wake it up.
- Integration with live IMD Weather API.
- IoT Sensor integration for real-time water level monitoring.
- SMS Alerts to citizens in High-Risk zones.
- Predictive AI model for 24hr flood forecasting.
- Mobile-responsive UI improvements
Prabhat Bhatia & Suhani Yadav
Note: This project was built for a govt level hackathon. The data for "Rainfall" and "Drainage" is simulated based on real-world Delhi ward boundaries and flood hotspots.