2 Commits

Author SHA1 Message Date
Fayez Bast
9d94ad36aa feat(climate+health):add shared air quality seed and mirrored health (#2634)
* feat(climate+health):add shared air quality seed and mirrored health/climate RPCs

* feat(climate+health):add shared air quality seed and mirrored health/climate RPCs

* fix(air-quality): address review findings — TTL, seed-health, FAST_KEYS, shared meta

- Raise CACHE_TTL from 3600 to 10800 (3× the 1h cron cadence; gold standard)
- Add health:air-quality to api/seed-health.js SEED_DOMAINS so monitoring dashboard tracks freshness
- Remove climateAirQuality and healthAirQuality from FAST_KEYS (large station payloads; load in slow batch)
- Point climateAirQuality SEED_META to same meta key as healthAirQuality (same seeder run, one source of truth)

* fix(bootstrap): move air quality keys to SLOW tier — large station payloads avoid critical-path batch

* fix(air-quality): fix malformed OpenAQ URL and remove from bootstrap until panel exists

- Drop deprecated first URL attempt (parameters=pm25, order_by=lastUpdated, sort=desc);
  use correct v3 params (parameters_id=2, sort_order=desc) directly — eliminates
  guaranteed 4xx retry cycle per page on 20-page crawl
- Remove climateAirQuality and healthAirQuality from BOOTSTRAP_CACHE_KEYS, SLOW_KEYS,
  and BOOTSTRAP_TIERS — no panel consumes these yet; adding thousands of station records
  to every startup bootstrap is pure payload bloat
- Remove normalizeAirQualityPayload helpers from bootstrap.js (no longer called)
- Update service wrappers to fetch via RPC directly; re-add bootstrap hydration
  when a panel actually needs it

* fix(air-quality): raise lock TTL to 3600s to cover 20-page crawl worst case

2 OpenAQ calls × 20 pages × (30s timeout × 3 attempts) = 3600s max runtime.
Previous 600s TTL allowed concurrent cron runs on any degraded upstream.

---------

Co-authored-by: Elie Habib <elie.habib@gmail.com>
2026-04-03 10:27:37 +04:00
Elie Habib
3ee05763b3 docs: health and climate variant full implementation plans (#2466)
* docs: add full health and climate variant implementation plans

Define data layers, APIs, seed scripts, proto RPCs, cache keys,
and MCP tool specs for building health.worldmonitor.app and
climate.worldmonitor.app as proper data-rich variants beyond RSS.

* docs: fix spec issues flagged in PR review

- Fix VaccinationCoverageItem proto: add missing id field = 1
- Fix baseline code example: remove contradictory 2014-2023 proxy window,
  clarify that full 1991-2020 WMO period is required (warm decade proxy
  would systematically understate current anomalies)
- Fix TTL inconsistencies: climate disasters 12h->6h, climate+health
  air quality 3h->1h (align schedule tables with per-layer specs)
- Add AGENTS.md mandatory 4-file checklist (cache-keys, bootstrap.js,
  mcp.ts, seed-meta) to Cache Keys sections in both docs
2026-03-29 11:59:57 +04:00