A Prophet forecasting web app for drought prediction in Turkana County
# Drought Predictor
A web application that provides NDVI-based drought forecasting for Turkana County, Kenya. The system helps pastoralists make informed decisions about livestock management and migration planning by visualizing historical vegetation conditions and predicting future drought events.
## Overview
The Drought Predictor consists of:
- **React Frontend**: Interactive dashboard with data visualization, forecasts, and drought alerts
- **FastAPI Backend**: REST API server with ML model inference (Prophet and LSTM)
- **ML Models**: Pre-trained Prophet and LSTM models for NDVI forecasting
## Features
- Historical NDVI data visualization (2017-2026)
- Dual forecasting models (Prophet and LSTM)
- Configurable forecast horizons (2, 4, or 6 weeks)
- Drought severity classification (Normal, Alert, Alarm, Emergency)
- Pastoralist-friendly insights and recommendations
- Interactive charts with confidence intervals
- Real-time drought event markers
## Technology Stack
**Frontend:**
- React 18+
- Recharts for data visualization
- Axios for API requests
**Backend:**
- FastAPI
- Prophet (fbprophet) for time series forecasting
- TensorFlow/Keras for LSTM inference
- Pandas for data processing
- Mangum for AWS Lambda compatibility
## Prerequisites
**Frontend:**
- Node.js 16+ and npm
**Backend:**
- Python 3.10+
- pip
## Setup Instructions
### Backend Setup
1. Navigate to the server directory:
```bash
cd server
```
2. Create a virtual environment:
```bash
python -m venv venv
```
3. Activate the virtual environment:
- Windows: `venv\Scripts\activate`
- macOS/Linux: `source venv/bin/activate`
4. Install dependencies:
```bash
pip install -r requirements.txt
```
5. Create a `.env` file based on `.env.example`:
```bash
cp .env.example .env
```
6. Edit `.env` to configure your environment variables
7. Ensure model files are present in `server/models/`:
- `ndvi_prophet_model.pkl`
- `ndvi_lstm_model.keras`
- `ndvi_lstm_scaler.pkl`
8. Ensure the CSV data file exi …