Skip to content
BahaWarePublic

About

A grid-based flood risk assessment and simulation tool for Istanbul, integrating physical geography data with machine learning.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

AFETSMART: Grid-Based Flood Risk Assessment System

AFETSMART Python FastAPI React Leaflet

AFETSMART is a grid-based spatial decision support system developed for assessing, simulating, and visualizing flood risks in Istanbul. By integrating physical geography data with an optionally trained machine learning model, the system calculates granular risk scores for decision-makers and urban planners.

🎯 Purpose and Capabilities

  • Physical Data-Driven Risk Calculation: Evaluates grid-based flood risks by processing topographical and climate variables such as elevation (DEM), rainfall (CHIRPS), and land cover/imperviousness (CORINE).
  • Hazard, Exposure & Vulnerability: Separates risk into logical components, utilizing reproducible equations to compute a final risk score normalized between 0 and 1.
  • Scenario & Simulation Engine: Allows interactive "What If?" simulations. Users can simulate the impact of extreme rainfall or measure how infrastructure interventions (e.g., drainage upgrades, permeable surfaces) reduce the overall risk.
  • Optional ML Integration: If historical flood event data (flood_events.csv) is provided, the system trains a RandomForest classifier to generate AI-predicted risk scores alongside the mathematical models.
  • Rich Visualization: Offers an interactive map with adjustable grid layers, a density heatmap, and detailed popups containing feature data for each cell.

🏗️ Architecture

  • Backend: Python, FastAPI, GeoPandas, Rasterio, Scikit-learn. The backend dynamically parses GeoJSON and TIF layers, computes risk on the fly, and serves simulations over REST endpoints.
  • Frontend: React, React-Leaflet. Provides a clean, interactive UI for toggling layers, viewing heatmaps, and running scenario adjustments via sliders.

📂 Repository Structure

afetsmart/
├── backend/
│   ├── data/                 # Input TIFs, CSVs, and GeoJSON boundaries
│   ├── model/                # Core ML & risk calculation engine
│   ├── main.py               # FastAPI endpoints
│   └── requirements.txt      # Python dependencies
├── frontend/
│   ├── public/
│   ├── src/                  # React components, Map, App.jsx, styles
│   └── package.json          # Node dependencies
└── ...                       # Project summary, installation & user guides (Turkish)

🚀 Getting Started

1. Backend Setup

Navigate to the backend directory, install requirements, and start the FastAPI server:

cd afetsmart/backend
pip install -r requirements.txt
uvicorn main:app --reload

The API will be available at http://127.0.0.1:8000.

2. Frontend Setup

In a new terminal, navigate to the frontend directory, install dependencies, and start the Vite development server:

cd afetsmart/frontend
npm install
npm run dev

The UI will be accessible at http://localhost:5173.

🧪 Simulation & Testing

  1. Rainfall Scenario: Increase the rainfall factor slider in the UI to see how extreme weather dynamically alters the risk map (shifting cells from Low to Critical).
  2. Intervention Scenario: Simulate drainage upgrades to observe real-time risk reduction in vulnerable neighborhoods.
  3. Debug Mode: Enable AFETSMART_DEBUG_STATS=1 in your environment variables for detailed backend calculation logs.

📝 Usage Notes

  • The risk categories are strictly defined by static thresholds (0.15 / 0.30 / 0.50 / 0.70) mapping to Very Low, Low, Medium, High, and Critical.
  • Cells identified primarily as water bodies (e.g. >80% water fraction) are clamped to a zero risk score automatically to prevent false positives over the sea/lakes.

About

A grid-based flood risk assessment and simulation tool for Istanbul, integrating physical geography data with machine learning.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages