Skip to content

Census 2023 weekly rent paid by households, by regional council (NZ, G8-d1) - #341

Merged
MaxGhenis merged 4 commits into
mainfrom
nzhub/g8d1-census-rent
Oct 12, 2026
Merged

MaxGhenis merged 4 commits into
mainfrom
nzhub/g8d1-census-rent

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Adds Census 2023 weekly rent paid by households for New Zealand, the 16 regional councils and the Area Outside Region: 162 published facts from the Stats NZ Place Summaries files that #335 already pinned. This is package G8-d1 of microcosm#1183. Microcosm NZ's rent input (method card MC8) needs a rent distribution, and Chronicle had none.

No new source file, no new R2 object: the family reads the 18 CSVs in db/data/stats_nz/census_2023_place_summaries/ exactly as the #335 families do.

What this adds

packages/stats_nz/census_2023_weekly_rent/: a national root plus 17 rc_XX children (rc_01–rc_09, rc_12–rc_18, rc_99), 18 aliases, nine facts per place.

Section Categories Value type Facts per place
Weekly rent paid by households Under $200; $200 - $299; $300 - $399; $400 - $499; $500 - $599; $600 - $699; $700 - $799; $800 and over Count 8
Median weekly rent paid by households the table row Median (nzd_per_week, aggregation: median) 1

Spot values, checked against the files:

  • New Zealand bands: 89,439; 53,325; 80,247; 101,067; 99,042; 68,544; 32,286; 35,712. Median $450.
  • Auckland Region bands: 28,113; 9,909; 16,734; 28,827; 42,645; 37,143; 19,629; 22,899. Median $540.

Not emitted, but preserved in the pinned files: Percent rows, the 2013 and 2018 periods, and the Māori-ethnic-group sections. The median also appears as a Quick-stats row with the same value. The package selects the table row, by its row identity, as the #335 families do for duplicated quick stats.

What the product doesn't state, and the package doesn't assert:

  • the rent population, for example whether these are rented occupied private dwellings with a stated rent;
  • the regional boundary vintage;
  • any rounding note.

The reference date is census night, 7 March 2023.

