Skip to content

Charts: link every chart to its source file, at the pinned commit where there is one #291

Backlog

Description

@vahid-ahmadi

Problem

On the data and forecast pages a reader can get from a chart to its numbers in one click: every chart on /economy, the topic pages and /forecasts has a source line with a link, to the publisher's series page, the archived round file or the forecasts page. On the model pages that is not yet true. I went through the 12 generated charts (svg.vchart) on the BoE SVAR, OBR emulator and FRB/US overview and validation pages, plus the homepage fan (27 Nov 2026, on the branch of #290):

What the figure offers Charts Where
A source line linking the file at the pinned model commit 1 /obr/validation (calibration scorecard)
A source line linking a file on this repository's main 1 /obr/validation (basic-rate costing)
A source line that names the file, with no link 6 /svar/validation (FEVD shares, coverage, error ratios, win counts), /obr/validation (outturn comparison), /frb-us/validation (residuals)
No source line; the caption carries the provenance in prose 4 /obr/validation (anchored deviation, whose caption links a test file at the pin; free-running against anchored), /svar/validation (frozen-origin fan), /svar (current outlook)
No source line and no file named 1 homepage hero fan (its label gives the round date, "archived 12 Nov 2026", without a link to the round)

What it looks like: on /svar/validation the coverage chart has a grey line under it, "Source: BoE SVAR replication", with a "Source details" disclosure that opens to papers/boe-svar/figures/coverage_evaluation.json in plain text. The file is committed and served by the site, but the name is not a link, and nothing says which model commit produced it.

The mapping already exists: validation/figures/README.md has a table from every chart id to its source file, and chartkit.source_block() writes the short line and the disclosure. What is missing is the link and the pin.

Proposed design

One source line per chart, written by the generator that draws it, in one format:

Source: coverage_evaluation.json · boe-var-model at 17f5d82

  1. A registry beside the chart code. In validation/figures/make_charts.py, add SOURCES: dict[chart_id, Source], where Source has local (a path in this repository), an optional upstream (model key and path in the model repository) and an optional note. Generate the README table from it so the two cannot drift.
  2. chartkit.source_block() takes the Source. It links local as a same-origin path and upstream at the pinned commit. The commit comes from tools/model_hero.model_pins() (added in Site quality pass: pinned-commit chip on model pages, unique titles, contrast fixes and new site checks #290), so a re-pin moves every chart link and make_charts.py --check fails until the pages are regenerated.
  3. The five charts with no source line get one, including the homepage fan (assets/make_hero.py) and the /svar outlook (assets/make_current_outlooks.py), which should link the archived round under forecasts/rounds/<round-id>/ as /forecasts already does.
  4. A test in tests/test_site_integrity.py: every <figure> containing svg.vchart has a .vc-source (or .vc-src) with at least one link, and a link into a pinned model repository names a commit, not main. Pages for OG-UK and the microsimulation can be exempted by path until they are done.

The short line plus disclosure pattern stays as it is, so the change adds no height to the page.

Size

Three generators (validation/figures/make_charts.py, assets/make_hero.py, assets/make_current_outlooks.py) and chartkit.py; regenerates about six pages. make_charts.py covers 11 of the 13 charts and is the place to start.

Not in scope

Hand-written tables and stat tiles. Many already link their source at the pin (see #286); the rest need reading one by one. The 12 small charts on /models/compare share one source line that links the results file on this repository's main, which is right for a file that lives here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions