Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ db/data/desnz/lsoa_domestic_*_consumption_2024/LSOA_domestic_*_2010-2024.xlsx
db/data/desnz/msoa_domestic_*_consumption_2010_2024/MSOA_domestic_*_2010-2024.xlsx
db/data/ons/ruc2021_lookups_march_2026/260331rucallsupplementarytables.xlsx
db/data/gambling_commission/gsgb_annual_report_*/GSGB_annual_report_*_data_tables.xlsx
# CenTax's childcare cliff-edge workbook (PolicyEngine/microcosm#1399) states no licence,
# so, like the GSGB tables, it is held in R2 only; its manifest pins the bytes.
db/data/centax/childcare_cliff_edge_*/AdvaniFlewPepinhallSummers*_data.xlsx
# The ONS OA 2011 to OA 2021 lookup (chronicle#412) is 9.8 MB and parsed by no build;
# R2 holds it. The May 2026 NSPL zip of the same issue falls under the nspl_* rule.
db/data/ons/oa11_oa21_lad22_exact_fit_lookup_v3/ew_oa11_oa21_lad22_exact_fit_v3.csv
Expand Down
1 change: 1 addition & 0 deletions changelog.d/centax-childcare-cliff-edge-2026.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Register CenTax's childcare cliff-edge workbook (`centax-childcare-cliff-edge-2026`), the data for the charts of Advani, Flew, Pepin-Hall and Summers (2026), raw-only and held in R2, with the new `centax` publisher, for PolicyEngine/microcosm#1399.
1 change: 1 addition & 0 deletions chronicle/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"nz": frozenset({"ird", "mbie", "msd", "stats_nz", "treasury"}),
"uk": frozenset(
{
"centax",
"defra",
"desnz",
"dft",
Expand Down
62 changes: 62 additions & 0 deletions db/data/centax/childcare_cliff_edge_2026/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
source_id: centax
package_id: centax-childcare-cliff-edge-2026
dataset: centax_centax-childcare-cliff-edge-2026
source_name: 'Removing the £100,000 childcare cliff-edge: Impacts and cost of reform, data
for the charts'
publisher: CenTax (Centre for the Analysis of Taxation)
source_page: https://arunadvani.com/policy.html#ChildcareCliffEdge
table: AdvaniFlewPepinhallSummers2026_ChildcareThreshold_data.xlsx, the report's tables and
figures
license: None stated
attribution: 'Advani, A., Flew, J., Pepin-Hall, J. and Summers, A. (2026), Removing the £100,000
childcare cliff-edge: Impacts and cost of reform, CenTax Policy Report; data for the charts.
Authors'' calculations based on HMRC administrative datasets.'
license_evidence: 'Neither the page that links the workbook (https://arunadvani.com/policy.html#ChildcareCliffEdge,
"Data for the charts", beside the report) nor CenTax''s report page (https://centax.org.uk/removing-the-childcare-cliff-edge-impacts-and-cost-of-reform/,
which links only the PDF) nor the workbook states a licence; every sheet cites the authors''
calculations based on HMRC administrative datasets. Arun Advani (CenTax) has said he is
open to PolicyEngine using the data published at source_url (relayed by María Juaristi,
PolicyEngine, 23 November 2026). With no licence stated, the bytes stay out of this public
repository: the workbook is git-ignored and the private ledger-raw bucket holds it.'
license_verified_at: '2026-11-23'
files:
2026:
filename: AdvaniFlewPepinhallSummers2026_ChildcareThreshold_data.xlsx
source_url: https://arunadvani.com/data/AdvaniFlewPepinhallSummers2026_ChildcareThreshold_data.xlsx
source_table: 'Data for the charts of Removing the £100,000 childcare cliff-edge (CenTax,
2026): Tables 3.1 to 4.3, A.1 to A.5, B.1, B.2 and C.1 to C.11, and Figures 1.1, 2.1,
3.1 to 3.12, A.1 to A.4 and B.1'
sha256: 8c23855745154a601064e766552c64bc2e88de51e043b4df1397c580e969354b
size_bytes: 194075
fetched_at: '2026-11-23T22:43:41+00:00'
retrieved_at: '2026-11-23'
vintage: centax_2026_09
vintages:
- centax_2026_09
storage:
local: false
r2:
provider: r2
bucket: ledger-raw
key: raw/uk/centax/centax-childcare-cliff-edge-2026/2026/8c23855745154a601064e766552c64bc2e88de51e043b4df1397c580e969354b/AdvaniFlewPepinhallSummers2026_ChildcareThreshold_data.xlsx
uri: r2://ledger-raw/raw/uk/centax/centax-childcare-cliff-edge-2026/2026/8c23855745154a601064e766552c64bc2e88de51e043b4df1397c580e969354b/AdvaniFlewPepinhallSummers2026_ChildcareThreshold_data.xlsx
registration_kind: raw_only
provenance_notes: 'The data for the charts of Advani, Flew, Pepin-Hall and Summers (2026),
Removing the £100,000 childcare cliff-edge: Impacts and cost of reform, a CenTax Policy
Report published in September 2026 (https://centax.org.uk/wp-content/uploads/2026/09/AdvaniFlewPepin-HallSummers2026_Removing-the-childcare-cliff-edge.pdf).
The server reported the file last modified on 10 November 2026; its bytes are those of the
copy CenTax shared with PolicyEngine on 21 October 2026 (the same sha256). Its 45 sheets,
two of them section dividers, hold the report''s tables and figures from HMRC administrative
data on parents in England and Scotland: income distributions of parents of 3- and 4-year-olds
by adjusted net income in 2021-22, the tax year CenTax labels 2022 (Figure 3.1, £500 bins
to £200,000; by main source of income, Figure 3.3, £1,000 bins to £150,000; by sex, Figure
3.6, £500 bins to £150,000; by region, Figure 3.7, £1,000 bins to £150,000, pooled over
the tax years 2018-19 to 2021-22), sample statistics (Table A.1), the
share with a partner not in work (Figure 3.12), and the authors'' model outputs (bunching,
frictions, elasticities, notch sizes and fiscal costs). Registered raw-only: no Chronicle
build parses it. PolicyEngine/microcosm#1399 derives its CenTax parent cells from Figures
3.1, 3.3, 3.6 and 3.7 and reads Table A.1 and Figure 3.12 as diagnostics, verifying the
bytes against this manifest; no consumer binds the model outputs. Stored in R2 only (storage.local:
false) and not committed, because no licence is stated (see license_evidence); a build
that needs it reads it from the source-artifact cache, or with LEDGER_SOURCE_ARTIFACT_FETCH=1
from source_url.'
49 changes: 49 additions & 0 deletions docs/data-sources/uk-centax-childcare-cliff-edge-2026.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# CenTax childcare cliff-edge workbook (raw only)

`centax-childcare-cliff-edge-2026` (`db/data/centax/childcare_cliff_edge_2026`) registers the
data for the charts of Advani, Flew, Pepin-Hall and Summers (2026), *Removing the £100,000
childcare cliff-edge: Impacts and cost of reform* (CenTax Policy Report, September 2026). The
workbook, `AdvaniFlewPepinhallSummers2026_ChildcareThreshold_data.xlsx` (194,075 bytes), is linked
as "Data for the charts" beside the report on
[arunadvani.com/policy.html](https://arunadvani.com/policy.html#ChildcareCliffEdge). CenTax's own
report page links only the PDF.

## What it holds

45 sheets: two section dividers, the report's tables (3.1 to 4.3, A.1 to A.5, B.1, B.2, C.1 to
C.11) and its figures (1.1, 2.1, 3.1 to 3.12, A.1 to A.4, B.1). Every sheet is the authors'
calculations based on HMRC administrative datasets. "2022" is the 2021-22 tax year.

| Sheet | Contents | Bins |
| --- | --- | --- |
| Fig. 3.1 | Parents of 3- and 4-year-olds in England by adjusted net income (ANI), 2021-22 | £500 to £200,000 |
| Fig. 3.3 | The same, employees and non-employees (main source of income) | £1,000 to £150,000 |
| Fig. 3.6 | The same, by sex | £500 to £150,000 |
| Fig. 3.7 | Parents of 3- and 4-year-olds by region group in England (London, North and Midlands, South excluding London) and in Scotland, all four columns pooled over 2018-19 to 2021-22 | £1,000 to £150,000 |
| Fig. 3.12 | Share of parents with a partner not in work | £2,500 to £150,000 |
| Tab. A.1 | Sample statistics: parents, partners, sex, age and mean ANI, whole population and £80k-£140k | |

Bins are labelled by their upper edge: Figure 3.1's labels run from 500 to 200,000. The sheets
of Figures 3.1 and 3.6 say the report's charts aggregate their £500 bins into £1,000 bins. Figure
3.7's sheet does not say which English regions make up its two groups outside London. Its note
pools every column, England's three groups as well as Scotland, over parents with a child
eligible at some point in the tax years 2018-19 to 2021-22, although the sheet's title says
2022. Its levels are therefore about four years of counts: at the first £1,000, the English
groups sum to 4.2 times Figure 3.1's first two £500 bins. Use its shares. Figure 3.12's "Men &
Women" column repeats its "Men" column in all 60 bins, so use the Men and Women columns
separately. The other sheets hold the authors' model outputs: bunching, friction parameters,
elasticities, notch sizes, marginal bunchers and fiscal costs.

## Registration

Raw only: no Chronicle build parses the workbook. PolicyEngine/microcosm#1399 checks the bytes
against this manifest (sha256, size), derives its CenTax parent cells from Figures 3.1, 3.3, 3.6
and 3.7, and reads Table A.1 and Figure 3.12 as diagnostics. No consumer binds the model
outputs.

No licence is stated on the linking page, CenTax's report page or the workbook. Arun Advani
(CenTax) has said he is open to PolicyEngine using the data published at the source URL (relayed
on 23 November 2026). As with the Gambling Commission's GSGB tables, the bytes are therefore held
in R2 only (`storage.local: false`) and git-ignored. A build that needs them reads them from the
source-artifact cache, or with `LEDGER_SOURCE_ARTIFACT_FETCH=1` from the source URL; either route
is checked against the pinned sha256.
16 changes: 16 additions & 0 deletions docs/pe-uk-source-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,22 @@ People and Work review. Two packages add 117 facts; field contracts and caveats
- item 4, already in Chronicle as `hmrc-employer-nics-age-reliefs-january-2026` (January 2026
is still HMRC's latest edition).

## Beyond parity — CenTax childcare cliff-edge workbook (PolicyEngine/microcosm#1399)

The data for the charts of CenTax's *Removing the £100,000 childcare cliff-edge* (Advani, Flew,
Pepin-Hall and Summers, 2026), which microcosm's parent cells for the £100k childcare costing
derive from. Field notes and the licence position are in
[`docs/data-sources/uk-centax-childcare-cliff-edge-2026.md`](data-sources/uk-centax-childcare-cliff-edge-2026.md).

- **Raw only** (`centax-childcare-cliff-edge-2026`): the workbook is pinned by its manifest and
held in R2. microcosm checks the bytes against the manifest and reads Figures 3.1, 3.3, 3.6 and
3.7, and Table A.1 and Figure 3.12 as diagnostics.
- `centax` is a new UK publisher.
- No licence is stated; Arun Advani (CenTax) has said PolicyEngine may use the published data,
so the bytes are git-ignored, as the GSGB tables are.
- Not ported as facts: every sheet. The figures are chart data for one consumer, and the other
sheets are the authors' model outputs (bunching, frictions, elasticities, costs).

## Consumer contracts

The UK national, local-geography, and firms selection contracts now live in
Expand Down
188 changes: 188 additions & 0 deletions tests/test_source_centax_childcare_cliff_edge_2026.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
"""CenTax's childcare cliff-edge workbook, registered raw-only (PolicyEngine/microcosm#1399).

Advani, Flew, Pepin-Hall and Summers (2026), *Removing the £100,000 childcare cliff-edge*,
publish their data for the charts on arunadvani.com. No licence is stated; Arun Advani
(CenTax) has said PolicyEngine may use the published data. So, like the GSGB tables, the
workbook is pinned by its manifest, held in R2 only and git-ignored, and no Chronicle build
parses it: microcosm's builder reads Figures 3.1, 3.3, 3.6 and 3.7 (and Table A.1 and
Figure 3.12 as diagnostics) after checking the bytes against this registration.
"""

from __future__ import annotations

import hashlib
import io
from pathlib import Path
import subprocess

import openpyxl
import pytest
import yaml

from chronicle.artifacts import (
R2_COUNTRY_PUBLISHERS,
build_r2_key,
inventory_source_artifacts,
publish_source_artifacts,
)
from chronicle.bundle import UK_BUNDLE_SOURCES
from chronicle.source_package import SOURCE_PACKAGE_ALIASES

REPOSITORY_ROOT = Path(__file__).resolve().parents[1]
DIRECTORY = "centax/childcare_cliff_edge_2026"
PACKAGE_DIR = REPOSITORY_ROOT / "db" / "data" / DIRECTORY
PACKAGE_ID = "centax-childcare-cliff-edge-2026"
FILENAME = "AdvaniFlewPepinhallSummers2026_ChildcareThreshold_data.xlsx"
SHA256 = "8c23855745154a601064e766552c64bc2e88de51e043b4df1397c580e969354b"
SIZE_BYTES = 194_075
#: The sheets PolicyEngine/microcosm#1399 reads: each one's header row (from column B)
#: and its bins (first and last label, step), labelled by their upper edge.
CONSUMED_FIGURES = {
"Fig. 3.1": (
("Income Bin (ANI)", "Number of Taxpayer in Income Bin"),
(500, 200_000, 500),
),
"Fig. 3.3": (
(
"Income Bin (ANI)",
"Number of Taxpayers in Income Bin (Employees)",
"Number of Taxpayers in Income Bin (Non-Employees)",
),
(1_000, 150_000, 1_000),
),
"Fig. 3.6": (
(
"Income Bin (ANI)",
"Number of Taxpayers in Income Bin (Males)",
"Number of Taxpayers in Income Bin (Females)",
),
(500, 150_000, 500),
),
"Fig. 3.7": (
(
"Income Bin (ANI)",
"Number of Taxpayers in Income Bin (London)",
"Number of Taxpayers in Income Bin (North and Midlands)",
"Number of Taxpayers in Income Bin (South excl. London)",
"Number of Taxpayers in Income Bin (Scotland)",
),
(1_000, 150_000, 1_000),
),
"Fig. 3.12": (
(
"Income Bin (ANI)",
"Share of Parents with Non-Working Partner (Men & Women)",
"Share of Parents with Non-Working Partner (Men)",
"Share of Parents with Non-Working Partner (Women)",
),
(2_500, 150_000, 2_500),
),
}


def _manifest() -> dict:
return yaml.safe_load((PACKAGE_DIR / "manifest.yaml").read_text(encoding="utf-8"))


def test_the_workbook_is_pinned_raw_only_in_r2():
manifest = _manifest()
assert manifest["source_id"] == "centax"
assert manifest["package_id"] == PACKAGE_ID
assert manifest["registration_kind"] == "raw_only"
assert "centax" in R2_COUNTRY_PUBLISHERS["uk"]
assert list(manifest["files"]) == [2026]
entry = manifest["files"][2026]
assert entry["filename"] == FILENAME
assert entry["source_url"] == f"https://arunadvani.com/data/{FILENAME}"
assert entry["sha256"] == SHA256
assert entry["size_bytes"] == SIZE_BYTES
assert entry["vintage"] == "centax_2026_09"

key = build_r2_key(
source_id="centax",
package_id=PACKAGE_ID,
year=2026,
sha256=SHA256,
filename=FILENAME,
package_path=PACKAGE_DIR / "manifest.yaml",
)
assert key == f"raw/uk/centax/{PACKAGE_ID}/2026/{SHA256}/{FILENAME}"
assert entry["storage"] == {
"local": False,
"r2": {
"provider": "r2",
"bucket": "ledger-raw",
"key": key,
"uri": f"r2://ledger-raw/{key}",
},
}
ignored = subprocess.run(
["git", "check-ignore", "--quiet", str(PACKAGE_DIR / FILENAME)],
cwd=REPOSITORY_ROOT,
check=False,
)
assert ignored.returncode == 0

assert PACKAGE_ID not in SOURCE_PACKAGE_ALIASES
assert PACKAGE_ID not in UK_BUNDLE_SOURCES
assert not (
REPOSITORY_ROOT / "packages" / DIRECTORY / "source_package.yaml"
).exists()


def test_the_manifest_records_the_source_page_the_permission_and_no_licence():
manifest = _manifest()
assert manifest["source_page"] == (
"https://arunadvani.com/policy.html#ChildcareCliffEdge"
)
assert manifest["license"] == "None stated"
assert manifest["license_verified_at"] == "2026-11-23"
evidence = manifest["license_evidence"]
assert "Arun Advani (CenTax)" in evidence
assert "23 November 2026" in evidence
assert "git-ignored" in evidence
for author in ("Advani, A.", "Flew, J.", "Pepin-Hall, J.", "Summers, A."):
assert author in manifest["attribution"]
assert "HMRC administrative datasets" in manifest["attribution"]
assert "PolicyEngine/microcosm#1399" in manifest["provenance_notes"]


def test_a_checkout_without_the_workbook_stays_valid(tmp_path):
target = tmp_path / "db" / "data" / DIRECTORY
target.mkdir(parents=True)
(target / "manifest.yaml").write_bytes((PACKAGE_DIR / "manifest.yaml").read_bytes())

inventory = inventory_source_artifacts(tmp_path / "db" / "data")
published = publish_source_artifacts(
tmp_path / "db" / "data", wrangler_command="false"
)

assert inventory.valid
assert inventory.counts["missing_count"] == 0
assert inventory.counts["r2_only_count"] == 1
assert published.valid
assert published.counts["skipped_count"] == 1
assert published.counts["uploaded_count"] == 0


def test_the_figures_microcosm_reads_keep_their_layout():
"""Checked against a local copy of the bytes; skipped in a checkout without one."""
path = PACKAGE_DIR / FILENAME
if not path.is_file():
pytest.skip(f"{FILENAME} is held in R2 only; no local copy to check.")
content = path.read_bytes()
assert hashlib.sha256(content).hexdigest() == SHA256
workbook = openpyxl.load_workbook(io.BytesIO(content), read_only=True, data_only=True)
assert len(workbook.sheetnames) == 45
for sheet, (header, (first, last, step)) in CONSUMED_FIGURES.items():
rows = list(workbook[sheet].iter_rows(values_only=True))
start = next(
index
for index, row in enumerate(rows)
if tuple(row[1 : 1 + len(header)]) == header
)
labels = [row[1] for row in rows[start + 1 :] if row[1] is not None]
assert labels == list(range(first, last + step, step)), sheet
table = list(workbook["Tab. A.1"].iter_rows(values_only=True))
assert table[3][1:5] == ("Sample", "Variable", "Whole Population", "£80k-£140k")
assert table[4][1:3] == ("3- and 4-year-olds", "Number of Parents")
Loading