Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions scripts/seed-imf-growth.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Indicators:
// NGDP_RPCH — Real GDP growth, % change
// NGDPDPC — Nominal GDP per capita, USD
// NGDP_R — Real GDP, national currency (constant prices)
// NGDP_R — Real GDP, national currency (constant prices), billions
// PPPPC — GDP per capita, PPP USD
// PPPGDP — GDP, PPP USD
// NID_NGDP — Total investment % GDP
Expand Down Expand Up @@ -94,7 +94,7 @@ export function buildGrowthCountries(perIndicator) {
countries[iso2] = {
realGdpGrowthPct: growth?.value ?? null,
gdpPerCapitaUsd: gdpPc?.value ?? null,
realGdp: realGdpV?.value ?? null,
realGdpLcuB: realGdpV?.value ?? null,
gdpPerCapitaPpp: pppPc?.value ?? null,
gdpPpp: pppGdpV?.value ?? null,
investmentPct: inv?.value ?? null,
Expand Down Expand Up @@ -166,7 +166,9 @@ if (process.argv[1]?.endsWith('seed-imf-growth.mjs')) {
declareRecords,
// schemaVersion bumped 1→2 in Codex PR #3604 review fix: see
// seed-imf-external.mjs for the rationale (new `latestYear` field).
schemaVersion: 2,
// Bump 2→3 because this seeder renames the stored real-GDP field from
// ambiguous `realGdp` to `realGdpLcuB`, forcing cache republish on rollout.
schemaVersion: 3,
maxStaleMin: 100800,

// ── Content-age contract (Sprint 4 IMF/WEO cohort) ──
Expand Down
2 changes: 1 addition & 1 deletion src/services/imf-country-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface ImfMacroEntry {
export interface ImfGrowthEntry {
realGdpGrowthPct: number | null;
gdpPerCapitaUsd: number | null;
realGdp: number | null;
realGdpLcuB: number | null;
gdpPerCapitaPpp: number | null;
gdpPpp: number | null;
investmentPct: number | null;
Expand Down
10 changes: 5 additions & 5 deletions tests/imf-country-data.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('buildImfEconomicIndicators (panel rendering)', () => {
year: 2025,
},
growth: {
realGdpGrowthPct: 2.7, gdpPerCapitaUsd: 78500, realGdp: null,
realGdpGrowthPct: 2.7, gdpPerCapitaUsd: 78500, realGdpLcuB: null,
gdpPerCapitaPpp: null, gdpPpp: null, investmentPct: null, savingsPct: null,
savingsInvestmentGap: null, year: 2025,
},
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('buildImfEconomicIndicators (panel rendering)', () => {
year: 2025,
},
growth: {
realGdpGrowthPct: -1.4, gdpPerCapitaUsd: null, realGdp: null,
realGdpGrowthPct: -1.4, gdpPerCapitaUsd: null, realGdpLcuB: null,
gdpPerCapitaPpp: null, gdpPpp: null, investmentPct: null, savingsPct: null,
savingsInvestmentGap: null, year: 2025,
},
Expand All @@ -86,7 +86,7 @@ describe('buildImfEconomicIndicators (panel rendering)', () => {
it('formats sub-$1k GDP/capita with the dollar prefix', () => {
const rows = buildImfEconomicIndicators(bundle({
growth: {
realGdpGrowthPct: null, gdpPerCapitaUsd: 850, realGdp: null,
realGdpGrowthPct: null, gdpPerCapitaUsd: 850, realGdpLcuB: null,
gdpPerCapitaPpp: null, gdpPpp: null, investmentPct: null, savingsPct: null,
savingsInvestmentGap: null, year: 2025,
},
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('buildImfEconomicIndicators (panel rendering)', () => {
year: 2024,
},
growth: {
realGdpGrowthPct: 0.7, gdpPerCapitaUsd: 47800, realGdp: null,
realGdpGrowthPct: 0.7, gdpPerCapitaUsd: 47800, realGdpLcuB: null,
gdpPerCapitaPpp: null, gdpPpp: null, investmentPct: null, savingsPct: null,
savingsInvestmentGap: null, year: 2024,
},
Expand Down Expand Up @@ -258,7 +258,7 @@ describe('buildImfEconomicIndicators (panel rendering)', () => {
growth: {
realGdpGrowthPct: NaN,
gdpPerCapitaUsd: Infinity,
realGdp: null,
realGdpLcuB: null,
gdpPerCapitaPpp: null,
gdpPpp: null,
investmentPct: null,
Expand Down
2 changes: 2 additions & 0 deletions tests/seed-imf-extended.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ describe('seed-imf-growth', () => {
assert.ok(countries.US, 'USA → US');
assert.equal(countries.US.realGdpGrowthPct, 2.5);
assert.equal(countries.US.gdpPerCapitaUsd, 80000);
assert.equal(countries.US.realGdpLcuB, 22000);
assert.equal('realGdp' in countries.US, false);
assert.equal(countries.US.savingsInvestmentGap, -3);
assert.equal(countries.US.year, Number(YEAR));

Expand Down