Alex Vakhitov

software engineering5 min read

Building Budget: UK public finances from open data

By Alex Vakhitov

Budget is a public dashboard of UK public finances. It shows what the government borrows, owes, collects and spends, how those numbers compare with the Office for Budget Responsibility's forecasts, and what each Budget since 2010 planned. It's built from official data published by the ONS, the OBR, HMRC, HM Treasury, the Debt Management Office and the Bank of England. It's an independent site, not connected to any of them. The code is public at github.com/vahaah/uk-public-finances.

I wanted a UK public finances dashboard that updates itself from open data and meets the standard I set for Grid, my public dashboard of Great Britain's electricity system. It uses the same stack. One rule shaped it more than any other: the site should be the source of its own charts. Each chart carries its own CSV, citation and source line, rather than reproducing someone else's chart.

This post covers what Budget shows, where each number comes from, how it stays up to date, and the problems that took the most care.

What Budget shows

The home page starts with one equation: spending minus receipts equals borrowing, for the latest month and the year to date. Below it are four short cards with sparklines. From there:

  • Borrowing, debt, receipts and spending each have a page, with views in real terms and as a share of GDP.
  • Forecasts puts the OBR's forecasts next to what actually happened.
  • Budgets lists every fiscal event since the June 2010 Emergency Budget, with a "porcupine" chart of OBR borrowing forecasts against outturn, a scorecard, and a page on fiscal rules and headroom.
  • Budget 2026, delivered on 28 October 2026, has its own page and an "explained" version in four chapters: growth and incomes, borrowing and interest, the Budget's plan, and the measures. Both are built from OBR data. The idea for the story charts came from Ed Conway's Sky News video "Budget 2026: What it really means for your wallet". Budget rebuilds that kind of chart from OBR data. It doesn't reuse Sky's images, and it has no connection to Sky News.
  • Taxpayers, Records and Old money, which converts amounts between years using the GDP deflator, CPI, CPIH or RPI.

The pages follow a nine-step story, from Overview through Borrowing, Debt and interest, Tax receipts, Spending, Forecasts and Budgets to Budget 2026 and its explainer. A stepper under each title and links at the foot of each page move you through it.

Where each number comes from

Each series comes from one publisher:

  • Borrowing, receipts, spending, the current budget, net debt and debt interest come from the ONS public sector finances time series.
  • GDP, the GDP deflator, CPI, CPIH and RPI also come from the ONS. They drive the real-terms and share-of-GDP views, and the old money converter.
  • Monthly tax receipts and income tax liabilities come from HMRC, found through the GOV.UK Content API.
  • Spending by function and department comes from HM Treasury's Public Expenditure Statistical Analyses (PESA).
  • Gilts in issue come from the Debt Management Office.
  • Bank Rate and the 10-year gilt yield come from the Bank of England's statistical database.
  • Forecasts, policy measures, forecast evaluation and Budget chart data come from the OBR.
  • The list of fiscal events and fiscal rules is kept by hand, with dates checked against GOV.UK.

Every chart has a source line: the publisher, the dataset, the publication date when it's known, the licence, and links to the data sources and methodology pages. Each chart also has a "Download CSV" button for exactly the data plotted, and Cite and Share buttons. Cite gives a sentence naming the source and publication date, with a link straight to that figure. Headline sentences can be cited the same way. For machines there are snapshot JSON endpoints, /llms.txt and a sitemap.

How it stays up to date

Budget updates when publishers release data.

Scheduled jobs on Vercel check every source each morning, and check the ONS more often during its monthly public sector finances release window. Each source has its own workflow, which downloads the data, validates it against a schema and stores a snapshot. If a download fails or the data doesn't validate, the site keeps the last good snapshot rather than showing a broken one. After an update, the affected pages are rebuilt.

One source can't be automated. The OBR's website blocks automated downloads, so I upload its workbooks by hand after each fiscal event. When one is missing, the page says so.

The data health page shows each source's status, release date and when it was last retrieved. It separates two different problems: a check that failed, and a check that stopped running. A source is flagged once it hasn't been successfully checked for three days.

Hard problems

Revisions. ONS public sector finances are estimates, and later releases revise them. OBR figures are forecasts. The site says so, and when it scores forecasts against outturn, forecasts made on an older statistical basis are marked "Basis changed" and left out of the median.

Financial years and calendar years. Some ONS annual series are calendar years, while HMRC and PESA use financial years. Shares of GDP for financial years use April to March GDP, and the financial-year deflator averages the matching four quarters. The "year ahead" of a forecast is the first financial year starting after the event, so a March Budget's year ahead starts that April.

Signs. In the ONS download, borrowing is negative. The site uses the sign the ONS bulletin uses, so borrowing is positive. In OBR data, a measure that raises money is positive, while in OBR policy charts, above zero adds to borrowing. To keep this readable, the copy says "adds to borrowing" or "reduces borrowing", and values are rounded before they are signed, so a "−0.0%" no longer appears.

Units. The DMO publishes gilts in issue in thousands of pounds. The first version left them unlabelled because the unit wasn't stated; the site now rescales them to billions.

Axes. Early charts had axis steps like 0.9, 1.8, 2.7. A shared helper now picks steps of 1, 2, 2.5 or 5 times a power of ten, always includes zero and uses a true minus sign. On a phone, financial-year labels are shortened to "26-27" so they don't collide.

How the site is organised

  • Neutral wording. Pages describe forecasts and outturns and don't judge policy. A headline such as "Inflation forecast higher for the next two years" appears only when the data supports it; otherwise the page uses a neutral fallback.
  • Sources everywhere. Methodology, data sources, a glossary and an FAQ sit alongside the charts.
  • Shareable figures. Every figure has its own link, so a citation points at one chart rather than the whole page.

What it isn't

Budget is an independent site. It updates when publishers release data. It doesn't yet show who gains and who loses from a Budget. It's a sourced view of the UK's public finances, built from the data the government and its agencies publish.

Budget is at budget.vahaah.com.