Skip to content

Make the globe global: translingual feed, NWS rebalance, drop dead indices - #3

Open
brianlo06 wants to merge 3 commits into
mainfrom
feat/global-feed-and-dead-sources
Open

Make the globe global: translingual feed, NWS rebalance, drop dead indices#3
brianlo06 wants to merge 3 commits into
mainfrom
feat/global-feed-and-dead-sources

Conversation

@brianlo06

Copy link
Copy Markdown
Owner

Three changes that together address why the globe reads as US-only. Separate commits, independently revertable.

1. Ingest GDELT's translingual feed

lastupdate.txt is GDELT's English-only index and runs ~53% US on its own. The translingual feed — machine translation of 65 other languages — was measured over a live slot at 5.4% US:

UP 6.8%  IT 6.7%  GM 5.9%  US 5.4%  RS 5.2%  MX 4.9%  BR 4.9%  TU 4.8%  SP 4.4%  FR 3.6%
1499 insertable articles per slot (English feed: 1049)

Running both should take the combined stream to roughly 25% US.

Same format, so ingest_gkg_once(translation=True) switches index URL, watermark and source label together — the feeds never share a cursor.

The wrinkle: GDELT publishes the translingual GKG up to ~45 minutes behind the timestamp its own index advertises, so the advertised file usually 404s. first_available() walks back in 15-minute slots to the newest file that exists. Verified live: index said 20260904220000, walk-back resolved 20260904210000, 1375 insertable articles, 5.3% US.

2. Stop NWS crowding out world news

NWS is US-only and uncapped: ~225 alerts active at any moment, ~1700 per 48h, against ~1000 articles per GDELT slot. On the old scale a Minor alert scored 0.40 — above the frontend's 0.3 floor and above the median GKG article (0.55). Measured before this change:

/events/recent -> 1740 of 1945 events were NWS
5 largest clusters: all thunderstorm warnings (n=261, 213, 180, 100, 72)

Drop Minor and Unknown at ingest (~60% of the feed), and rescale the rest so only severe weather competes: Extreme 0.95 -> 0.85, Severe 0.80 -> 0.60, Moderate 0.60 -> 0.35. Tornado and hurricane warnings still surface as breaking.

3. Remove the dead Stooq ingester

All 16 instruments 404 — verified per symbol, with bot and browser User-Agents, on both stooq.com and stooq.pl. Their history CSV routes now serve a JS anti-bot challenge, so there's no URL fix.

Worse than log noise: the stale rows were still being served. /markets returned 14 index quotes last updated 2026-06-07, drawn on the globe as if live. sql/019 drops them. The 17 Frankfurter FX pins are unaffected and working.

Numbered 019 to leave 018 free for the probes migration that currently exists only on the prod box.

Verification

231 passed, 10 subtests passed — 220 existing plus 11 new covering the slot walk-back (including network errors mid-walk and the window boundary) and the severity scale.

Capacity note before deploying

The translingual feed roughly doubles articles per cycle, and every one gets embedded. The ingest container is capped at cpus: 1.0 on a 2 GB box and a run already takes ~17 minutes of CPU against a 15-minute loop. Worth watching docker compose logs ingest for cycle time after deploying — if runs stretch past the interval, the fix is to raise the sleep or cap articles per slot, not to drop the feed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TDChXPFeJKSfoVudk2GKwP

Brian Lo and others added 3 commits September 4, 2026 17:54
The English lastupdate.txt runs ~53% US. Measured over a live 15-minute
slot, the translingual feed — GDELT's machine translation of 65 other
languages — runs 5.4%, and its top countries are Ukraine, Italy, Germany,
Russia, Mexico, Brazil, Turkey and Spain rather than a US/UK duopoly. It
also carries comparable volume (1499 insertable articles vs 1049), so
running both takes the combined stream to roughly 25% US.

Same format, so ingest_gkg_once() takes translation=True and switches
index URL, watermark and source label together; the two feeds never share
a cursor.

The one wrinkle is that GDELT publishes the translingual GKG up to ~45
minutes behind the timestamp its own index advertises, so the advertised
file usually 404s. first_available() walks back in 15-minute slots to the
newest file that exists, rather than losing the cycle.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDChXPFeJKSfoVudk2GKwP
NWS is a US-only firehose: ~225 alerts active at any moment, ~1700 in a
48h window, against ~1000 articles per GDELT slot. On the old scale a
*Minor* alert scored 0.40 — above the frontend's 0.3 floor and above the
median GKG article — so routine US weather dominated the globe and the
cluster list. Before this change /events/recent returned 1740 NWS rows out
of 1945, and the five largest clusters were all thunderstorm warnings.

Drop Minor and Unknown at ingest (~60% of the feed, and not world news),
and rescale the rest so only genuinely severe weather competes:
Extreme 0.95 -> 0.85, Severe 0.80 -> 0.60, Moderate 0.60 -> 0.35.
Tornado and hurricane warnings still surface as breaking; a routine
thunderstorm advisory no longer outranks a foreign election.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDChXPFeJKSfoVudk2GKwP
Stooq retired its /q/l/ quote-CSV endpoint. All 16 instruments 404 with
"The page you requested does not exist or has been moved" — verified
against every symbol, with both a bot and a browser User-Agent, on
stooq.com and stooq.pl. Their history CSV routes now serve a JavaScript
anti-bot challenge, so there is no drop-in URL fix.

Worse than the log noise: the rows were still being served. /markets was
returning 14 index quotes last updated 2026-06-07, rendered on the globe
as if live.

Delete the ingester and its runner, and drop the stale rows. The 17
Frankfurter FX pins are unaffected — they use "FX:" symbols, cover the
same financial centres, and are working.

Numbered 019 to leave 018 free for the probes migration that currently
exists only on the prod box.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDChXPFeJKSfoVudk2GKwP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant