Skip to content

Fix lag chart x-axis labels, add driver correlation/VIF confounding check#17

Merged
Hefrock merged 3 commits into
mainfrom
claude/kind-planck-vX3h2
Jul 7, 2026
Merged

Fix lag chart x-axis labels, add driver correlation/VIF confounding check#17
Hefrock merged 3 commits into
mainfrom
claude/kind-planck-vX3h2

Conversation

@Hefrock

@Hefrock Hefrock commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix the lag-correlation bar chart's x-axis: 0-8 was rendering rotated/sideways by default, now upright.
  • Add driver_correlation_matrix() (src/analysis/correlate.py) and driver_vif() (src/analysis/regression.py) — per-driver findings elsewhere in this app are univariate (each driver tested against hospital_demand alone), with no visibility into whether the drivers are correlated with each other, which can make an independent-looking effect actually reflect a correlated peer.
  • Surface this as a new live, read-only "Driver correlation matrix (confounding check)" expander in the dashboard's Correlation & Regression tab (deseasonalized pairwise correlation heatmap + VIF table, recomputed from whatever data/date-range is currently loaded — never goes stale).
  • Add a one-paragraph README caveat pointing to the dashboard for the live numbers, rather than baking specific figures into static text (the README has already gone stale once from baked-in numbers, fixed in Fix dashboard date-range UX and correct README findings #16).

Test plan

  • pytest tests/ -q — 103 passed (8 new tests covering driver_correlation_matrix and driver_vif)
  • Verified both changes against a freshly started streamlit run src/dashboard/app.py with a headless browser: lag chart labels render upright; new expander renders a correct heatmap + VIF table, independently cross-checked against a standalone re-derivation of the same numbers from the raw parquet data

https://claude.ai/code/session_011FPpSio8V9rxWMCG5RnYxB


Generated by Claude Code

github-actions Bot and others added 3 commits June 18, 2026 14:38
The lag_weeks ordinal axis defaulted to a steep label angle, rendering
0-8 sideways instead of upright.
Per-driver findings were always univariate (each driver tested against
hospital_demand alone) with no visibility into whether the drivers are
correlated with each other. Adds driver_correlation_matrix() and
driver_vif() to the analysis layer, a live read-only "Driver correlation
matrix (confounding check)" expander in the dashboard's Correlation &
Regression tab, and a one-paragraph README caveat pointing there instead
of baking specific numbers into static text.
The bundled weather sample spans a fixed ~1-year window frozen at
make_samples generation time, but run.py (and the fallback tests) request
a window relative to today. Once the committed sample aged past the
trailing-365-day window, _load_sample clipped to zero rows — the sample
tier silently dropped the signal. That broke the daily-ingestion
workflow's gating test job (needs: test) every scheduled run since
2026-06-26, blocking real ingestion even though live Open-Meteo works.

Make the fallback genuinely fail-soft: slide the sample by whole years
until it covers the requested window before clipping. The planted signal
is day-of-year seasonal, so a whole-year shift preserves it; shifting the
naive timestamps before localizing keeps the existing DST guards in
charge of the spring-forward/fall-back hours.

The same latent clip-to-empty behavior exists in wastewater.py and
hospital.py sample loaders (not addressed here — their tests don't use a
today-relative window, so CI isn't failing on them).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FPpSio8V9rxWMCG5RnYxB
@Hefrock
Hefrock merged commit 3ad779e into main Jul 7, 2026
1 check passed
@Hefrock
Hefrock deleted the claude/kind-planck-vX3h2 branch July 7, 2026 04:20
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