4 Commits

Author SHA1 Message Date
Fabio 802c49a89d Board: add a partisan-lean lens
Fourth lens on the Board, coloring each county by the D/R balance of the
state + federal representatives who cover it — the offices that are
actually partisan (99% D/R coverage vs ~0% for nonpartisan local seats).

Pipeline (build_viz.py):
- Carry each district rep's party alongside their name through the
  county<->district edge mapping.
- Per county, tally reps by party over districts covering >=5% of its
  area (slivers excluded), and store lean = (R-D)/(R+D) in [-1,+1] plus
  repD/repR counts. Head-count, not area-weighted, so the number matches
  the readout and isn't skewed toward large rural districts. 3130/3131
  counties resolve.

Board (board.html):
- "Partisan lean" lens with a diverging blue<->grey<->red ramp (centered
  at 0, skipped in the percentile-rank machinery the other lenses use).
- Diverging legend (More Democratic / More Republican).
- Readout gains a Representation row (e.g. "8 D · 3 R  D+45").
- Drill-down district reps get a D/R party badge.

Verified in preview: no console errors; Manhattan -1.0 (21D/0R), LA -0.46,
Palm Beach even (3D/3R), Loving TX +1.0; readout, color, and badges agree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-06 08:59:51 -04:00
Fabio 662ccecb26 Board: surface the newly-nested municipals in county drill-downs
build_viz.py was resolving officials to counties without the place→county
crosswalk, so only FL's 67 counties had rosters. Factor the resolver out of
build.py into a shared build.place_resolver() and use it in both, so the
Board and the tree agree by construction.

- scripts/build.py — extract place_resolver(); main() now calls it (tree
  output byte-identical, refactor is behavior-preserving)
- scripts/build_viz.py — resolve via the shared resolver
- viz/county_data.json, viz/county_detail.json — regenerated

County drill-downs: 67 → 1049 counties with rosters; officials mapped
5184/5226 (42 county-unresolvable, tree-only). Deterministic.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 20:36:42 -04:00
Fabio 7a2cc64362 Sync: officeholders v3 — fresh export from live Atlas DB (13,329 tenures)
Re-exported directly from Postgres (10.0.0.116), not Atlas's introspection,
which under-reported the roster (its v3 export had 11,473, missing the
restored Florida League of Cities municipal set). Live DB current tenures:
state 7,561 · municipal 4,009 · county 1,217 · federal 542.

- build.py now reads officeholders-v3.jsonl (was v2); dataset vintage 2026-07-04
- fixed one corrupt start_date at source-export (21021-12-03 -> 2021-12-03,
  Lorraine Borowski, Mayor of Decorah IA)
- scripts/build_viz.py: committed, deterministic generator for the Board's
  county_data.json / county_detail.json (previously built ad-hoc)
- generate_changelog.py: ignore files whose only change is the vintage stamp,
  so the diff reflects government change, not re-export bookkeeping

Person files 11,285 -> 13,329. Non-FL municipal officials (1,903) are in the
tree but not yet county-mappable (place->county crosswalk still NULL).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 18:56:37 -04:00
Fabio e126d3e374 The Board, v2: nationwide county map with lenses
The map grew with the data. The old Board showed coverage at the state
level with a Florida drill-down; now that every US county is a demographic
node, the Board renders all 3,109 contiguous counties directly, with
switchable lenses:

  Coverage       — the true fog of war: 67 FL counties lit (officeholders
                   mirrored), the other 3,000+ dark on the frontier.
  Population     — ACS 2023 choropleth, 33 to 9.8M.
  Median income  — k to k.
  Poverty rate   — 1.4% to 48%.

Hover any county for its full readout (demographics + officeholder count).
Self-contained: inlined county geometry (duplicate-point-collapsed),
state-border overlay, hand-rolled projection, event-delegated hover for
3,109 paths, vanilla JS — no external requests. Verified: projection
places counties correctly, 3,099/3,109 join to ACS data.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 08:52:21 -04:00