# Ghana Rain Nowcasting (30-Minute Prediction)
**An AI-powered machine learning system for real-time rainfall forecasting in Accra, Ghana**
This project collects real-time weather data, engineers predictive features, trains a machine learning model, and provides 30-minute rain forecasts through an interactive web dashboard.
## 🌟 Features
- ✅ **Real-time Data Collection** - Automatic weather data fetching every 10 minutes
- ✅ **Advanced Feature Engineering** - Rolling windows, lag features, derived meteorological indicators
- ✅ **Robust ML Model** - Random Forest with cross-validation and performance metrics
- ✅ **Prediction Confidence** - Probability scores and confidence levels for each forecast
- ✅ **Interactive Dashboard** - Beautiful Streamlit interface with charts and metrics
- ✅ **Production-Ready** - Error handling, logging, validation, and monitoring
- ✅ **Secure** - Environment variable management for API keys
## 🏗️ System Architecture
```
OpenWeather API (10-min interval)
↓
Data Collection & Validation
↓
Feature Engineering (rolling, lag, derived features)
↓
Data Cleaning & Preprocessing
↓
Train/Test Split with Stratification
↓
Random Forest Classifier (300 trees)
↓
Cross-Validation & Metrics
↓
Live Prediction Module
↓
Streamlit Dashboard (Real-time visualization)
```
## 📁 Project Structure
```
Ghana Rain Forecast/
├── app/
│ └── dashboard.py # Streamlit web dashboard
├── src/
│ ├── __init__.py
│ ├── config.py # Centralized configuration
│ ├── logger.py # Logging setup
│ ├── collect_data.py # API data collection with validation
│ ├── preprocess.py # Feature engineering & preprocessing
│ ├── train_model.py # Model training with validation
│ ├── predict.py # Prediction module with confidence scores
│ ├── rain_model.pkl # Trained model (generated)
│ ├── model_metrics.json # Model evaluation metrics (generated)
│ └── feat …