Purpose: Complete reference for every IMF dataflow, dimension, frequency, code list, release cadence, projection horizon, and known quirk that Riksdagsmonitor consumes. Read this before adding a new IMF indicator, debugging a 404, or interpreting divergent values between IMF and SCB/WB.
Companion to
indicators-inventory.json(machine-readable) andindicator-policy-mapping.md(committee mapping).Authority: IMF SDMX 3.0 documentation at https://data.imf.org/api/documentation and IMF Data Portal at https://data.imf.org.
IMF public data is exposed on two transports, both unauthenticated and both on the Riksdagsmonitor firewall allowlist.
- Base URL:
https://www.imf.org/external/datamapper/api/v1 - URL pattern:
/{indicatorCode}/{iso3}(single indicator, single country) or/{indicatorCode}(indicator across all countries). - Country codes: ISO-3 alpha-3 (
SWE,DNK,NOR,FIN,DEU,EU,EURO). - Response: JSON object with
values[indicatorCode][countryCode][year] = number | string | null. - Used by:
scripts/imf-client.ts → getWeoIndicator(),compareCountriesWeo(),getLatestWeoIndicator(). - CLI:
tsx scripts/imf-fetch.ts weo --country SWE --indicator NGDP_RPCH --years 15 --persist. - Scope: Datamapper surfaces WEO + Fiscal Monitor headline indicators. For anything else, use SDMX 3.0.
- Base URL:
https://api.imf.org/external/sdmx/3.0 - URL pattern:
/data/{agencyId},{dataflowId},{version}/{key}?startPeriod=…&endPeriod=… - Agency:
IMF.STA(Statistics Department) for most datasets;IMF.RES(Research) for WEO;IMF.FAD(Fiscal Affairs) for FM. - Country codes: IMF AREA numeric (
144=SWE,128=DNK,142=NOR,172=FIN,134=DEU) for IFS/GFS/BOP. WEO still uses ISO-3 here. - Response: SDMX-JSON 2.1 (structure + observation arrays).
- Used by:
scripts/imf-client.ts → sdmxFetch(). - CLI:
tsx scripts/imf-fetch.ts sdmx --path "/data/IMF.STA,CPI,4.0.0/M.SE.PCPI_IX?startPeriod=2024-01".
| Dataset | Preferred transport | Notes |
|---|---|---|
| WEO | Datamapper (faster, JSON) | SDMX also works via /data/IMF.RES,WEO,4.0.0/… |
| FM | Datamapper | SDMX fallback via /data/IMF.FAD,FM,4.0.0/… |
| IFS | SDMX only | No Datamapper coverage |
| BOP / BOP_AGG | SDMX only | |
| GFS_COFOG | SDMX only | |
| MFS_IR (policy rates) | SDMX only | |
| DOTS | SDMX only | Bilateral flows require partner-country dimension |
| PCPS | SDMX only | |
| ER (exchange rates) | SDMX only |
- Dataflow ID:
WEO(SDMX),/root (Datamapper) - Agency:
IMF.RES - Frequency: Annual (
A) - Release cadence: April flagship (~3rd week) and October flagship (~2nd week). Update window publishes an "Update" (July / January) — subset of indicators; no new projections.
- Projection horizon: T+5 (April 2026 release → 2026–2031 projections).
- Vintage tag:
WEO-YYYY-MM(e.g.WEO-2026-04). Stamp every projection with this. - Dimensions (SDMX key):
FREQ.REF_AREA.INDICATORFREQ=AREF_AREA= ISO-3 or aggregate (EU,EURO,G7,AE,WORLD)INDICATOR= e.g.NGDP_RPCH
- Key indicators (complete list in
indicators-inventory.json):NGDP_RPCH— real GDP growth, %NGDPD— nominal GDP, USD billionsNGDPDPC— GDP per capita, current USDPPPPC— GDP per capita, PPP international $PCPIPCH— CPI inflation, average, %PCPIEPCH— CPI inflation, end of period, %LUR— unemployment rate, %LE— employment, millionsLP— population, millionsGGR_NGDP— government revenue, % of GDPGGX_NGDP— government expenditure, % of GDPGGXCNL_NGDP— net lending/borrowing, % of GDPGGXWDG_NGDP— gross debt, % of GDPBCA_NGDPD— current account, % of GDPTX_RPCH/TM_RPCH— exports / imports volume growth, %
- Quirks:
- WEO
LURmay differ from SCB AKU by 0.1–0.3 pp due to ILO definition; cite explicitly when adjacent to SCB numbers. GGXWDG_NGDPWEO vintage may diverge from the FM-vintage value of the same code by up to 1 pp in the same year — WEO is more aggregated, FM has later cutoff.- Datamapper sometimes returns
"n/a"as a string for missing observations; the client filters these via explicit null/NaN guards.
- WEO
- Dataflow ID:
FM - Agency:
IMF.FAD - Frequency: Annual (
A) - Release cadence: Aligned with WEO — April and October.
- Projection horizon: T+5.
- Vintage tag:
FM-YYYY-MM(e.g.FM-2026-04). - Why use FM over WEO for fiscal: FM publishes cyclically-adjusted balances, primary balances, and debt-sustainability vintages that WEO does not.
- Key indicators:
GGXONLB_NGDP— primary balance, % of GDPGGSB_NPGDP— cyclically-adjusted primary balance, % of potential GDPGGXWDG_NGDP— gross debt (FM vintage)GGXCNLB_NGDP— primary net lending/borrowing
- Dataflow ID:
IFS(historical) /CPI,IR,ER(post-2024 SDMX 3.0 refactor — several sub-dataflows) - Agency:
IMF.STA - Frequency: Monthly (
M) or Quarterly (Q). - Release cadence: Monthly, ~30–45 days after reference period.
- No projections — historical only.
- Dimensions:
FREQ.REF_AREA.INDICATOR(varies by sub-dataflow). - Known sub-dataflows:
CPI,4.0.0— consumer prices (PCPI_IXmonthly index,PCPI_PC_CP_A_PTyear-on-year %)IR,4.0.0— interest ratesER,4.0.0— exchange rates
- Example SDMX path:
(Frequency=M, Country=SE, Indicator=PCPI_IX, monthly CPI index.)
/data/IMF.STA,CPI,4.0.0/M.SE.PCPI_IX?startPeriod=2024-01 - Quirks: IFS country codes are 2-letter ISO-2 in some sub-dataflows (
SE,DK) and 3-letter ISO-3 in others. Always verify via/structure/codelist/….
- Dataflow ID:
BOP,BOP_AGG - Agency:
IMF.STA - Frequency: Quarterly (
Q). - Methodology: BPM6.
- Key measures: current account, capital account, financial account, reserve assets, errors and omissions.
- Use case: Deeper external-sector detail than WEO's
BCA_NGDPD.
- Dataflow ID:
GFS_COFOG - Agency:
IMF.STA - Frequency: Annual (
A). - Release cadence: T+1 (data for year Y released in late Y+1).
- Methodology: GFSM 2014.
- Dimensions:
FREQ.REF_AREA.SECTOR.FUNCTION.TRANSACTION. - COFOG functions (critical for committee mapping):
01General public services02Defence → FöU03Public order and safety → JuU04Economic affairs05Environmental protection → MJU (partial — WB still primary)06Housing and community amenities07Health → SoU08Recreation, culture, religion → KrU09Education → UbU10Social protection → SfU
- Use case: Committee-aligned spending decomposition when a report or motion concerns function-specific policy.
- Dataflow ID:
MFS_IR(or sub-dataflow in the new SDMX 3.0 refactor) - Agency:
IMF.STA - Frequency: Monthly.
- Key indicators:
FPOLM_PA(policy rate, per annum),FID_PA(deposit rate),FILR_PA(lending rate),FIR_PA(interbank rate). - Swedish relevance: Riksbankens styrränta (policy rate) — complements Riksbank press releases with standardised cross-country comparison.
- Dataflow ID:
DOTS - Agency:
IMF.STA - Frequency: Monthly.
- Key dimensions:
FREQ.REF_AREA.COUNTERPART_AREA.INDICATOR.CLASS. - Key indicators:
TXG_FOB_USD(exports FOB, USD),TMG_CIF_USD(imports CIF, USD). - Use case: Bilateral trade flows — e.g. Swedish exports to Russia, EU, China. Critical for foreign-policy / sanctions coverage.
- Dataflow ID:
PCPS - Agency:
IMF.RES - Frequency: Monthly.
- Key indicators:
PALLFNF(all commodities, non-fuel),POILAPSP(oil, average of Brent/Dubai/WTI). - Use case: Inflation drivers commentary — tie Swedish CPI movements to commodity shocks.
- Dataflow ID: embedded in IFS post-2024 refactor,
ER,4.0.0. - Agency:
IMF.STA. - Frequency: Daily (representative) + monthly.
- Key indicators:
ENDA_XDC_USD_RATE— SEK per USD (end of period)ENDE_XDC_EUR_RATE— SEK per EUR (end of period)EREER_IX— real effective exchange rate index
- Use case: Monetary-policy coverage, export-competitiveness commentary.
IMF WEO publishes aggregates that make peer-comparison cleaner than adding up ISO-3 countries manually.
| Aggregate | WEO code | SDMX equivalent | Description |
|---|---|---|---|
| European Union | EU |
EU |
27 member states |
| Euro Area | EURO |
EA |
20 member states |
| Advanced Economies | AE |
AE |
IMF classification |
| G7 | G7 |
G7 |
|
| G20 | G20 |
G20 |
|
| World | WORLD |
W0 |
Use: For comparative-international.md, use EU and EURO as baseline aggregates alongside the Nordic peer set (SWE,DNK,NOR,FIN,DEU) — one batched compare call per indicator delivers all comparators.
| Date | Release |
|---|---|
| Late April 2026 | WEO Apr-2026 (flagship) + Fiscal Monitor Apr-2026 |
| Mid July 2026 | WEO Update (subset, no new projections) |
| Mid October 2026 | WEO Oct-2026 (flagship) + Fiscal Monitor Oct-2026 |
| Mid January 2027 | WEO Update |
Action: On each flagship release (April / October), update DEFAULT_WEO_VINTAGE in scripts/imf-client.ts, the vintageDiscipline.current field in indicators-inventory.json, and the banner in analysis/imf/README.md in the same PR.
Datamapper returns null, "n/a", or omits the key for missing observations. The client filters via:
if (rawValue === null || rawValue === undefined) continue;
if (!Number.isFinite(numeric)) continue;
Never coerce via Number(x) without a Number.isFinite guard — Number(null) === 0 would silently inject bogus zeros.
- Datamapper = ISO-3 (
SWE) - SDMX WEO = ISO-3 (
SWE) - SDMX IFS = ISO-2 (
SE) in some dataflows - SDMX GFS / BOP = IMF AREA 3-digit numeric (
144)
Use scripts/imf-codes.ts → toImfAreaCode(iso3) for SDMX-numeric mapping; the function throws on unknown codes (fail-loud — prevents silent data loss).
The same code (e.g. GGXWDG_NGDP) in WEO and in FM may differ by up to 1 pp in the same year because the two flagships have slightly different cutoff dates and revision policies. Rule of thumb: use WEO for headline macro, FM for debt-sustainability. When both are cited in the same article, disambiguate with the vintage tag.
IMF advertises ~10 requests / 5 s. The client defaults to maxRetries=2 with 1s→2s back-off. Agentic workflows should:
- Prefer
compare(one call per indicator across the peer set) over parallelweocalls. - Sleep 1 s between separate
imf-fetch.tsinvocations. - Pre-warm 1 request at workflow start to avoid cold-start latency spikes.
- Cache with
--persist.
- WEO
LURuses ILO harmonised definition. - SCB AKU uses Swedish survey methodology.
- Divergence: 0.1–0.3 pp typical.
- Rule: SCB for Swedish-specific ground truth; IMF for cross-country comparison. When both cited, annotate the methodology difference.
The client classifies any year > currentYear as a projection. This is correct for WEO/FM (which extend to T+5) but for IFS/BOP/GFS_COFOG — which have no projections — every observation is historical. Client tags projection: false for all non-WEO/FM datasets.
| WB code | IMF replacement | Rationale |
|---|---|---|
NY.GDP.MKTP.KD.ZG (GDP growth) |
WEO:NGDP_RPCH |
Freshness + projections |
NY.GDP.MKTP.CD (GDP USD) |
WEO:NGDPD |
Same |
NY.GDP.PCAP.CD (GDP per capita) |
WEO:NGDPDPC |
Same |
FP.CPI.TOTL.ZG (CPI inflation) |
WEO:PCPIPCH |
Same |
SL.UEM.TOTL.ZS (unemployment) |
WEO:LUR |
Same; SCB still preferred for Swedish-specific |
GC.DOD.TOTL.GD.ZS (central-gov debt) |
WEO:GGXWDG_NGDP |
GFSM 2014 general-government basis |
GC.XPN.TOTL.GD.ZS (expenditure) |
WEO:GGX_NGDP |
Same |
GC.REV.XGRT.GD.ZS (revenue) |
WEO:GGR_NGDP |
Same |
BN.CAB.XOKA.GD.ZS (current account) |
WEO:BCA_NGDPD |
Same |
NE.EXP.GNFS.ZS (exports) |
WEO:TX_RPCH |
Growth basis cleaner than % of GDP for trend articles |
These WB codes remain read-only reference. New articles MUST cite the IMF counterpart; existing committed articles do not require retroactive update.
analysis/imf/README.md— high-level overview & adoption strategyanalysis/imf/indicators-inventory.json— machine-readable catalogueanalysis/imf/indicator-policy-mapping.md— committee mappinganalysis/imf/agentic-integration.md— integration playbook for agentic workflowsanalysis/imf/use-cases.md— canonical article examplesanalysis/methodologies/imf-indicator-mapping.md— authoritative methodology.github/aw/ECONOMIC_DATA_CONTRACT.md— validator contract (v2.1+)scripts/imf-client.ts/scripts/imf-fetch.ts/scripts/imf-codes.ts/scripts/imf-context.ts— code surface