Files
CatoandClaude Opus 5.5 03309d4713 feat(series): dated, sourced number series per bottleneck — key numbers, claims, /data/series, CSV, desk alerts (#92)
* feat(series): dated, sourced number series per bottleneck, with key numbers, claims, CSV and desk alerts

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(series): keep desk.ts and the desk page under the size ceiling; showSeries optional like showScience

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(methods): series methods in their own file, like graph and science

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 15:12:37 -07:00

32 lines
1.2 KiB
PL/PgSQL

BEGIN;
-- Official statistics fetched on a schedule (lib/series-store.ts): one row per
-- (series, period), as the agency published it. Series ids are defined in
-- config/substrata-official-series.ts. Revisions overwrite the value and bump
-- updated_at; first_seen is when the period first reached us, which is what
-- makes a point "new" on a reader's desk.
CREATE TABLE IF NOT EXISTS research_series_points (
series text NOT NULL,
period text NOT NULL,
value double precision NOT NULL,
preliminary boolean NOT NULL DEFAULT false,
first_seen timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (series, period)
);
CREATE INDEX IF NOT EXISTS research_series_points_first_seen ON research_series_points (first_seen DESC);
CREATE TABLE IF NOT EXISTS research_series_runs (
id bigserial PRIMARY KEY,
started_at timestamptz NOT NULL DEFAULT now(),
finished_at timestamptz,
series integer NOT NULL DEFAULT 0,
points_new integer NOT NULL DEFAULT 0,
points_revised integer NOT NULL DEFAULT 0,
failed integer NOT NULL DEFAULT 0
);
COMMENT ON TABLE research_series_points IS 'Official statistical series (BLS producer price indexes) mapped to bottlenecks; shown as published.';
COMMIT;