fix(#323): Albania cluster grain — a lone mover was setting a whole cluster's district#620
fix(#323): Albania cluster grain — a lone mover was setting a whole cluster's district#620ligon wants to merge 1 commit into
Conversation
68d013c to
afdbfc4
Compare
…el fix (#323) Config/script only: no change to lsms_library/country.py, feature.py or local_tools.py, and no data_scheme `aggregation:` key. Per Ethan's decisions in slurm_logs/DESIGN_grain_collapse_sites_2026-07-13.org (D1: core does not aggregate), the core patch on fix/323-albania is dropped -- Site 1 is owned by PR #614 and Site 2 by its own PR. The original branch is left intact as the audit trail. Refs #323 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
afdbfc4 to
010f2b0
Compare
Adversarial review — APPROVE_WITH_NOTESI tried to break this cold and could not break the data. Every headline number reproduces, and the 2004 semantic claim survives independent corroboration it did not ask for. Method. Two detached worktrees ( What I re-derived myself
The attacks that matteredCould the anchor have scored well by splitting real entities? No — it does the opposite. I recomputed Region from the 2002 anchor and compared it to the within-2004 plurality district for all 448 PSUs: 447 agree, 1 disagrees — PSU 223, the n=1 lone-mover case, exactly as claimed. The anchor is not carving clusters up along movers' destinations; it is overriding Is the learned code→name map actually right, or just internally consistent? I dumped it and checked it against something outside this repo: it is exactly the official INSTAT 36-district numbering, including the Albanian-collation quirks — Invariance by missingness? Checked both directions. 0 NaN districts in the 2004 source, so the Is the Does the new test discriminate? Yes. Copied Conservation — did anything else move? Every one of Albania's 10 tables, cold on both trees, is identical once Cache. A cache written by pre-fix code, then read under post-fix config, auto-rebuilds (448, sentinels gone, 223→GRAMSH). The v0.8.0 hash does cover this change. Core's own instrument agrees. On Scope. Config + tests + ledger only. No Notes (none block merge)1. (MEDIUM) 2. (LOW) A doc claim that does not reproduce. 3. (LOW) Cache-hash gap on the 2002 anchor. 4. (note) Verdict: APPROVE_WITH_NOTES. |
Config-only. Zero changes to the access path (
country.py/feature.py/local_tools.py) — core is owned by PR #614 (Site 1) and #617 (Site 2). Supersedes the core patch onfix/323-albania, perslurm_logs/DESIGN_grain_collapse_sites_2026-07-13.org.The fix
Converts 4 waves of
cluster_featuresfrom a YAML extraction — whosei: hhidxvar fed a silent household→cluster.first()— into script-path builds callingalbania.cluster_reduce, a country-level helper incountries/Albania/_/albania.py. The reduction is now the country's, explicit and checked, not core's and silent.Plus a genuine semantic fix. Albania is a panel that follows movers, and 2004's
m0_distris the household's current district while the PSU code is its original one. So.first()was handing movers' districts to whole clusters. Six clusters were wrong;223 → GRAMSHwas decided by a lone mover.Also drops sentinel "PSUs" 995/999, which are not clusters (450 → 448).
Verified (cold,
LSMS_NO_CACHE=1)vvalues insample().Structural check
Albania is a panel with movers — the 2004 follow-up reuses the original 2002 PSU, which is the entire point of the fix. It also carries a GH #445
waveslist excluding 1996; thealbania.pydiff is two hunks (import warnings+ an EOF append) with zero deletions, so that list is intact. Nopanel_ids, hence noid_walkchain to disturb.Refs #323.
🤖 Generated with Claude Code