A comprehensive prediction model and early warning system for Flood, Cyclone, and Landslide disasters in Sri Lanka. This system empowers social resilience by providing timely predictions and safety information to the general public through a mobile application.
- Predict flood, cyclone, and landslide occurrences in Sri Lanka
- Provide early warning alerts to common people
- Enable proactive disaster preparedness
- Empower social resilience through accessible technology
The project consists of four main components:
- Data Preprocessing - Data cleaning and feature engineering
- Model Training - Machine learning model development
- API Integration - Backend service for predictions
- Mobile Application - Android app for end users
DSGP/
├── Preprocess/ # Data preprocessing and cleaning
│ ├── Preprocess.ipynb # Main preprocessing notebook
│ └── [Data files] # Processed datasets
├── Modelling/ # Model training notebooks
│ ├── Flood/ # Flood prediction models
│ ├── Cyclone/ # Cyclone prediction models
│ └── Landslide/ # Landslide prediction models
├── Integration/ # Flask API backend
│ ├── app.py # Flask application
│ ├── Model_*.py # Model prediction modules
│ └── *.pkl # Trained model files
└── MyApplication/ # Android mobile application
└── app/ # Android app source code
- Language: Python 3
- Libraries:
pandas- Data manipulationnumpy- Numerical computationsscikit-learn- Machine learning algorithmsxgboost- Gradient boosting framework
- Models: Random Forest Regressor, XGBoost Regressor
- Framework: Flask
- Deployment: Heroku
- Functionality: RESTful API for predictions
- Platform: Android
- Language: Java
- IDE: Android Studio
- Backend Services: Firebase
- Features: Real-time predictions, location-based alerts, weather integration
- Python 3.7+
- Jupyter Notebook
- Android Studio (for mobile app)
- Firebase account (for backend services)
-
Clone the repository
git clone <repository-url> cd disaster-predictor
-
Install Python dependencies
cd Integration pip install -r requirements.txt -
Open preprocessing notebook
cd Preprocess jupyter notebook Preprocess.ipynb -
Train models
cd Modelling/Flood jupyter notebook "Model Flood.ipynb"
-
Run Flask API
cd Integration python app.py -
Build Android App
- Open
MyApplication/in Android Studio - Configure Firebase
- Build and run
- Open
- Load and combine multiple datasets
- Handle missing values
- Feature engineering
- Create model-ready datasets
- Train Random Forest models
- Train XGBoost models
- Evaluate model performance
- Save trained models
- Load trained models
- Create prediction endpoints
- Deploy to Heroku
- Provide REST API services
- Connect to API
- Display predictions
- Show location-based alerts
- Provide safety information
- Flood Prediction - Based on rainfall, location, and temporal features
- Cyclone Prediction - Based on wind speed, location, and temporal features
- Landslide Prediction - Based on rainfall, location, and temporal features
- Current day prediction
- 1-day ahead forecast
- 2-day ahead forecast
- 3-day ahead forecast
- User authentication (Firebase)
- Location-based predictions
- Real-time weather data
- Interactive maps
- Disaster alerts and warnings
- Safety information and guidelines
Each disaster type uses two models:
- Random Forest Regressor (RFR) - Ensemble learning approach
- XGBoost Regressor (XGB) - Gradient boosting approach
Both models provide predictions for comparison and ensemble decision-making.
POST /predict_flood
Parameters: Location, Location1, Location2, District, Rainfall(mm)
Returns: Predictions for current day + 3 days ahead (RFR and XGB)
POST /predict_cyclone
Parameters: Location, Location1, Location2, District, Wind Speed(mph) (current + 3 days)
Returns: Predictions for current day + 3 days ahead (RFR and XGB)
POST /predict_landslide
Parameters: Location, Location1, Location2, District, Rainfall(mm)
Returns: Predictions for current day + 3 days ahead (RFR and XGB)
- MainActivity - Home screen
- FloodActivity - Flood predictions
- CycloneActivity - Cyclone predictions
- LandslideActivity - Landslide predictions
- MapActivity - Interactive maps
- LoginActivity/RegisterActivity - User authentication
- AboutUsActivity - Project information
- User registration and login
- Location-based services
- Real-time predictions
- Weather data integration
- Interactive disaster maps
- Safety guidelines
flask
numpy
scikit-learn
pandas
joblib
datetime
xgboost
gunicorn
pandas
numpy
scikit-learn
xgboost
matplotlib
seaborn
joblib
Trained models are stored as .pkl files:
Flood_RFRModel.pkl/Flood_XGBModel.pklCyclone_RFRModel.pkl/Cyclone_XGBModel.pklLandslide_RFRModel.pkl/Landslide_XGBModel.pkl
District_Mapped.txt- District encoding mappingsLocation_Mapped.txt- Location encoding mappings
import requests
# Flood prediction example
response = requests.post('https://your-api-url/predict_flood', data={
'Location': 'Colombo',
'Location1': 'Western',
'Location2': 'Colombo',
'District': 'Colombo',
'Rainfall(mm)': 150.5
})
predictions = response.json()- Register/Login to the app
- Allow location permissions
- Select disaster type (Flood/Cyclone/Landslide)
- View predictions for your location
- Check 3-day forecast
- View safety guidelines
This system aims to:
- Save Lives - Early warning enables evacuation
- Reduce Damage - Proactive preparation
- Empower Communities - Accessible technology
- Build Resilience - Data-driven disaster management