Skip to content

Aly-EL-Badry/DisasterPrediction

Repository files navigation

Disaster Prediction API

Disaster Prediction API is a machine learning-based backend service that predicts the likelihood of natural disasters such as floods, storms, or extreme weather events based on meteorological data. The API is built with Python and FastAPI, making it fast, scalable, and easy to integrate into other applications.


Features

  • Predicts disasters using weather and environmental data.
  • Handles multiple input features including:
    • date
    • precipitation
    • temp_max
    • temp_min
    • wind
  • Calculates derived features:
    • Temperature difference (temp_diff)
    • Average temperature (temp_avg)
  • Returns structured predictions in JSON format.
  • Easily extensible with new models or features.

Tech Stack

  • Backend Framework: FastAPI
  • Machine Learning: CatBoost / XGBoost (configurable)
  • Data Processing: pandas, numpy
  • Deployment: Docker-ready, compatible with fly.io, Simple Front-end Design, mlflow on Dagshub

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/disaster-prediction-api.git
cd disaster-prediction-api
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # Linux/Mac
venv\Scripts\activate     # Windows
  1. Install dependencies:
pip install -r requirements.txt
  1. Run app localy
uvicorn app:app --reload

Usage

Send a POST request to /predict endpoint with JSON body:

{
  "features": [
    {
      "date": "2025-08-28",
      "precipitation": 12.3,
      "temp_max": 35,
      "temp_min": 28,
      "wind": 5
    }
  ]
}

result:

{
  "predictions": [rain]  
}

Contributing

  • Fork the repo
  • Create a feature branch
  • Make your changes and test
  • Submit a pull request

License

MIT License © 2025 Aly El-Deen Yasser Ali


links :