fix(gdelt): ingest the 15-minute GKG bulk file, keep the DOC API as fallback #70
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/gdelt-bulk-gkg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
osint-dashboard#69made a GDELT 429 back off instead of tracebacking, but thatonly stopped the noise. The DOC 2.0 API is per-IP quota'd from every egress we
have, and
events.source_type='gdel-t2'was 634 rows total over 5 days withhour-long gaps (measured: 0-50/hour, most hours 1-15).
GDELT publishes the same article coverage every 15 minutes as static files with
no key and no quota:
https://data.gdeltproject.org/gdeltv2/lastupdate.txt(200 from inside the ingester pod) indexes
*.export.CSV.zip,*.mentions.CSV.zipand*.gkg.csv.zip.What
ingest_gdeltnow:lastupdate.txt, picks the newest*.gkg.csv.zip(GKG is the file witharticle URL + title + geo), and skips the cycle if it is the file already parsed;
(
(unrest OR protest OR outage OR cyber OR "power outage")) matched against theGKG V1Themes tokens —
POWER_OUTAGE,VIOLENT_UNREST,CYBER_ATTACK, …so a 500-1000 row window publishes a bounded subset, not the whole file;
events.gdeltshape the NATS consumeralready expects:
url=DocumentIdentifier→event_dedupon URL still works unchangedtitle=<PAGE_TITLE>from the V2ExtrasXML column (html-unescaped)body= source domain,location_name/location_lat/location_lonfromV2Locations(map pins get real geo)source_timestamp=<PAGE_PRECISEPUBTIMESTAMP>, falling back to the window stamptags= matched query terms + matching theme tokens (max 10)raw= compact GKG subset (record id, domain, themes[:12], tone, bulk file)_publish_unknown, so URLs already inevent_dedupneverreach NATS, and
GDELT_BULK_MAX_EVENTS(default 100) caps a single file.The DOC 2.0 path is kept as
_ingest_gdelt_doc, with its 300s→1800s 429backoff, and only runs when the bulk fetch raises. On the happy path GDELT gets
zero API requests.
Volume
GKG windows measured today: 451-1082 rows, 32-87 matching the CONFIG terms;
eventsis on a 180-day retention policy, so ~100-250 new rows/hour is withincomfort at 12 MB for 10k rows.
Tests
tests/test_gdelt_bulk.py(9 new): query-term parsing, lastupdate selection,row mapping (title/geo/timestamp/tone), non-matching and URL-less rows dropped,
cap, repeat-file skip, DOC fallback on bulk failure.
tests/test_gdelt_backoff.pyfixture now disables the bulk path so it keepspinning DOC behaviour. Full suite: 432 passed, 3 failed
(
test_geodence::test_camera_publish_and_insert_do_not_notify,test_hud_chromex2) — those 3 fail identically on unmodifiedmasteratfc0cd41.