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
UK clone stages can number identifiers past the 32-bit range policyengine-uk stores #1194
id_multiplier_for_values (packages/microcosm-build/src/microcosm/build/uk_runtime/rowwise_geography.py) returns 10 ** len(str(max_id)). The UK clone stages add k * multiplier to every identifier of copy or arm k: cgt_structure (2 copies), cgt_residential_split (arm j per combination of liable gainers) and cgt_support. The only identifier range checks I found in the UK build are against int64 overflow.
policyengine-uk stores all five identifier variables as 32-bit integers (person_id, benunit_id and household_id already; person_household_id and person_benunit_id from PolicyEngine/policyengine-uk#2273), which hold whole numbers up to 2,147,483,647. The UK adapter (microcosm/frame/adapters/policyengine_uk.py) passes the tables to UKSingleYearDataset without renumbering.
populace_uk_2023.h5 already has identifiers up to 967,010,009 (person_id), so the multiplier is 10^9:
copy or arm 1: up to 1,967,010,009 (in range)
copy or arm 2 and up: 2,967,010,009 and more (out of range)
any stage that sizes its multiplier after a copy has passed 10^9 gets 10^10, so its copy 1 is already out of range
I have not measured a built frame; this is from the code and populace_uk_2023.h5.
Effect in policyengine-uk
The entity structure is built from the identifier arrays as given, so memberships stay right. The stored identifier values wrap: calculate("household_id"), to_input_dataframe() and UKSingleYearDataset.from_simulation return different numbers, and anything rebuilt from them may not match. After PolicyEngine/policyengine-uk#2273 the simulation gives an EntityIdWarning naming the columns. Once identifiers stay in range, that warning could become an error.
Suggested fix
Check in id_multiplier_for_values (or each clone stage) that the largest identifier after cloning fits 2,147,483,647, and renumber compactly where it would not. Alternatively, renumber in the UK adapter before simulating and map results back by position.
Activity