Pellroll

How it works

From a department's CSV to a cited answer.

Every number Pellroll gives traces to a line a government body published. Here is each step, and what it cannot do.

Office towers in the City of London
City of London. Photo: Andrea De Santis, Unsplash

1. Find the files

Each week the refresh asks the GOV.UK search API for every spending-over-£25,000 publication of the 24 publishers, and the GOV.UK content API for their attachments. It downloads new CSV, ODS and Excel files through a client that reads robots.txt first and names itself honestly. This build read 1,543 files; 924 hold payments dated from 1 April 2024.

2. Read every layout

For each sheet Pellroll finds the header row (it can sit below title rows), maps the columns whatever their names, reads dates in day-first order, Excel serials and ISO form, and amounts with commas, brackets and a pound sign in two encodings. One department publishes files without a header; those borrow the department's previous header of the same width. Nil returns are recorded as such.

3. Drop repeats

Some files are republished under later months with the same rows. A row that a later file of the same department repeats is kept once, from the first copy, which is the one cited.

4. Decide which names may be shown

A supplier name is shown only if it is a Companies House company, carries a legal form or an organisation word, or is a single word that cannot be a person's full name. Everything else, and anything marked redacted or personal, is counted as not named and never shown or searchable. In this build 55,223 payments are not named. Why.

5. Match to Companies House

Names are matched to the monthly snapshot of live companies by exact name, by name with a note removed, by name with a different legal form, by a previous name changed during the ledger period, and, for single-word brands only, by adding a legal form when the postcode agrees. 9,473 suppliers are matched. The rules in full.

6. Check, then swap

The new ledger replaces the old only if it is no smaller and every oracle vector still passes: lines read straight from the published files with Python's own CSV reader, and company numbers read straight from the register. A failed check leaves yesterday's data in place.

7. Answer

Six tools answer from the shipped ledger with no language model in the loop. Every answer carries the data version, the newest payment, the attribution and the disclaimer; every line carries its file and row.

What it cannot know