Phase 6B: Expense Matrix + Chart Inventory + Mobile Responsiveness - #21
Draft
thedatavigilante wants to merge 13 commits into
Draft
Phase 6B: Expense Matrix + Chart Inventory + Mobile Responsiveness#21thedatavigilante wants to merge 13 commits into
thedatavigilante wants to merge 13 commits into
Conversation
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
Sources: FRED inflation, BLS wages/CPI/unemployment, HUD FMR, DOL SUI rates, USASpending CFDA-17225, Census ACS county data Triggered by: workflow_dispatch
…nse matrix to Ch.3B
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 floorsChart Inventory section — new
#chart-inventorysection between Interactive Charts and Lawmaker Salary:Mobile responsiveness fixes:
.stat-grid,.stat-sub,.stat-box.warn,.chart-block(broke Ch.3B layout on all screens).chart-matrixCSS with.tick,.cross,.fig-numsub-selectors@media (max-width:640px): iframe height → 360px,.stat-gridsingle-column,.chart-matrixtighter font, nav flex-wrapoverflow-x:autocontainersBackend / data pipeline (already on branch):
col_bai_engine.py—MIT_EXPENSE_BREAKDOWN+MIT_EXPENSE_BREAKDOWN_WITH_CHILDconstants;expense_breakdown,expense_breakdown_with_child,cumulative_drainfields in outputgenerate_expense_matrix_figure.py— generatesfigures/15_expense_matrix.pnggenerate_plotly_charts.py—fig14_expense_matrix()function addeddata/col_bai_results.json— updated with expense breakdown fieldstests/test_data_integrity.py—15_expense_matrix.pngadded to EXPECTED_FIGS;test_col_bai_expense_breakdown()added.github/workflows/data_refresh.yml— Phase 7 runsgenerate_expense_matrix_figure.pyKey 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)
Test plan
pytest tests/ -v→ 37 passed, 1 skippedindex.html→ Ch.3B shows Figure 15 static PNG + interactive iframe#chart-inventoryfigures/15_expense_matrix.pngpresent after workflow run🤖 Generated with Claude Code
https://claude.ai/code/session_01KchNZ1Y2fjA8otTZK9ay5U