Thermograph monorepo: graded-climate API + SSR frontend + infra, domain-specific containerized deploys
A card read "Shanghai · 30°C · Near Record hot · Low temp · 99th pct" while the Day page for the same cell said 26°C, 66th pct, Above Normal. Both were right about the climatology — the normals matched exactly — but the strip was grading a reading from several days earlier and presenting it as current. Two causes, both mine: - load_cached_recent_forecast deliberately ignores how stale the file is, and _grade_city took the newest row <= today with no age check at all. - Nothing keeps that cache current for the tracked cities. warm_cities.py skips any city whose archive is already cached, so it never re-fetches their forecast bundle, and the notifier only touches subscribed cells. So "zero upstream calls" was satisfied by reading a cache nothing refreshes. Fixes: - Drop readings older than MAX_OBSERVATION_AGE_DAYS (1) instead of ranking them. Cities span a day of timezones, so a current observation can still be dated yesterday in UTC — hence 1 rather than 0. - Top up the stalest cells' recent/forecast each pass, oldest first and capped (THERMOGRAPH_HOMEPAGE_REFRESH, default 40), the same shape as the notifier's archive-fetch budget. This is a real change: the sweep is no longer zero-cost upstream, because it cannot be and still say "right now". Documented in DEPLOY.md, and refresh(fetch=0) keeps a strictly cache-only rebuild. - Rank over the top THERMOGRAPH_HOMEPAGE_CITIES (250) rather than all ~1000. The strip shows ~12 cards; a smaller genuinely-fresh set beats a large stale one. - Show the observation date on a card when it isn't today's, so a yesterday reading can't silently pass for current. |
||
|---|---|---|
| templates | ||
| tests | ||
| api_accounts.py | ||
| app.py | ||
| audit.py | ||
| cities.json | ||
| cities.py | ||
| cities_flavor.json | ||
| city_events.py | ||
| climate.py | ||
| content.py | ||
| db.py | ||
| digest.py | ||
| gen_cities.py | ||
| gen_flavor.py | ||
| grading.py | ||
| grid.py | ||
| homepage.py | ||
| indexnow.py | ||
| mailer.py | ||
| metrics.py | ||
| migrate.py | ||
| models.py | ||
| notify.py | ||
| places.py | ||
| push.py | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| schemas.py | ||
| singleton.py | ||
| store.py | ||
| users.py | ||
| views.py | ||
| warm_cities.py | ||