Invariants and how they're checked

  • One CSV row per fact, with no sums. New Zealand rows are their own facts, never a sum of regions. The bands are never totalled.
  • Exact selection. The test declares every expected fact from literal lists (place, section, category, row identity), independent of the package YAML, and requires exactly that set.
  • Status lineage. confidentiality_indicator and final_indicator travel with each fact. A flagged row is never emitted as a number. All 162 selected rows are unflagged.
  • Labels as published, including the spacing in $200 - $299. Every dimension and value carries a label (Dimension labels are only checked for the UK suite: 68 of 79 other packages fail the consumer_fact.v2 rules #265).

Mutants that fail the tests:

  • a Percent row in place of a Count row;
  • a 2018 row in place of 2023;
  • Northland's file read for Auckland;
  • a Māori-ethnic-group row in place of the total-population row;
  • the Quick-stats median in place of the table median;
  • a band relabelled as its neighbour.

Tests

  • tests/test_chronicle_nz_census_weekly_rent.py: 185 cases. The build lane ran it, and the hub re-ran it on the final tree after merging main. It covers validate-package and a single-source suite for all 18 members.
  • tests/test_chronicle_nz_census_households.py (186) and the alias-drift tests still pass. Since Discover nested source-package members so the alias-drift guard sees them #338, the drift guard sees the nested members.
  • The full-bundle node is left to CI.

Bundle pins

Measured against main 3c113e8a (#338, merged since, changes no pins):

  • facts +162 (1,004,092 → 1,004,254), of which 144 are counts and 18 medians;
  • packages +18 (359 → 377); tables +1 (318 → 319);
  • geographies +0, sources +0, warnings +0;
  • by_source stats_nz +162; household +162; calendar_year:2023 +162;
  • each of the 18 existing Census geographies +9.

Chronicle governance

  • Agent role: ledger-source-ingestor. The per-package files outside its allowed_paths are the alias entries in chronicle/source_package.py, the checklist row, the changelog fragment and the bundle pins.
  • Judges: the build lane's local independent reviewers gave ledger-source-fidelity: PASS (all 18 packages match exactly the 162 physical rows; checksums and sizes match) and ledger-boundary: PASS (direct values, distinct count and median units, no computed values). The independent review that follows is asked for both as named verdicts.
  • Receipts: the 18 objects were published and verified for Add Stats NZ 2023 Census household and family counts by regional council #335. chronicle verify-raw --root db/data/stats_nz/census_2023_place_summaries --manifest 'manifest-*.yaml' re-checks them.

Built by a GPT-6.1 Sol lane from the NZ hub's brief.

🤖 Generated with Claude Code

MaxGhenis and others added 4 commits October 11, 2026 22:08
Add 18 package members sharing the unchanged, already-published Place
summaries files. Emit 162 publisher facts: eight rent-band counts and one
published median in NZD per week per place. Pin table median line 1763
rather than identical Quick stats line 13; preserve labels and status lineage,
census-night coverage, and unstated population/boundary qualifications.

Add independent literal row/cell tests, six red YAML demonstrations,
aliases, checklist/evidence, changelog and default-bundle pins.

Validation: 185 weekly-rent cases verified (184 initial passes plus the
corrected 2018-median mutant rerun); final real Auckland map rerun passes.
All 18 validate-package and build-source-suite checks pass; existing
household/family 186 cases and alias-drift 1 case pass. Six scratch YAML
mutants fail the independent-map test as required. Local source-fidelity
and boundary read-only reviews PASS; formal merge gates remain for the hub.

Measured delta against main (3c113e8):
facts +162 (144 Count, 18 published Median), default 1004092 -> 1004254;
geographies +0 (20548 unchanged); 18 existing keys each gain 9 facts;
sources +0 (56 unchanged), by_source stats_nz +162 (1786 -> 1948);
packages +18 (359 -> 377), national root and 17 rc_XX members;
tables +1 (318 -> 319), stats_nz:2023 Census Place summaries: weekly rent paid by households=+162;
warnings +0 (117 unchanged); errors +0, skipped sources +0;
period_count +0 (511 unchanged), calendar_year:2023=+162;
entity_count +0 (12 unchanged), household=+162 (154852 -> 155014);
by_geography: country:NZ=+9, region:01=+9, region:02=+9, region:03=+9, region:04=+9, region:05=+9, region:06=+9, region:07=+9, region:08=+9, region:09=+9, region:12=+9, region:13=+9, region:14=+9, region:15=+9, region:16=+9, region:17=+9, region:18=+9, region:99=+9.
Final geography pins: country:NZ=6131; region:01-09,12-18=30 each;
region:99=25. Aggregate and semantic duplicate-key deltas both 0;
default duplicate pins remain 0 and 2324.
Measurement: 18 sequential build_bundle calls with exactly one explicit
source each; all 18 valid, 9 facts each, zero warnings/errors/duplicates.
Each single-source output was deleted immediately; no full bundle built.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
#340 added a curated NZ roster whose drift guard requires every alias
under the NZ publisher prefixes. After merging main, the 18
stats-nz-census-2023-weekly-rent members failed it, as intended. This
adds them to NZ_BUNDLE_SOURCES (48 -> 66 packages) and to the test's
Census roots (36 -> 54 Census members), and notes the suite in the
changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 12, 2026 10:39
@MaxGhenis
MaxGhenis merged commit a5280e1 into main Oct 12, 2026
3 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Merged by the NZ hub (session local_e407a527) at 239bf84 with --squash. Gates: gh pr checks exit 0; MERGEABLE; not draft; no CHANGES_REQUESTED review. Reviewed head: 239bf84. Delta review 20261012-045000 (GPT-6.1 Sol) APPROVE_WITH_NITS at 239bf84: alias drift 28 passed, bundle 24, weekly rent 185; ledger-source-fidelity PASS, ledger-boundary PASS. Its 'Needs Max' flag was for publishing Stats NZ's own census figures (162 facts, no PolicyEngine number); hub judged no, as for #209 under d962. Nit not applied: evidence.md already discloses that the hub supplies the census date (7 March 2023) and NZD basis and that the CSVs state only 2023/Census/dollars; a publisher citation for both rides the next Stats NZ package (G8-d2).

@MaxGhenis
MaxGhenis deleted the nzhub/g8d1-census-rent branch October 12, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant