Real-time disaster prediction system with automated data collection, multi-location weather monitoring, and machine learning-powered alert generation.
Monitor Global Weather. Predict Disasters. Save Lives. – Early warning system powered by real-time data intelligence.
- Overview
- Features
- Tech Stack
- Quick Start
- System Architecture
- Data Pipeline
- Disaster Predictions
- Project Structure
- Configuration
- Deployment
- Contributing
- License
WaveShield is a comprehensive multi-disaster prediction and alert system that leverages real-time global weather data to generate early warnings for natural disasters including hurricanes, floods, earthquakes, and severe storms.
The system operates as an intelligent data collection pipeline that:
- Fetches live weather data for multiple target cities
- Stores data in time-series optimized CSV format
- Trains machine learning models on historical patterns
- Generates real-time disaster predictions and alerts
- 🌍 Global Monitoring - Track weather in 100+ cities worldwide
- ⚡ Real-Time Data - Hourly weather updates via Open-Meteo API
- 🤖 ML-Powered - Advanced prediction models for disaster detection
- 📊 Data-Driven - Historical data collection for pattern learning
- 🚨 Early Alerts - Timely warnings before disasters strike
- 🔓 Open Source - Transparent, auditable disaster prediction
- 📦 Containerized - Docker support for easy deployment
- 🌐 Multi-City Monitoring - Track weather in 100+ target cities
- 📡 Real-Time Data Fetching - Hourly API calls to Open-Meteo
- 💾 Intelligent Storage - Optimized CSV format with deduplication
- 📈 Time-Series Data - Historical data for ML model training
- 🔄 Automated Scheduler - Continuous background data collection
- 🔍 Data Validation - Quality checks and anomaly detection
- 📉 Data Aggregation - Multi-source weather data consolidation
- 🧠 Predictive Models - Neural networks for disaster prediction
- 📊 Pattern Recognition - Identify disaster precursor patterns
- 🎯 Ensemble Methods - Multiple ML models for accuracy
- 📉 Trend Analysis - Detect dangerous weather trends
- ⚖️ Risk Scoring - Quantify disaster probability
- 🔮 Forecasting - Multi-day ahead predictions
- 🚨 Multi-Level Alerts - Critical, High, Medium, Low severity
- 📱 Multi-Channel Alerts - Email, SMS, Push notifications
- 🗺️ Geo-Targeted Alerts - Location-specific warnings
- ⏰ Smart Timing - Alerts sent at optimal times
- 📋 Alert History - Track all predictions and alerts
- 👥 User Subscriptions - Customizable alert preferences
- 📊 Interactive Dashboards - Real-time weather visualization
- 🗺️ Global Heat Maps - Disaster risk heat maps
- 📈 Analytics Reports - Comprehensive system analytics
- 🎨 Data Visualization - Beautiful charts and graphs
- 📉 Historical Analysis - Pattern trends over time
| Layer | Technology | Purpose |
|---|---|---|
| Data Collection | Python 3.9+, Requests | API integration |
| Weather API | Open-Meteo | Real-time weather data |
| Data Storage | Pandas, CSV | Time-series storage |
| Scheduling | APScheduler | Automated task scheduling |
| Machine Learning | scikit-learn, TensorFlow | Prediction models |
| Notebooks | Jupyter (21.3%) | Model development & analysis |
| Containerization | Docker (1.1%) | Easy deployment |
| Logging | Python logging | System monitoring |
| Parameter | Description | Units |
|---|---|---|
| Temperature | Current, min, max | °C / °F |
| Humidity | Relative humidity | % |
| Precipitation | Rainfall amount | mm |
| Wind Speed | Current wind speed | km/h |
| Wind Direction | Wind direction | Degrees |
| Pressure | Atmospheric pressure | hPa |
| Cloud Cover | Cloud coverage | % |
| Visibility | Atmospheric visibility | km |
| UV Index | UV radiation intensity | - |
| Feels Like | Apparent temperature | °C |
- Python 3.9+
- ~2GB disk space for data
- Internet connection
- Docker (optional, for containerization)
-
Clone the repository
git clone https://github.com/Shaurya-dev7/WaveShield.git cd WaveShield -
Create virtual environment
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure system
cp config_template.yaml config.yaml # Edit config.yaml with your target cities and preferences -
Run the system
python main.py
# Build Docker image
docker build -t waveshield:latest .
# Run container
docker run -d \
-v $(pwd)/data:/app/data \
-v $(pwd)/logs:/app/logs \
--name waveshield \
waveshield:latest
# View logs
docker logs -f waveshield┌─────────────────────────────────────────────────┐
│ Open-Meteo Weather API │
│ (Global real-time weather data provider) │
└──────────────────┬──────────────────────────────┘
│
┌─────────▼─────────┐
│ Data Fetcher │
│ (requests module) │
└─────────┬─────────┘
│
┌─────────▼──────────┐
│ Data Validator │
│ (quality checks) │
└─────────┬──────────┘
│
┌─────────▼──────────────────┐
│ Storage Engine │
│ (pandas + CSV format) │
│ (deduplication) │
└─────────┬──────────────────┘
│
┌──────────┴──────────┐
│ │
┌───▼────┐ ┌──────▼────┐
│ CSV │ │ Historical│
│Files │ │ Data DB │
└────────┘ └───────────┘
│
┌───▼──────────────────────┐
│ ML Model Training │
│ (Jupyter Notebooks) │
│ (scikit-learn, TensorFlow)│
└───┬──────────────────────┘
│
┌───▼────────────────────┐
│ Prediction Engine │
│ (Disaster Detection) │
└───┬────────────────────┘
│
┌───▼──────────────────��─┐
│ Alert Generation │
│ (Multi-channel) │
└────────────────────────┘
Schedule Trigger (Hourly)
│
▼
Fetch Weather Data
│
▼
Validate Data Quality
│
▼
Check for Duplicates
│
▼
Transform & Normalize
│
▼
Append to CSV File
│
▼
Update Time-Series DB
│
▼
Run Prediction Models
│
▼
Generate Risk Scores
│
▼
Check Alert Thresholds
│
▼
Send Alerts (if needed)
│
▼
Log Operations
WaveShield/
├── src/
│ ├── __init__.py
│ ├── config.py # System configuration
│ ├── fetcher.py # Open-Meteo API integration
│ ├── storage.py # Data storage logic (pandas, CSV)
│ ├── logger.py # Logging configuration
│ ├── scheduler.py # Task scheduling engine
│ ├── data_validator.py # Data quality validation
│ ├── ml_models.py # ML prediction models
│ ├── alert_generator.py # Alert generation logic
│ └── utils.py # Helper functions
├── notebooks/
│ ├── exploratory_analysis.ipynb # Data exploration
│ ├── model_training.ipynb # ML model development
│ ├── disaster_pattern_analysis.ipynb # Pattern discovery
│ └── forecast_validation.ipynb # Model validation
├── data/
│ ├── weather_data/ # CSV files (auto-generated)
│ │ ├── city_1_data.csv
│ │ ├── city_2_data.csv
│ │ └── ...
│ └── models/ # Trained ML models
├── logs/
│ └── waveshield.log # Application logs (auto-generated)
├── main.py # Application entry point
├── requirements.txt # Python dependencies
├── config_template.yaml # Configuration template
├── Dockerfile # Docker containerization
└── README.md # This file
# Target cities for monitoring
cities:
- name: "New York"
latitude: 40.7128
longitude: -74.0060
- name: "Los Angeles"
latitude: 34.0522
longitude: -118.2437
- name: "Tokyo"
latitude: 35.6762
longitude: 139.6503
# Add more cities...
# API settings
api:
base_url: "https://api.open-meteo.com/v1/forecast"
timeout: 30 # seconds
# Scheduling
scheduler:
fetch_interval: 3600 # seconds (1 hour)
model_retrain_interval: 86400 # seconds (24 hours)
# Storage
storage:
data_dir: "./data/weather_data"
retention_days: 365 # Keep 1 year of data
batch_size: 100 # Rows per batch
# ML Models
ml:
model_type: "ensemble" # or "neural_network"
disaster_types:
- "hurricane"
- "flood"
- "storm"
- "earthquake"
prediction_horizon: 7 # days ahead
# Alerts
alerts:
channels:
- "email"
- "sms"
- "push"
severity_levels:
critical: 0.9
high: 0.75
medium: 0.5
low: 0.3
# Logging
logging:
level: "INFO"
log_file: "./logs/waveshield.log"
max_size: "10MB"{
'timestamp': datetime, # UTC time
'city': str, # City name
'latitude': float, # Location latitude
'longitude': float, # Location longitude
'temperature': float, # °C
'humidity': float, # %
'precipitation': float, # mm
'wind_speed': float, # km/h
'wind_direction': float, # degrees
'pressure': float, # hPa
'cloud_cover': float, # %
'visibility': float, # km
'uv_index': float, # -
'feels_like': float, # °C
'weather_code': int, # WMO code
}timestamp,city,latitude,longitude,temperature,humidity,precipitation,wind_speed,wind_direction,pressure,cloud_cover,visibility,uv_index,feels_like,weather_code
2024-01-15T12:00Z,New York,40.7128,-74.0060,5.2,65,0.0,15.4,230,1013.2,45,10.0,1.5,2.1,1
2024-01-15T13:00Z,New York,40.7128,-74.0060,6.1,60,0.0,16.2,235,1013.5,50,10.5,1.8,3.2,1
- Combines multiple algorithms
- Better accuracy and robustness
- Voting mechanism for predictions
- Deep learning approach
- LSTM for time-series
- Best for complex patterns
- XGBoost/LightGBM
- Fast training and inference
- Feature importance analysis
from src.ml_models import DisasterPredictor
# Initialize predictor
predictor = DisasterPredictor(model_type='ensemble')
# Load historical data
data = pd.read_csv('data/historical_weather.csv')
# Train models
predictor.train(data, disaster_types=['hurricane', 'flood', 'storm'])
# Save models
predictor.save_models('data/models/')
# Make predictions
risk_scores = predictor.predict(current_weather_data)| Disaster | Indicators | Lead Time |
|---|---|---|
| Hurricane | Wind speed, pressure, temp | 3-7 days |
| Flood | Precipitation, humidity, pressure | 1-3 days |
| Severe Storm | Cloud cover, wind, pressure | 6-24 hours |
| Tornado | Wind shear, humidity, pressure | 2-12 hours |
| Drought | Temperature, precipitation, humidity | 1-4 weeks |
| Landslide | Precipitation, soil data | 1-7 days |
Risk Score = Σ(weight_i × indicator_i) / Σ(weight_i)
Where:
- Risk Score ∈ [0, 1]
- 0.0-0.3 = Low Risk
- 0.3-0.6 = Medium Risk
- 0.6-0.8 = High Risk
- 0.8-1.0 = Critical Risk
# View system health
python -c "from src import metrics; metrics.print_system_health()"
# Generate report
python src/analytics.py --report daily --output report.pdfRun analysis in Jupyter:
jupyter notebook
# Available notebooks:
# - exploratory_analysis.ipynb: Data exploration and visualization
# - model_training.ipynb: ML model development
# - disaster_pattern_analysis.ipynb: Pattern discovery
# - forecast_validation.ipynb: Model accuracy validation# All tests
python -m pytest tests/ -v
# Specific module
python -m pytest tests/test_fetcher.py -v
# With coverage
python -m pytest tests/ --cov=src# Test full pipeline
python tests/test_integration.py
# Test API integration
python tests/test_api_integration.py# Start with systemd
systemctl start waveshield
systemctl status waveshield
# Or use supervisor
supervisord -c supervisord.conf
# Or screen/tmux
screen -S waveshield
python main.py# Monitor resource usage
python -c "from src import monitor; monitor.start_monitoring()"
# View metrics dashboard
python src/dashboard.pyContributions are welcome! Areas for improvement:
-
Model Improvements
- New disaster prediction algorithms
- Improved accuracy on existing models
- Real-time model updates
-
Feature Additions
- New weather parameters
- Additional disaster types
- Multi-language support
-
Data Sources
- Additional weather APIs
- Satellite imagery integration
- Seismic data integration
-
Infrastructure
- Distributed computing
- Cloud deployment optimization
- Database optimization
- Fork the repository
- Create a feature branch:
git checkout -b feature/NewModel - Make changes and test:
pytest tests/ - Commit:
git commit -m 'Add: New disaster prediction model' - Push:
git push origin feature/NewModel - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Shaurya Deep Rai - AI/ML & Data Science Engineer
- GitHub: @Shaurya-dev7
- Open-Meteo - Free weather API
- pandas - Data manipulation
- scikit-learn - Machine learning
- TensorFlow - Deep learning
- All contributors and researchers
- Open-Meteo API Documentation
- scikit-learn User Guide
- TensorFlow Documentation
- Disaster Prediction Research