π¦ Nepal AQI early-warning β package summary
β What you have
Source code (GitHub β recommended)
Repository: https://github.com/mamta2009/aqinepal2026
git clone https://github.com/mamta2009/aqinepal2026.git
cd aqinepal2026/early-warning-system
Documentation for behaviour and APIs: IMPLEMENTATION_SNAPSHOT.md (this folder).
Hands-on Cursor walkthrough: CURSOR_SETUP_GUIDE.md β same /guides URLs as the running site.
Optional ZIP delivery
An early-warning-system.zip (if someone shared one) mirrors the early-warning-system/ folder: backend, landing/ (marketing /guides via guides.html, /registration, /admin/dashboard), frontend/, config/, docs/ (guides under docs/guides/).
π Getting started (~10 minutes)
git clone https://github.com/mamta2009/aqinepal2026.git
cd aqinepal2026/early-warning-system/backend
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env β Mongo keys, AQ keys, NOTIFICATION_API_KEY, etc.
python -m uvicorn main:app --reload --host 127.0.0.1 --port 8000
Use http://127.0.0.1:8000 in the browser (avoid http://0.0.0.0:8000 β often blank).
| Page | URL |
|---|---|
| Marketing landing | http://127.0.0.1:8000/ |
| Guides hub | http://127.0.0.1:8000/guides |
| Registration | http://127.0.0.1:8000/registration |
| Dashboard | http://127.0.0.1:8000/frontend/index.html |
| Operator admin | http://127.0.0.1:8000/admin/dashboard |
| OpenAPI | http://127.0.0.1:8000/docs |
π Documentation index (in-repo)
| File | Purpose |
|---|---|
README.md |
Repository root β points into early-warning-system/ |
../../README.md |
App early-warning-system/README.md stub (links here) |
IMPLEMENTATION_SNAPSHOT.md |
Canonical APIs, env, Mongo, AQ resolver, /api/admin/* |
CURSOR_SETUP_GUIDE.md |
Cursor-centric setup |
README.md |
Guides index β lists every docs/guides/*.md topic |
blockchain-ai/README.md |
Polygon / on-chain Markdown (companion docs/blockchain-ai/*.py stubs) |
../blockchain-ai/README.md |
Short pointer from docs/blockchain-ai/ into this folder |
Older β/outputsβ or duplicate guides elsewhere may exist from packaging history; IMPLEMENTATION_SNAPSHOT.md wins when wording conflicts with the running code.
β What runs out of the box
- FastAPI backend, static
/frontend,landing/pages,GET /guides,GET /admin/dashboard - Synthetic weekly health patterns (
health_data_generator.py) unless you integrate DHIS2 or other feeds - Air-quality resolver (WeatherAPI β WAQI β Rapid, per snapshot) plus supplementary weather routes where keys exist
provenance/ A2A-style hints on responses when integrations return data- Regional/national demo mode flags in payloads
- Optional MongoDB enrollees, logs, broadcasts when
MONGODB_URL(orDATABASE_URL) is set - Optional Twilio / Resend when configured;
NOTIFICATION_API_KEYprotects operator notification JSON routes (and admin JSON under/api/admin/*) - Blockchain helpers and optional gas-spend on Polygon β off by default; product wiring in
backend/onchain_hooks.py, operator audit in Mongoonchain_anchor_log(docs/guides/blockchain-ai/README.md)
π Repository layout (app tree)
early-warning-system/
βββ backend/ β main.py, admin_panel.py, notifications_api.py, β¦
βββ landing/ β landing.html, guides.html, registration_portal.html, admin_dashboard.html
βββ frontend/index.html
βββ config/.env.example
βββ docs/
β βββ guides/ β Every public Markdown file + `/guides/md/β¦` rendering
β βββ tech/*.svg β Architectural diagrams (/guides/media/tech/β¦)
β βββ blockchain-ai/ β Reference Python only (guides live under docs/guides/blockchain-ai/)
βββ docs-private/ β Internal markdown β `/admin/dashboard` β Private documentation
βββ render.yaml
βββ README.md
β‘ Smoke test (quick)
curl http://127.0.0.1:8000/api/health
curl http://127.0.0.1:8000/api/cases/week/Kathmandu
curl "http://127.0.0.1:8000/api/air-quality/current?city=Kathmandu"
π€ Deploy
- Repo is already on GitHub: mamta2009/aqinepal2026. Fork or mirror to a private repo if you must exclude materials under
docs-private/from publication. - Connect Render (or another host): run
uvicornfromearly-warning-system/backendwith production env vars. Seeearly-warning-system/render.yamlas a starting blueprint. - Hosting cost depends on provider and tiers β size the service to traffic and MongoDB separately.
π§ Troubleshooting (short)
| Problem | Fix |
|---|---|
| βModule not foundβ | Activate backend/.venv; pip install -r backend/requirements.txt |
| Port 8000 in use | python -m uvicorn main:app --reload --host 127.0.0.1 --port 8001 |
| Blank browser page | Use 127.0.0.1 or localhost, not 0.0.0.0 |
| CORS | Prefer http://127.0.0.1:8000/frontend/index.html (same origin as API) |
| Admin JSON 401 / 403 | Set NOTIFICATION_API_KEY in backend/.env; send Authorization: Bearer β¦ |
π― Realistic demo data vs production
Weekly case curves are synthetic WHO-style patterns suitable to prove dashboards and alerting β not a substitute for ministry surveillance until you swap the pipeline. See IMPLEMENTATION_SNAPSHOT.md for what is keyed vs heuristic.
Last aligned with docs: May 2026 (repository aqinepal2026, branch main). Update this file if the canonical snapshot or URLs change.