Fix diagnostics/cohorts tabs + add flag descriptions & SQL tooltips #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/diagnostics-cohorts-flaginfo"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Three small, independently-reviewed fixes/features bundled from the same working session, plus doc/changelog upkeep:
#ch_residuals) x-axis labels are now index-aligned to the underlying series. Previously assumed a "first N months" slice, which mismatched actual/predicted values whenever a mid-series month was filtered out of one metric.COHORT_DATA.cohorts— a key that never existed — instead of the real.rows). Now aggregatesloan_count/cum_loss_countacross theis_repeat/credit_score_bin/loan_duration_binbreakouts per(cohort_month, mob). Also fixes the "curves" view's MoB lookup, which assumed MoB values are a contiguous 1..N sequence aligned to array position (same bug shape as theportSeriesfix in8161f05); now looks up by actual MoB value, matching the "heatmap" view.create_wo_forecast_raw_v2.sql..planning/,progress.mdbrought current,CHANGELOG.mdbackfilled through0.5.0(also covering three previously-shipped-but-undocumented versions).Known issues — flagged, not fixed in this PR
#ch_cohort's parentinnerHTMLwith a<table>, destroying the canvas element. Switching back to "curves"/"snapshot" afterward will fail until the page is reloaded. Pre-existing bug (not introduced here); a low-risk fix approach (sibling container + display toggle instead of overwriting the canvas's parent) has been scoped but not implemented — needs a go/no-go..planning/SPEC-fix-cohorts-tab.mdandprogress.md, pending a product decision.is_graduated's SQL transcription fidelity issue found during review has already been fixed in this PR (see commit9c4a13f).Review
Independent spec-reviewer and quality-reviewer subagent passes were run against the live diff (not against the authors' own claims) for all three features — no CRITICAL/blocking findings. Full findings recorded in
.planning/SPEC-fix-diagnostics-tab.md,.planning/SPEC-fix-cohorts-tab.md,.planning/SPEC-flag-descriptions-and-sql.md.Test plan
Quality-reviewer flagged that renderKPIs' inline label map duplicated methodName() and disagreed with it for 'fcst' ("Forecast" vs "Final Forecast"). Corrects the map to lowercase labels per SPEC's literal scenario strings and adds avgLabel (appends " rate" only for Loss), matching R2's Avg-card wording exactly while keeping KPI-card and chart-title label spaces intentionally distinct. Findings recorded in SPEC-dashboard-ux-improvements.md.renderCohortsTab() read COHORT_DATA.cohorts, a key that never exists — export_cohort.py writes {flags, rows}, so cohorts always resolved to [] and the chart/heatmap/curves views were silently blank. Rows are also broken out by is_repeat/credit_score_bin/loan_duration_bin with no pre-aggregated rate, not flat {cohort, value} records. Reads COHORT_DATA.rows and aggregates loan_count/cum_loss_count across those three segment breakouts per (cohort_month, mob) — a count-weighted sum-then-divide, not an average of segment rates — before computing value = cum_loss_count/loan_count*100. NOTE: aggregating across all segments (vs. adding a segment-filter UI) is a judgment call, not a user-specified requirement — flagged as an open assumption pending user sign-off in PROPOSAL-fix-cohorts-tab.md. Also fixes the "curves" view's MoB lookup, which assumed MoB values are a contiguous 1..N sequence aligned to the label array's index (cohorts.find(... c.mob === i + 1)) — not reliably true, since MoB can be capped per cohort by loan_duration. Now parses the actual MoB number from the label and looks up by value, matching how the "heatmap" view already did it correctly. Same bug shape as the portSeries stale-reference fix (8161f05) and the diagnostics-tab residual fix earlier in this branch; grepped the rest of the file for a third instance — none found. Known separate issue, NOT fixed here: the "heatmap" view destroys the #ch_cohort canvas by replacing its parent's innerHTML with a <table>, so switching back to curves/snapshot afterward breaks. Flagged in SPEC-fix-cohorts-tab.md, left for a follow-up decision. Retroactively documented in PROPOSAL-fix-cohorts-tab.md, SPEC-fix-cohorts-tab.md (includes independent spec-reviewer + quality-reviewer verification).