# FloodWatch Ghana 🌊
A production flood-risk platform for Ghana. Two combined features:
1. **Flood-risk scoring & mapping** — check a flood-risk score for any location/area
in Ghana before buying land, building, living, or starting a business. Built from
historical flood records, rainfall time-series, elevation/DEM, drainage/slope,
land cover, and known Accra hotspots (Kaneshie, Circle, Adabraka, Alajo).
2. **Trotro route flood alerts** — combines the risk layer with live/forecast rainfall
to predict which trotro routes flood before and during rain, and pushes route-level
warnings to commuters.
## Architecture
```
┌──────────────┐
Open data ──ETL──▶│ PostGIS │◀── H3 hex scoring tiles
(GPM/IMERG, │ (Supabase) │
SRTM DEM, └──────┬───────┘
Sentinel LC, │
OSM roads) ┌──────▼───────┐ ┌──────────────┐
│ FastAPI │◀────▶│ Redis │ cache + rate limit
ML model ────────▶│ (inference) │ └──────────────┘
(logistic + └──────┬───────┘
gradient boost) │ OpenAPI / JWT (Supabase Auth)
┌──────▼───────┐
│ Next.js + │ MapLibre GL interactive risk map
│ React │ + trotro route alerts
└──────────────┘
```
| Layer | Tech |
|-----------|----------------------------------------------------------|
| Frontend | Next.js 14 (App Router), React, MapLibre GL, TypeScript |
| Backend | FastAPI, SQLAlchemy (async), Alembic, Pydantic v2 |
| Data | Supabase Postgres + PostGIS, H3 hex index, Redis |
| ML | scikit-learn (logistic baseline), LightGBM (upgrade) |
| ETL | httpx workers, APScheduler cron (rainfall refresh) |
| Infra | Docker Compose (local); Neon + Render + Vercel (deploy) |
## Quick start (local)
```bash
cp .env.example .env # fill in Supabase + Mapbox/MapLibre keys
docker compose up --build # postgis + redis + backend + worker + frontend
# backend →
localhost …