Skip to content

logitechsoumili/Disaster_Risk_Prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Hazard Disaster Risk Prediction System

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.


Problem Statement

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.


Project Structure

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

Key Features

  • 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.

Methodology

Flood Risk Module

  • Model: XGBoost multi-class classifier.
  • Inputs: Rainfall, River Discharge, Water Level, Elevation, Historical Presence.
  • Logic: Hybrid scoring using model probability weighted by topographical vulnerability.

Heatwave Risk Module

  • Model: Random Forest classifier.
  • Inputs: Temperature, Humidity, Wind Speed, Pressure, Rainfall.
  • Logic: Atmospheric stress calculation (Heat Index) combined with meteorological trends.

Model Performance

Flood Risk Classifier (XGBoost)

Metric Value
Test Accuracy 98.85%
Macro F1 Score 98.49%

Heatwave Risk Classifier (RF)

Metric Value
Test Accuracy 96.61%
ROC-AUC 99.23%

Deployment Architecture

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.

Pages

  1. 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.

    Flood Dashboard

  2. Heatwave Risk Dashboard

    • Real-time atmospheric stress analysis.
    • 24-hour temperature projection charts (Altair).
    • Atmospheric risk gauges and AI narrative.

    Heatwave Dashboard 1 Heatwave Dashboard 2

  3. About & Methodology

    • Detailed breakdown of ML parameters and validation metrics.
    • System architecture layout.

Technology Stack

  • 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)


How to Run Locally

Prerequisites

  • Python 3.9+
  • OpenWeather API Key (Free tier)
  • Active internet connection

Installation Steps

  1. Clone the repository

    git clone https://github.com/logitechsoumili/Disaster_Risk_Prediction.git
    cd Disaster_Risk_Prediction
  2. Install dependencies

    pip install -r requirements.txt
  3. Configure API Keys The system requires an OpenWeather API key. Create a .streamlit/secrets.toml file in the root directory:

    OPENWEATHER_API_KEY = "your_api_key_here"
  4. Launch the Dashboard

    streamlit run app.py

Future Enhancements

  • 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.

About

Real-time multi-hazard disaster risk prediction system using machine learning to assess flood and heatwave risks based on meteorological and hydrological indicators.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors