fix(seeds): migrate IMF seeders to SDMX 3.0 API#3020
Conversation
IMF DataMapper API (www.imf.org/external/datamapper/api/v1) is now blocked by Akamai WAF via JA3 TLS fingerprinting. The old SDMX endpoint (dataservices.imf.org) was decommissioned in 2025. Switch all 3 IMF-consuming seeders to the new SDMX 3.0 API at api.imf.org/external/sdmx/3.0/ which is accessible without proxy. - Add imfSdmxFetchIndicator() to _seed-utils.mjs - Migrate seed-recovery-fiscal-space.mjs (FM indicators to WEO equivalents) - Migrate seed-imf-macro.mjs - Migrate seed-national-debt.mjs
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR migrates all three IMF-consuming seeders from the blocked DataMapper API to the new SDMX 3.0 endpoint (
Confidence Score: 4/5Safe to merge for WEO usage, but the COUNTRY dimension position bug in One P1 finding: the exported helper hardcodes COUNTRY at series-key position 0 despite resolving it by ID, which would silently produce wrong country mappings for any non-WEO database. The fix is a one-liner (use scripts/_seed-utils.mjs — specifically the Important Files Changed
Sequence DiagramsequenceDiagram
participant S as Seed Script
participant U as _seed-utils.mjs
participant IMF as api.imf.org (SDMX 3.0)
participant R as Upstash Redis
S->>U: imfSdmxFetchIndicator(indicator, { years })
U->>IMF: GET /external/sdmx/3.0/data/dataflow/IMF.RES/WEO/+/*.{indicator}.A
IMF-->>U: SDMX JSON (structures + dataSets)
U->>U: parse dimensions.series[0] → countryValues
U->>U: parse dimensions.observation → timeValues
U->>U: build { iso3 → { year → value } }
U-->>S: Record<ISO3, Record<year, number>>
S->>S: computeEntries / build countries map
S->>U: atomicPublish(canonicalKey, data)
U->>R: SET staging key (5 min TTL)
U->>R: SET canonical key (35 day TTL)
U->>R: DEL staging key
S->>U: writeFreshnessMetadata(domain, resource, ...)
U->>R: SET seed-meta:domain:resource
Reviews (1): Last reviewed commit: "fix(seeds): migrate IMF seeders from blo..." | Re-trigger Greptile |
…tches - Use findIndex for COUNTRY dimension position instead of hardcoding 0 (fixes potential wrong mappings for non-WEO databases like FM) - Wrap SDMX fetch in withRetry(fn, 2, 2000) for transient network errors - Switch fiscal-space to Promise.all (no rate limit on api.imf.org)
Summary
www.imf.org/external/datamapper/api/v1) is now blocked by Akamai WAF via JA3 TLS fingerprinting (HTTP 403 for all non-browser clients, including residential proxies)dataservices.imf.org) was decommissioned by IMF in 2025api.imf.org/external/sdmx/3.0/which works without proxyimfSdmxFetchIndicator()to_seed-utils.mjsthat returns data in the same ISO3-keyed shapeIndicator mapping (DataMapper to WEO SDMX)
GGR_G01_GDP_PTGGR_NGDPGGXCNL_G01_GDP_PTGGXCNL_NGDPGGXWDG_NGDP_PTGGXWDG_NGDPPCPIPCHPCPIPCHBCA_NGDPDBCA_NGDPDNGDPDNGDPDTest plan
imfSdmxFetchIndicatorsmoke test: 208 countries, correct values for USA/GBR/DEUnode --test tests/seed-bundle-resilience-recovery.test.mjspasses (13/13)node --test tests/national-debt-seed.test.mjspasses (10/10)