You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Derived _per_capita series are not rebuilt by reforms applied to a built system, and hold their value through a None total #9845
add_per_capita_uprating (policyengine_us/tools/per_capita_uprating.py) derives each <national total>_per_capita series from its national total and the population series. In two cases a derived series falls out of step with its total. Both were run on the head of #9628 (743b6dfd3d, which is main at ea79c39fb7 plus that PR), and neither involves backdating.
1. A dict reform applied to a built system does not rebuild them
CountryTaxBenefitSystem.modify_parameters rebuilds the derived series after init. But two other paths set values through Parameter.update directly, never call modify_parameters, and so never rebuild them:
The exhaustive reform in #9628's tests touches 42,489 parameters. Under it, 1 of the 19 derived series differs between the two paths: employment_income_per_capita in 2018 is 37,207.11 when built with the reform and 24,804.74 when the reform is applied afterwards.
2. A total set to None holds the previous per-capita value
_per_capita_values skips any instant where the total is None (if total_value is None or not population_value: continue). So the derived series keeps the previous value through that instant instead of becoming undefined:
Year
Total with {"year:2020:1": None}
Per capita (reformed)
Per capita (baseline)
2019
8,273,000,000,000
24,671.29
24,671.29
2020
None
24,671.29
24,981.44
2021
9,022,400,000,000
26,690.41
26,690.41
Found while reviewing #9628. Its new whole-tree test skips the derived series because of case 1.
Activity