Skip to content

Phase 6B: Expense Matrix + Chart Inventory + Mobile Responsiveness - #21

Draft
thedatavigilante wants to merge 13 commits into
mainfrom
claude/data-source-improvement-ysj9mv
Draft

Phase 6B: Expense Matrix + Chart Inventory + Mobile Responsiveness#21
thedatavigilante wants to merge 13 commits into
mainfrom
claude/data-source-improvement-ysj9mv

Conversation

@thedatavigilante

@thedatavigilante thedatavigilante commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Completes Phase 6B: expense category matrix (Figure 15), chart inventory table, and mobile responsiveness fixes.

What's new

Chapter 3B additions — expense breakdown embedded directly in the Real Cost Gap section:

  • figures/15_expense_matrix.png — 3-panel static matplotlib figure showing weekly MIT Living Wage expense categories stacked vs. UI benefit floor; DC panel highlights "Housing alone ($476) exceeds UI check — already −$32 before food"
  • interactive/fig14_expense_matrix.html — Plotly scenario toggle (1 Adult / 1 Adult + 1 Child); dotted green lines show $444 DC / $430 MD+VA floors

Chart Inventory section — new #chart-inventory section between Interactive Charts and Lawmaker Salary:

  • Table mapping all 16 visualizations to static PNG and interactive HTML status
  • Nav anchor "Charts" added to sticky nav

Mobile responsiveness fixes:

  • Added missing CSS classes: .stat-grid, .stat-sub, .stat-box.warn, .chart-block (broke Ch.3B layout on all screens)
  • Added .chart-matrix CSS with .tick, .cross, .fig-num sub-selectors
  • Expanded @media (max-width:640px): iframe height → 360px, .stat-grid single-column, .chart-matrix tighter font, nav flex-wrap
  • Wrapped lawmaker salary table and data sources cite-table in overflow-x:auto containers

Backend / data pipeline (already on branch):

  • col_bai_engine.pyMIT_EXPENSE_BREAKDOWN + MIT_EXPENSE_BREAKDOWN_WITH_CHILD constants; expense_breakdown, expense_breakdown_with_child, cumulative_drain fields in output
  • generate_expense_matrix_figure.py — generates figures/15_expense_matrix.png
  • generate_plotly_charts.pyfig14_expense_matrix() function added
  • data/col_bai_results.json — updated with expense breakdown fields
  • tests/test_data_integrity.py15_expense_matrix.png added to EXPECTED_FIGS; test_col_bai_expense_breakdown() added
  • .github/workflows/data_refresh.yml — Phase 7 runs generate_expense_matrix_figure.py

Key finding added

DC's $444 UI maximum benefit is already $32/week in the red from housing alone ($476/wk FMR). The expense matrix makes this visible: six expense categories stacked in order, with the benefit floor shown as a hard cutoff line.

Chart inventory (all 16 visualizations)

Fig Title Static Interactive
01–08 BAI, WBI, MIPI, Housing Gap, Per-Employee, Aggregate, Wage Base, RVI ✓ fig01–08
09, 10 Unemployment Context, Spending Accountability — static only
11–13 FEC Total, Business vs Labor, Mix ✓ fig11–13
14 COL-BAI Comparison — static only
15 Expense Category Matrix ✓ fig14_expense_matrix.html
DMV County Map ✓ dmv_counties.html

Test plan

  • pytest tests/ -v → 37 passed, 1 skipped
  • Open index.html → Ch.3B shows Figure 15 static PNG + interactive iframe
  • On mobile (≤640px): stat-grid boxes stack vertically, iframes shrink to 360px, tables scroll horizontally
  • Chart Inventory section visible with all 16 rows, tick/cross formatting
  • Nav "Charts" link scrolls to #chart-inventory
  • figures/15_expense_matrix.png present after workflow run

🤖 Generated with Claude Code

https://claude.ai/code/session_01KchNZ1Y2fjA8otTZK9ay5U

claude and others added 7 commits July 10, 2026 01:17
Extends the BAI metric to the full cost-of-living picture using two
authoritative sources requiring no new API keys:

New scripts (3):
  fetch_bls_metro_cpi.py     — BLS metro CPI series for DC/Baltimore metros;
                               3-tier fallback, supplements COL context data
  col_bai_engine.py          — COL-BAI engine using BEA RPP (all items, 2022)
                               and MIT Living Wage Calculator (1-adult, 2024)
  generate_col_bai_figure.py — Figure 14, 3-panel: BAI vs COL-BAI; Living
                               Wage Gap 2010/2018/2026; Coverage trend

New data files (3):
  data/bls_metro_cpi.json    — BLS metro CPI cache (hardcoded fallback active)
  data/col_bai_results.json  — 9-row COL-BAI output (3 states × 3 years)
  figures/14_col_bai_comparison.png

Key findings added to index.html (Chapter 3B):
  DC:  COL-BAI 0.717 (vs BAI 0.854); Living Wage Gap −$652/wk; Coverage 40%
  MD:  COL-BAI 0.883 (vs BAI 0.956); Living Wage Gap −$496/wk; Coverage 46%
  VA:  COL-BAI 0.989 (vs BAI 1.024); Living Wage Gap −$430/wk; Coverage 50%

Also:
  methodology.html  — COL-BAI formula section, BEA RPP table, MIT LW table,
                      BLS metro CPI note, limitations
  tests/            — 3 new tests (schema, plausibility, BLS cache); 35 pass
  data_refresh.yml  — added fetch_bls_metro_cpi.py, col_bai_engine.py,
                      generate_col_bai_figure.py to monthly pipeline

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KchNZ1Y2fjA8otTZK9ay5U
Adds a full breakdown of MIT Living Wage expenses by category (housing,
food, transportation, healthcare, childcare, other) vs. the UI maximum
benefit, with cumulative drain logic showing exactly when the check hits zero.

