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
ons_demographics emits three target names twice, and one copy of ons/uk_population is 1,000 times too small #605
targets/sources/ons_demographics.py emits three target names twice.
Name
First copy
Second copy
ons/uk_population
national, :162, live ONS projection, 2024–2029
region, the demographics.csv loop at :226-247, 2022–2029
ons/scotland_children_under_16
region, demographics.csv:77 (source ons)
country, :314 (source nrs)
ons/scotland_babies_under_1
region, demographics.csv:78 (source ons)
country, :328 (source nrs)
The second ons/uk_population is 1,000 times too small. demographics.csv:139 records it in millions (person-m, 69.9 for 2025), but the loop multiplies every row by 1e3 ("Values in CSV are in thousands"), giving 69,900 people. For 2024–2029 the national copy is 982 to 1,001 times the region copy.
The two Scottish copies have identical values for 2022–2028.
Checked with TESTING=1 at eb247c6 (#595's head). Its ons_demographics.py, demographics.csv and registry.py are identical to main's (daad71c).
Effect
registry.get_all_targets keeps the first target of each name that passes its filters.
Calibration at 2025: none. The national loss matrix takes national targets first, then region, then country. So it keeps the national ons/uk_population and the region Scottish copies, and drops the thousands copy and the identical NRS copies.
The year-filtered path differs.get_all_targets(year=2023) skips the national copy, which has no 2023 value, and returns the region copy in thousands.
#595 records every target the matrix drops under a taken name with the status duplicate, and fails the build unless targets/known_gaps.yaml lists it. It lists these three names as known duplicates and links here. (It also lists the 156 HMRC SPI income-band duplicates, which #557 removes.)
Fix
Emit each name once: drop the demographics.csv copies of these three rows, or fix the unit and rename them. Then remove the three duplicate entries from known_gaps.yaml.
Activity
Report duplicate target names, scope known gaps to a build kind, and …
Drop the gaps #557 and #604 close (integration with both)