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 changelog.d/622-uk-uc-contract-refresh.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Refresh the UK national target contract to the 1.56.16 registry surface, adding
the Universal Credit benefit-unit caseload declaration and recording the closed
registry-parity delta.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
},
"registry_parity": {
"source_repository": "policyengine-uk-data",
"pinned_ref": "ebf733c",
"registry_rows": 651,
"mapped_rows": 609,
"pinned_ref": "12a1e028afeef08d8b2d74ee03fd9de3a78b2dd3",
"pinned_version": "1.56.16",
"registry_rows": 652,
"mapped_rows": 610,
"excluded_rows": 42,
"mapped": {
"dwp/benefit_capped_households": "dwp.benefit_cap.capped_households",
Expand All @@ -25,6 +26,7 @@
"dwp/pip_dl_enhanced_claimants": "dwp.pip.daily_living_enhanced_claimants",
"dwp/pip_dl_standard_claimants": "dwp.pip.daily_living_standard_claimants",
"dwp/scotland_uc_households_child_under_1": "dwp.uc.scotland_households_child_under_1",
"dwp/uc/households": "dwp.uc.households",
"dwp/uc/claimants_couple_no_children": "dwp.uc.households_couple_no_children",
"dwp/uc/claimants_couple_with_children": "dwp.uc.households_couple_with_children",
"dwp/uc/claimants_single_no_children": "dwp.uc.households_single_no_children",
Expand Down Expand Up @@ -677,6 +679,7 @@
"hmrc.salary_sacrifice.it_relief_additional_rate": "New declaration backed by chronicle#139 salary-sacrifice facts; the incumbent source CSV is 410-Gone at ebf733c and its rows were silently suppressed by the bare-except drop in build_loss_matrix.py:376-394."
},
"accounting_notes": {
"v1_56_16_refresh": "Compared with ebf733c, the governed registry surface adds dwp/uc/households. The four deleted universal-credit jobseeker dispatch names were not registry rows in the carried contract, so there were no parity entries to remove; obr/jobseekers_allowance remains a distinct published JSA expenditure target.",
"cross_level_duplicate_names": "Name-only identity flattens two-level emissions for ons/uk_population, ons/scotland_children_under_16, and ons/scotland_babies_under_1.",
"two_child_limit_year_surface": "The 15 dwp/uc/two_child_limit/* rows are 2026-only; the incumbent effective surface is 636 at calibration year 2025 and 651 at 2026. This is microcosm#622 Fixture-B input because the incumbent cannot self-report the year-specific surface.",
"geography_level_order_canonicalization": "The 9 voa.council_tax_stock.* rows use country, region order to match the rest of the contract; consumers use membership only."
Expand Down Expand Up @@ -9832,6 +9835,48 @@
"student_support_product": "adult_dependants_grant"
}
}
},
{
"target_id": "dwp.uc.households",
"family": "dwp_universal_credit",
"geography_levels": [
"country"
],
"measurement": {
"entity": "benunit",
"concept": "uk.benefit_unit.count",
"filters": [
{
"concept": "uk.benefits.universal_credit.amount",
"operator": ">",
"value": 0
}
]
},
"bindings": {
"policyengine": {
"metric_name": "dwp/uc/households",
"value_variable": "benunit_count",
"from_entity": "benunit",
"filters": [
{
"variable": "universal_credit",
"operator": ">",
"value": 0
}
],
"notes": "Prepared benefit-unit indicator for receipt of Universal Credit; DWP household means the UC unit of assessment, not an ONS household."
},
"axiom": {
"metric_name": "dwp/uc/households",
"status": "pending",
"value_rule": "uk.benefit_unit.count"
}
},
"ledger_selector": {
"source_name": "dwp",
"source_concept": "dwp.uc_benefit_units"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
),
(
"uk",
"beed723a64944a2dc45c85a6853a51666885aba0aeca0e1ada6680a6352fb44c",
"942ad7df5537e244df7ede7230098e91c617dbdb11e4d0885a94bb3b4f912da5",
{
"benunit.benunit_id",
"household.household_id",
Expand Down
37 changes: 34 additions & 3 deletions packages/microcosm-build/tests/test_uk_national_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ def test_uk_national_targets_shape_and_accounting():

assert resource["country"] == "uk"
assert resource["allowed_value_operations"] == ["identity"]
assert len(resource["targets"]) == 186
assert len(resource["targets"]) == 187

parity = resource["registry_parity"]
assert parity["pinned_ref"] == "ebf733c"
assert parity["pinned_ref"] == "12a1e028afeef08d8b2d74ee03fd9de3a78b2dd3"
assert parity["pinned_version"] == "1.56.16"
assert parity["mapped_rows"] + parity["excluded_rows"] == parity["registry_rows"]
assert len(parity["mapped"]) == parity["mapped_rows"]
assert len(parity["excluded"]) == parity["excluded_rows"]
Expand All @@ -140,7 +141,7 @@ def test_uk_national_targets_shape_and_accounting():
declared_target_ids = {target["target_id"] for target in resource["targets"]}
assert mapped_target_ids | set(unmapped_declarations) == declared_target_ids
assert all(reason for reason in unmapped_declarations.values())
assert len(mapped_target_ids) == 183
assert len(mapped_target_ids) == 184


def test_uk_national_targets_have_unique_target_ids():
Expand Down Expand Up @@ -246,6 +247,36 @@ def test_uk_national_targets_declare_chronicle_loader_guarantees():
] == "esa_income + esa_contrib"


def test_uk_uc_households_target_counts_benunits():
resource = _load()
target = _target_by_id(resource, "dwp.uc.households")

assert target["measurement"] == {
"entity": "benunit",
"concept": "uk.benefit_unit.count",
"filters": [
{
"concept": "uk.benefits.universal_credit.amount",
"operator": ">",
"value": 0,
}
],
}
assert target["bindings"]["policyengine"]["value_variable"] == "benunit_count"
assert target["bindings"]["policyengine"]["from_entity"] == "benunit"
assert target["bindings"]["policyengine"]["filters"] == [
{
"variable": "universal_credit",
"operator": ">",
"value": 0,
}
]
assert target["ledger_selector"] == {
"source_name": "dwp",
"source_concept": "dwp.uc_benefit_units",
}


def test_uk_national_cgt_contract_names_match_runtime_specs():
resource = _load()

Expand Down
Loading