Key finding: DC claimants are already $32 in the red from housing alone
($476 housing vs $444 UI max) — before food, transport, or healthcare.

New files:
  generate_expense_matrix_figure.py  — Figure 15, 3-panel horizontal
    stacked bar per jurisdiction; UI max line; cumulative drain annotations;
    both 1-adult and 1-adult+1-child scenarios; 3-tier fallback
  interactive/fig14_expense_matrix.html — interactive version with scenario toggle

Updated:
  col_bai_engine.py          — MIT_EXPENSE_BREAKDOWN + MIT_EXPENSE_BREAKDOWN_WITH_CHILD
                               constants; compute_col_bai() returns expense_breakdown,
                               expense_breakdown_with_child, cumulative_drain
  data/col_bai_results.json  — regenerated with expense breakdown fields
  generate_plotly_charts.py  — added fig14_expense_matrix() with scenario toggle
  tests/test_data_integrity.py — Figure 15 in EXPECTED_FIGS; expense breakdown test
  data_refresh.yml           — generate_expense_matrix_figure.py added to pipeline
  interactive/fig01-04.html  — Plotly UUID refresh
- Add chart inventory table (16 visualizations) between Interactive and Lawmaker sections
- Add Charts nav anchor
- Add missing CSS: .stat-grid, .stat-sub, .stat-box.warn, .chart-block, .chart-matrix
- Expand @media (max-width:640px): iframe height, stat-grid column, chart-matrix font, nav wrap
- Add overflow-x:auto to lawmaker salary table and data sources cite-table
- Embed figures/15_expense_matrix.png and interactive/fig14_expense_matrix.html in Ch.3B
- Fix duplicate </table> tag in lawmaker section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KchNZ1Y2fjA8otTZK9ay5U
@thedatavigilante thedatavigilante changed the title Phase 6A: COL-BAI & MIT Living Wage — Figure 14 + Chapter 3B Phase 6B: Expense Matrix + Chart Inventory + Mobile Responsiveness Jul 18, 2026
github-actions Bot and others added 6 commits July 18, 2026 21:34
Sources: FRED inflation, BLS wages/CPI/unemployment, HUD FMR,
DOL SUI rates, USASpending CFDA-17225, Census ACS county data

Triggered by: workflow_dispatch
New visualization scripts (8 new chart types):
- generate_slope_chart.py → 16_slope_coverage_collapse.png (slope chart)
- generate_policy_timeline.py → 17_policy_freeze_timeline.png (Gantt)
- generate_heatmap.py → 19_adequacy_heatmap.png (heatmap 3x3)
- generate_waterfall_chart.py → 25_waterfall_expense_drain.png (waterfall)
- generate_summary_figures.py → 20_radar_severity.png, 21_small_multiples.png
- generate_sui_charts.py → 23_sui_rate_decline.png, 24_sui_wagbase_dual.png
- generate_accountability_charts.py → 26_constituent_income_scatter.png, 27_lawmaker_pay_diverging.png
- generate_gauge_chart.py → 22_bai_gauge.png (gauge panel)

index.html: 12 new figures embedded across chapters + Appendix section
(Fig 1.3/1.4 in Ch1, 2.2/2.3 in Ch2, 3B.3/3B.5 in Ch3B, 4.4 in Ch4,
5.5/5.6 in Ch5, A.1/A.2 in new Appendix); chart inventory expanded to
27 rows with Chart Type column; nav updated

tests: EXPECTED_FIGS 15→26 entries; test_sui_rates_3x3_complete added;
53 tests pass

data_refresh.yml: Phase 7 step now runs all 8 new generate_*.py scripts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KchNZ1Y2fjA8otTZK9ay5U
New visualization scripts (figs 16–27):
- generate_slope_chart.py → 16_slope_coverage_collapse.png (slope chart)
- generate_policy_timeline.py → 17_policy_freeze_timeline.png (Gantt)
- generate_heatmap.py → 19_adequacy_heatmap.png (heatmap)
- generate_waterfall_chart.py → 25_waterfall_expense_drain.png (waterfall)
- generate_summary_figures.py → 20_radar_severity.png, 21_small_multiples.png
- generate_sui_charts.py → 23_sui_rate_decline.png, 24_sui_wagbase_dual.png
- generate_accountability_charts.py → 26_constituent_income_scatter.png, 27_lawmaker_pay_diverging.png
- generate_gauge_chart.py → 22_bai_gauge.png (gauge panel)

Updated:
- tests/test_data_integrity.py: add figs 16–27 to EXPECTED_FIGS; add test_sui_rates_3x3_complete
- .github/workflows/data_refresh.yml: add new scripts to Phase 7 figure generation step
Verified computation: $430 − $285 − $85 − $130 − $43 − $70 = −$183/wk.
The −$213 figure did not correspond to any calculation from the data.
Identified via Phase 7 fact-check matrix audit (figures 16–27).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KchNZ1Y2fjA8otTZK9ay5U
- DC taxable wage base: start_year 2018 → 2010; CSV confirms $9,000 in 2010,
  2018, AND 2026 — the wage base was not raised in 2018. Remove false EVENTS
  marker that asserted a 2018 DC wage-base change.
- MD max WBA: start_year 2014 → 2010; CSV confirms $430 in 2010, 2018, AND 2026
  — freeze predates 2014. Duration corrected 12yr → ≥16yr.
- Regenerated figures/17_policy_freeze_timeline.png to reflect corrections.

Both corrections traced to dmv_macro_baselines.csv anchor-year evidence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KchNZ1Y2fjA8otTZK9ay5U
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.

2 participants