stats step 2: World Bank, IMF WEO, OWID, Energy-Charts, Rijksfinanciën, US Treasury, USAspending collectors + tables, timers
All checks were successful
Deploy production / deploy (push) Successful in 1m10s

This commit is contained in:
2026-10-25 21:05:51 +00:00
parent 7e905b1651
commit 8958d3ff8f
21 changed files with 34655 additions and 3 deletions

View File

@@ -6,12 +6,22 @@
// bun scripts/stats-fetch.ts eurostat [--only=nrg_pc_204]
// bun scripts/stats-fetch.ts fred [--only=DCOILBRENTEU]
// bun scripts/stats-fetch.ts bis
// bun scripts/stats-fetch.ts worldbank|imf|owid [--only=…]
// bun scripts/stats-fetch.ts energycharts|rijksfinancien|ustreasury [--backfill]
// bun scripts/stats-fetch.ts usaspending
// bun scripts/stats-fetch.ts normalise-cbs rebuild CBS chart series from the raw rows
import { ensureMeta, sql } from './stats/common';
import { cbs, normaliseCbs } from './stats/cbs';
import { eurostat } from './stats/eurostat';
import { fred } from './stats/fred';
import { bis } from './stats/bis';
import { worldbank } from './stats/worldbank';
import { imf } from './stats/imf';
import { owid } from './stats/owid';
import { energycharts } from './stats/energycharts';
import { rijksfinancien } from './stats/rijksfinancien';
import { ustreasury } from './stats/ustreasury';
import { usaspending } from './stats/usaspending';
const [source, ...args] = process.argv.slice(2);
const flag = (name: string) => args.includes(`--${name}`);
@@ -36,8 +46,31 @@ try {
case 'bis':
await bis({ job });
break;
case 'worldbank':
await worldbank({ only: value('only'), job });
break;
case 'imf':
await imf({ only: value('only'), job });
break;
case 'owid':
await owid({ only: value('only'), job });
break;
case 'energycharts':
await energycharts({ backfill: flag('backfill'), job });
break;
case 'rijksfinancien':
await rijksfinancien({ backfill: flag('backfill'), job });
break;
case 'ustreasury':
await ustreasury({ backfill: flag('backfill'), job });
break;
case 'usaspending':
await usaspending({ job });
break;
default:
throw new Error(`Unknown source "${source}" (cbs, eurostat, fred, bis, normalise-cbs)`);
throw new Error(
`Unknown source "${source}" (cbs, eurostat, fred, bis, worldbank, imf, owid, energycharts, rijksfinancien, ustreasury, usaspending, normalise-cbs)`
);
}
} finally {
await sql.end({ timeout: 5 });