This is my machine learning project to predict flood and drought occurrences in Northern Cameroon
# 🌊🌾 SAPE-EN — Flood & Drought Early Warning System
## Northern Cameroon · 89 Sub-Departments · 6 User Roles
A complete, production-ready, role-based AI-powered early warning system providing
**7-day daily flood forecasts** and **6-month drought forecasts** for
**89 sub-departments** across 15 departments of Northern Cameroon.
**Version 2.1** | FastAPI + PostgreSQL + TensorFlow + XGBoost + React + Leaflet + GEE
---
## 📋 Table of Contents
1. Features
2. User Roles & Access Rules
3. Quick Start
4. Creating Users
5. API Reference
6. AI Models
7. Architecture
8. Environment Variables
---
## Features
- **Interactive choropleth map** with 89 coloured sub-departments and rich tooltips (risk %, SPI, rainfall)
- **AI-powered forecasts**: Conv1D-LSTM + XGBoost for flood (23 features), Bidirectional LSTM + XGBoost for drought (17 features)
- **Dual flood data source**: AI model (LSTM/XGBoost) + Open-Meteo live weather with toggle
- **Per-sub-department caching** for Open-Meteo (daily, persists to disk)
- **Role-based dashboards**: 6 distinct UIs for farmers, agents, officials, herders, humanitarians, and admins
- **SMS alerts**: Multi-language (Fulfulde/French/English) with emoji risk indicators
- **Admin panel**: Model training, dataset management (update/repair/backfill/drought), user management, GEE integration
- **Risk Reports**: Printable risk zone reports with department breakdowns, hotspots, and recommendations
- **4-language UI**: English, French, Fulfulde, Arabic
- **Responsive design**: Works on desktop, tablet, and mobile
- **Cache refresh**: `POST /api/admin/refresh-cache` rebuilds feature caches after dataset updates without server restart
---
## User Roles & Access Rules
| # | Role | Dashboard | Registration | Login | Data Scope | Timing | SMS |
|---|------|-----------|-------------|-------|------------|--------|-----|
| 1 | **Farmer** | `/farmer` | Agent creates | Phone + PIN | Own sub-dept only | 24h (days 5-7) | ✅ |
| 2 | **Agent** | `/agent` | Adm …