5 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 886938f1a9 Board: show each county's districts + representatives in the drill-down
Surfaces the new graph layer on the Board. build_viz.py resolves each
county's district edges to their current representatives (via
build.person_district_node) and injects a per-county `districts` block into
CDETAIL; board.html renders "In Congress / State Senate / State House"
sections in the drill-down, each rep with their district and % of county
covered. County detail now spans 3,221 counties (was 1,049) since every
county with district edges gets a drill-down, not only those with local
officials. Deterministic (board.html byte-identical on rerun).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 22:40:00 -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 092e54ae21 Board: drill down into each county
Click any county to open a detail panel: its demographics, then the
actual officeholders in the mirror — grouped by county government and by
municipality, each with name and role — and a link to the county's files
on GitHub.

Richest for Florida, mirrored to the municipal level: e.g. St. Lucie
opens to 33 officeholders (18 county — commission, sheriff, tax collector,
school board — plus Fort Pierce, Port St. Lucie, and St. Lucie Village).
Counties without officeholders yet show their demographic node and a note.

Detail data (viz/county_detail.json, 181 KB) extracted from the entity
tree: 67 FL counties, 1,058 county + 2,124 municipal officials. Modal
closes on X, backdrop, or Esc. Verified in-browser: click opens the
panel, names render First-Last, municipality sections and GitHub links
resolve.

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