From cb773ff5a198f99d2899aa89c0e1c7e7c2411e1a Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Thu, 19 Feb 2026 17:37:37 +0000 Subject: [PATCH] Fix ESA calibration target entity mapping esa_income is a BenUnit variable, so must be aggregated to household using household_from_family() not household_from_person(). The size mismatch (benunit count vs person count) caused the obr/esa target to be skipped during calibration. --- policyengine_uk_data/targets/compute/income.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policyengine_uk_data/targets/compute/income.py b/policyengine_uk_data/targets/compute/income.py index c2f286c4..7c170e20 100644 --- a/policyengine_uk_data/targets/compute/income.py +++ b/policyengine_uk_data/targets/compute/income.py @@ -107,6 +107,6 @@ def compute_ss_headcount(target, ctx) -> np.ndarray: def compute_esa(target, ctx) -> np.ndarray: """Compute ESA (combined income-related + contributory).""" - return ctx.household_from_person( + return ctx.household_from_family( ctx.sim.calculate("esa_income") ) + ctx.household_from_person(ctx.sim.calculate("esa_contrib"))