A professional grade, real-time machine learning system for assessing flood and heatwave risks using live meteorological data and advanced classification models.
This platform features a premium glassmorphism dashboard, modular backend architecture, and AI-driven risk insights, transforming raw environmental data into actionable disaster intelligence.
Floods and heatwaves are among the most recurring and destructive climate hazards, especially in rapidly urbanizing and climate-sensitive regions. The increasing frequency of extreme weather events demands scalable, data-driven early warning systems.
Traditional forecasting models are often domain-specific and not easily accessible to the public. This project addresses that gap by building a modular, machine learning-based system capable of real-time, multi-hazard risk classification using live environmental indicators.
The project has been refactored into a modular architecture to ensure scalability, high performance, and ease of maintenance.
Disaster_Risk_Prediction/
├── app.py # Main entry point (Streamlit)
├── requirements.txt # System dependencies
├── README.md # Documentation
├── services/ # Core Logic & API Integrations
│ ├── api.py # OpenWeather & Open-Meteo API handlers
│ ├── model_inference.py # Model loading and prediction logic
│ └── report_generator.py # PDF report generation (fpdf2)
├── ui/ # User Interface Layer
│ ├── theme.py # Custom CSS & Glassmorphism styles
│ ├── components.py # Reusable UI components (Gauges, Maps, AI Insight)
│ └── pages/ # Page-specific rendering logic
│ ├── flood_page.py # Hydrological risk dashboard
│ ├── heatwave_page.py # Atmospheric risk dashboard
│ └── about_page.py # Technical methodology & about
├── utils/ # Helper Utilities
│ └── helpers.py # Math, physical risk metrics, & formatting
├── models/ # Serialized ML Models (.pkl)
├── data/ # Datasets for training/validation
└── assets/ # Visual assets & documentation images
- Multi-Hazard Monitoring: Unified risk assessment for Floods and Heatwaves.
- Hybrid Risk Models: Combines trained ML classifiers (XGBoost/Random Forest) with real-world physical indicators (Heat Index, Elevation).
- Comparison Mode: Side-by-side analysis of two different cities for rapid decision making.
- AI-Powered Insights: Context-aware reasoning for each assessment, explaining risk drivers.
- Professional PDF Reports: Instant generation of downloadable risk reports with metrics and insights.
- Dynamic Charting: Interactive trend analysis using Altair and Plotly gauges.
- Geospatial Intelligence: Real-time map rendering using Folium.
- Model: XGBoost multi-class classifier.
- Inputs: Rainfall, River Discharge, Water Level, Elevation, Historical Presence.
- Logic: Hybrid scoring using model probability weighted by topographical vulnerability.
- Model: Random Forest classifier.
- Inputs: Temperature, Humidity, Wind Speed, Pressure, Rainfall.
- Logic: Atmospheric stress calculation (Heat Index) combined with meteorological trends.
| Metric | Value |
|---|---|
| Test Accuracy | 98.85% |
| Macro F1 Score | 98.49% |
| Metric | Value |
|---|---|
| Test Accuracy | 96.61% |
| ROC-AUC | 99.23% |
The system is deployed using Streamlit with a modular front-end/back-end decoupling. The UI is powered by a custom CSS-driven Glassmorphism Theme for a professional control-center aesthetic.
-
Flood Risk Dashboard
- Manual city-based assessment.
- Comparison mode for multi-site monitoring.
- Hydrological KPI strips and AI insight panels.
- Interactive Risk Map and PDF report utility.
-
Heatwave Risk Dashboard
- Real-time atmospheric stress analysis.
- 24-hour temperature projection charts (Altair).
- Atmospheric risk gauges and AI narrative.
-
About & Methodology
- Detailed breakdown of ML parameters and validation metrics.
- System architecture layout.
- Framework: Streamlit (Front-end)
- Styling: Custom CSS (Glassmorphism & Dark/Light Modes)
- Machine Learning: Scikit-Learn, XGBoost, Joblib
- Data & Charts: Pandas, NumPy, Plotly, Altair
- mapping: Folium, Streamlit-Folium
- Reporting: FPDF2 (PDF generation)
- APIs: OpenWeather (Weather & Geocoding), Open-Meteo (Elevation & Forecasts)
- Python 3.9+
- OpenWeather API Key (Free tier)
- Active internet connection
-
Clone the repository
git clone https://github.com/logitechsoumili/Disaster_Risk_Prediction.git cd Disaster_Risk_Prediction -
Install dependencies
pip install -r requirements.txt
-
Configure API Keys The system requires an OpenWeather API key. Create a
.streamlit/secrets.tomlfile in the root directory:OPENWEATHER_API_KEY = "your_api_key_here"
-
Launch the Dashboard
streamlit run app.py
- Multi-Hazard Expansion: Adding modules for Cyclone, Earthquake, and Drought monitoring.
- Deep Learning Integration: Implementing LSTM/Transformers for temporal flood forecasting.
- Global Coverage: Enhancing geocoding services for broader regional support.
- Automated Alerts: Email and Push notification triggers for high-risk detections.
- Data Persistence: SQL-based historical risk logging and analysis.
- Mobile responsiveness: Optimizing glassmorphism UI for mobile viewing.


