stats: Eurostat pre-2007 household energy bands (nrg_pc_204_h/202_h folded into nrg_pc_204/202), stitched on /stats/energy; IMF revenue/spending from Fiscal Monitor codes
All checks were successful
Deploy production / deploy (push) Successful in 1m10s

This commit is contained in:
2026-10-25 21:14:50 +00:00
parent 02734607cc
commit d19313035f
4 changed files with 27 additions and 7 deletions

View File

@@ -57,12 +57,14 @@ export const EUROSTAT_DATASETS: Dataset[] = [
{ {
code: 'nrg_pc_204', code: 'nrg_pc_204',
theme: 'energy', 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', code: 'nrg_pc_202',
theme: 'energy', 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' } }, { code: 'nrg_ind_id', theme: 'energy', params: { siec: 'TOTAL' } },
{ {

View File

@@ -31,9 +31,10 @@ export const IMF_INDICATORS: { id: string; title: string; unit: string; theme: s
unit: '% of GDP', unit: '% of GDP',
theme: 'budget' 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', title: 'General government total expenditure',
unit: '% of GDP', unit: '% of GDP',
theme: 'budget' theme: 'budget'

View File

@@ -21,6 +21,8 @@ export const load: PageServerLoad = async () => ({
...EU.flatMap((g) => [ ...EU.flatMap((g) => [
`eurostat:nrg_pc_204:E7000.KWH2500-4999.KWH.I_TAX.EUR.${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_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}` `eurostat:nrg_ind_id:TOTAL.PC.${g}`
]), ]),
...['X_TAX', 'X_VAT'].flatMap((t) => [ ...['X_TAX', 'X_VAT'].flatMap((t) => [

View File

@@ -39,8 +39,23 @@
const evNewShare = $derived( const evNewShare = $derived(
ratio(pts('eurostat:road_eqr_carpda:NR.ELC.NL'), pts('eurostat:road_eqr_carpda:NR.TOTAL.NL')) 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}`); /** Current band, with the pre-2007 band (old methodology) stitched in before it starts. */
const gasPrice = (g: string) => pts(`eurostat:nrg_pc_202:G3000.GJ20-199.KWH.I_TAX.EUR.${g}`); 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 ranking = (f: (g: string) => StatPoint[]) => {
const rows = EU.map((g) => ({ g, p: latest(f(g)) })).filter((r) => r.p); 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), ''); const newest = rows.reduce((m, r) => (r.p![0] > m ? r.p![0] : m), '');
@@ -295,7 +310,7 @@
/> />
<StatChart <StatChart
title="Electricity: Netherlands, Germany, EU and the US" title="Electricity: Netherlands, Germany, EU and the US"
subtitle="per kWh incl. taxes · Europe in €, US city average in $ (BLS)" subtitle="per kWh incl. taxes · Europe in € (2,500–5,000 kWh; 3,500 kWh band before 2007), US city average in $ (BLS)"
sources={['eurostat', 'fred']} sources={['eurostat', 'fred']}
attributions={a} attributions={a}
height="360px" height="360px"