We predict where a fire will be in 1 h and 2 h, tell each village how many minutes it has left, and send an emergency alert to every phone in the area (UK-style, simulated on test phones).
Build spec (stack, owners, phases): SPEC.md. Contracts: docs/contracts.md. Work: GitHub issues, labelled phase 1|2|3 and frontend|backend.
Needs Python 3.11, Node 22.12+ and git. On Windows use WSL, or run the commands inside the Makefile by hand.
No python3.11 on your machine? uv venv -p 3.11 .venv && uv pip install -p .venv -r requirements-dev.txt does the same as make setup.
git clone <repo-url> && cd <repo>
make setup # .venv + deps + .env from .env.example (or the uv command above)
npm ci # root install: npm workspaces (dashboard, api) + Turborepo
npx turbo dev # API on http://localhost:8000 + dashboard on http://localhost:5173/dashboard/ (or `make dev`).venv must exist before any turbo command: the api workspace (api/package.json) only wraps the Python tools
(.venv/bin/python -m uvicorn, .venv/bin/ruff, .venv/bin/python -m pytest) and runs them from the repo root.
- Every check:
npx turbo lint typecheck test build(ruff + pytest for the API; ESLint,tscandvite buildfor the dashboard). Turborepo caches each task, so a second run only re-runs what changed. The Python checks also run alone withmake lint test. - Dashboard (Civil Protection): in dev,
http://localhost:5173/dashboard/(Vite hot reload, API calls proxied to :8000). For the demo,make dashboard-buildwritesdashboard/dist/andmake apiserves it athttp://localhost:8000/dashboard/. Without a build, the API still starts and logs a warning. - One side only:
make api(API alone, also serves the built dashboard) ormake dashboard-dev(Vite alone). - One lockfile: the root
package-lock.json. Add dashboard packages withnpm install <pkg> --workspace dashboard. - After changing
api/schemas.py, runnpm run gen:api --workspace dashboard(API running) and commitdashboard/src/api/schema.ts. - Test phone alert page:
make lan-ipprintshttp://<laptop-ip>:8000/alert/. Open it on each phone (same Wi-Fi) and tap arm. - API docs (auto):
http://localhost:8000/docs
Without data files, the API runs on stubs: fake villages (stub: ids) and one synthetic fire, all flagged stub.
Frontend work can start right away. Real data drops in with no code change (see data/README.md).
Needs only Docker with Compose v2 (no Python or Node on the machine). One image holds the API, the built dashboard and
the phone page; docker-compose.yml runs it as one api service on port 8000 (PORT=8040 make docker-up to change it).
make docker-up # docker compose up -d --build → http://localhost:8000/dashboard/ and /alert/
make docker-logs # follow the API logs
make docker-down # stop and remove the container.envis read at runtime (env_file, optional), never copied into the image.data/out/andmodel/artifacts/are mounted read-only from the repo folder. Without them the API runs on stubs, as in the 5-minute setup. After dropping new files in,docker compose restartpicks them up: no rebuild.- Rebuild (
make docker-up) only after a code change.GET /healthshowsplaces: realoncedata/out/places.parquetis there. - The container runs as a non-root user (uid 10001) and has a health check on
/health(docker compose ps).
cp .env.example .env, then setOPERATOR_TOKENin.env(write endpoints need it; enter the same token in the dashboard's Settings panel).- Put the data files in
data/out/(*.parquet) and the exported model inmodel/artifacts/. make docker-up, thendocker compose psuntil the service ishealthy.- Projector/operator: open
http://<laptop-ip>:8000/dashboard/(make lan-ipprints the laptop address). - Phones (same Wi-Fi): open
http://<laptop-ip>:8000/alert/and tap arm. - New data or model files during the day: drop them in, then
docker compose restart(no rebuild).
| Folder | What | Owner |
|---|---|---|
data/ |
firedata pipeline (5 scripts, kept as is) → data/out/*.parquet |
Electronics (+ AI) |
model/ |
baselines A/B, LightGBM C, threshold tuning, scoreboard, export | AI |
api/ |
FastAPI: contract endpoints, replay, impact (minutes left), alert rules + SSE stream | Full stack |
dashboard/ |
Civil Protection dashboard: fire map, risk layer, AI approval queue, alerts, scoreboard, planting (React + TypeScript + Vite, react-leaflet; built into dashboard/dist/ and served by FastAPI) |
Full stack (design: UI/UX 2) |
alert/ |
phone web page that imitates a cell-broadcast alert (demo) + texts.json (4 languages) |
Full stack (texts: Commerce) |
core/ |
config loader + geometry shared by model and api | AI |
docs/ |
contracts, demo script | all |
pitch/ |
deck, Q&A sheet, facts | Commerce + UI/UX 2 |
Every threshold and path lives in config.yaml, never in code.
make check-columns # does train.parquet match config.yaml → columns?
make model # train C (mixed + Algeria-only), tune thresholds, scoreboard on held-out fires
make export TAG=mixed # publish for the API, only if C beats B on missed villages and lead timeRules: evaluate on whole held-out fires (Kabylie 5–16 Aug 2021, Jijel/Guelma 26 Aug–8 Sep 2026), always next to A and B.
Thresholds target ≥ 95% of burned cells inside the zone, and false alarms are reported honestly. Training weather is ERA5
reanalysis (a perfect forecast); say so wherever accuracy is quoted. No number gets invented: if it's not measured, it's null.
main: PRs only, CI (ruff + pytest) must pass, 1 review. (Not enforced by GitHub yet: a repo admin should turn on branch protection.)- One branch per role:
ai,fullstack,uiux-alert,uiux-dashboard,data,commerce. Keep PRs small and frequent. - Never commit data,
.parquet, model artifacts or.env.FIRMS_MAP_KEYlives in.envonly. - Changing
docs/contracts.mdorapi/schemas.pyneeds a note in the team chat naming who it affects.
- Map tiles come from OpenStreetMap, so they need internet. Keep a phone hotspot as backup.
- Phones over plain HTTP can't use Wake Lock, so set each test phone's auto-lock to "never".
POST /reset(dashboard → Reset demo) between rehearsals.GET /healthshowsphones_connected.
Credit: fire detections from NASA FIRMS (VIIRS 375 m) via the Algeria Fire Map open-source export; OpenStreetMap; Copernicus DEM; ESA WorldCover; Open-Meteo (ERA5).