fix(gdelt): ingest the 15-minute GKG bulk file, keep the DOC API as fallback
The DOC 2.0 API is per-IP quota'd (429 with no Retry-After) and only lands a fetch every 5-6 cycles, so gdel-t2 coverage was near zero. GDELT publishes the same articles every 15 minutes as static files with no key and no quota. ingest_gdelt now parses lastupdate.txt, downloads the newest *.gkg.csv.zip, filters rows to the CONFIG GDELT query terms (matched against GKG theme tokens), and maps each surviving row into the existing events.gdelt shape: title from PAGE_TITLE, url from DocumentIdentifier (so event_dedup on URL is unchanged), body = source domain, location_name/lat/lon from V2Locations, and PAGE_PRECISEPUBTIMESTAMP as source_timestamp. Publishing goes through _publish_unknown, so known URLs are skipped before they hit NATS. The DOC path (with its 429 backoff) still runs, but only when the bulk fetch itself fails.
This commit is contained in:
parent
fc0cd41b7a
commit
8f38ff6ff8
3 changed files with 516 additions and 1 deletions
|
|
@ -21,6 +21,9 @@ def _reset_backoff(monkeypatch):
|
|||
sources._gdelt_clear_backoff()
|
||||
monkeypatch.setattr(sources, "GDELT_BACKOFF_BASE", 300)
|
||||
monkeypatch.setattr(sources, "GDELT_BACKOFF_MAX", 1800)
|
||||
# These tests cover the DOC 2.0 path, which is now the fallback behind the
|
||||
# 15-minute bulk GKG file (tests/test_gdelt_bulk.py covers that path).
|
||||
monkeypatch.setattr(sources, "GDELT_BULK_ENABLED", False)
|
||||
yield
|
||||
sources._gdelt_clear_backoff()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue