diff --git a/scripts/stats/eurostat.ts b/scripts/stats/eurostat.ts index bfdecf8..ba02ee5 100644 --- a/scripts/stats/eurostat.ts +++ b/scripts/stats/eurostat.ts @@ -57,12 +57,14 @@ export const EUROSTAT_DATASETS: Dataset[] = [ { code: 'nrg_pc_204', theme: 'energy', - params: { nrg_cons: 'KWH2500-4999', currency: 'EUR', unit: 'KWH' } + // KWH3500 (band Dc) carries 1991–2007; the old nrg_pc_204_h table was folded into nrg_pc_204. + params: { nrg_cons: ['KWH2500-4999', 'KWH3500'], currency: 'EUR', unit: 'KWH' } }, { code: 'nrg_pc_202', theme: 'energy', - params: { nrg_cons: 'GJ20-199', currency: 'EUR', unit: 'KWH' } + // GJ83P70 (band D3, 83.7 GJ) carries the pre-2007 history (was nrg_pc_202_h); it is only published per GJ (gross calorific value). + params: { nrg_cons: ['GJ20-199', 'GJ83P70'], currency: 'EUR', unit: ['KWH', 'GJ_GCV'] } }, { code: 'nrg_ind_id', theme: 'energy', params: { siec: 'TOTAL' } }, { diff --git a/scripts/stats/imf.ts b/scripts/stats/imf.ts index 136bfcd..66ddf18 100644 --- a/scripts/stats/imf.ts +++ b/scripts/stats/imf.ts @@ -31,9 +31,10 @@ export const IMF_INDICATORS: { id: string; title: string; unit: string; theme: s unit: '% of GDP', theme: 'budget' }, - { id: 'GGR_NGDP', title: 'General government revenue', unit: '% of GDP', theme: 'budget' }, + // WEO revenue/spending (GGR_NGDP, GGX_NGDP) are not on DataMapper; the Fiscal Monitor ones are. + { id: 'GGR_G01_GDP_PT', title: 'General government revenue', unit: '% of GDP', theme: 'budget' }, { - id: 'GGX_NGDP', + id: 'G_X_G01_GDP_PT', title: 'General government total expenditure', unit: '% of GDP', theme: 'budget' diff --git a/src/routes/stats/energy/+page.server.ts b/src/routes/stats/energy/+page.server.ts index 4588582..f5e0d8e 100644 --- a/src/routes/stats/energy/+page.server.ts +++ b/src/routes/stats/energy/+page.server.ts @@ -21,6 +21,8 @@ export const load: PageServerLoad = async () => ({ ...EU.flatMap((g) => [ `eurostat:nrg_pc_204:E7000.KWH2500-4999.KWH.I_TAX.EUR.${g}`, `eurostat:nrg_pc_202:G3000.GJ20-199.KWH.I_TAX.EUR.${g}`, + `eurostat:nrg_pc_204:E7000.KWH3500.KWH.I_TAX.EUR.${g}`, + `eurostat:nrg_pc_202:G3000.GJ83P70.GJ_GCV.I_TAX.EUR.${g}`, `eurostat:nrg_ind_id:TOTAL.PC.${g}` ]), ...['X_TAX', 'X_VAT'].flatMap((t) => [ diff --git a/src/routes/stats/energy/+page.svelte b/src/routes/stats/energy/+page.svelte index 1d1ea79..8b01aae 100644 --- a/src/routes/stats/energy/+page.svelte +++ b/src/routes/stats/energy/+page.svelte @@ -39,8 +39,23 @@ const evNewShare = $derived( ratio(pts('eurostat:road_eqr_carpda:NR.ELC.NL'), pts('eurostat:road_eqr_carpda:NR.TOTAL.NL')) ); - const elecPrice = (g: string) => pts(`eurostat:nrg_pc_204:E7000.KWH2500-4999.KWH.I_TAX.EUR.${g}`); - const gasPrice = (g: string) => pts(`eurostat:nrg_pc_202:G3000.GJ20-199.KWH.I_TAX.EUR.${g}`); + /** Current band, with the pre-2007 band (old methodology) stitched in before it starts. */ + function stitch(now: StatPoint[], old: StatPoint[]): StatPoint[] { + const start = now[0]?.[0] ?? 9999; + return [...old.filter(([d]) => d < start), ...now]; + } + const elecPrice = (g: string) => + stitch( + pts(`eurostat:nrg_pc_204:E7000.KWH2500-4999.KWH.I_TAX.EUR.${g}`), + pts(`eurostat:nrg_pc_204:E7000.KWH3500.KWH.I_TAX.EUR.${g}`) + ); + const gasPrice = (g: string) => + stitch( + pts(`eurostat:nrg_pc_202:G3000.GJ20-199.KWH.I_TAX.EUR.${g}`), + pts(`eurostat:nrg_pc_202:G3000.GJ83P70.GJ_GCV.I_TAX.EUR.${g}`).map( + ([d, v]) => [d, Math.round((v / 277.778) * 10000) / 10000] as StatPoint + ) + ); const ranking = (f: (g: string) => StatPoint[]) => { const rows = EU.map((g) => ({ g, p: latest(f(g)) })).filter((r) => r.p); const newest = rows.reduce((m, r) => (r.p![0] > m ? r.p![0] : m), ''); @@ -295,7 +310,7 @@ />