# 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 β¦