Normalize cause names: 44 real causes include duplicates and plan names #34
All Vouch review confidence checks passed
Residual risk 0.37 = Change Risk (0.45) × (1 − Review Confidence (0.19)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 450 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 25% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.366
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #34"
general
weight: 0.35
claude[bot]
Summary
Staging now normalizes
causewith a newcause_namemacro (same idea ascrop_name): strips quotes, backticks and doubled spaces; merges the Other (Snow…), Mycotoxin and Failure of Irrigation Supply variants; maps every plan-name pseudo-cause (names containing "Crops Only", GRP, GRIP, ARPI, STAX or SCO/ECO) toArea plan (no cause recorded); maps blanks toNot recorded. The UI reads causes from the data, so the filter and county legend show the clean names with no UI change. Shape ofcounty-losses.jsonis unchanged.Seams: pytest through the published
county-losses.json(pipeline end to end on fixtures); Playwright journey for the cause filter.Two-way-door choices: canonical names are
Other (Snow, Lightning, Etc.),Mycotoxin,Failure of Irrigation Supply. The plan-name rule is a pattern, not a list of the eleven names, so new plan names are caught too.Evidence
test_cause_spellings_merge_and_plan_names_and_blanks_get_their_own_causes(fixture rows for every variant in the ticket, distinct amounts) failed before the macro and passes now; amounts sum per merged cause, so totals are unchanged by construction (group-by only).ui/e2e/causes.spec.tssavestest-results/causes.png.just checkis green (the cause-filter journey now waits for the map data before reading the options).just publish-livegives 31 distinct causes (ticket: about 30):- All Other Causes
- Area plan (no cause recorded)
- Asian Soybean Rust
- Cold Wet Weather
- Cold Winter
- Cyclone
- Decline in Price
- Drought
- Earthquake
- Excess Moisture/Precipitation/Rain
- Failure of Irrigation Equipment
- Failure of Irrigation Supply
- Federal or State Ordered Destruction
- Fire
- Flood
- Freeze
- Frost
- Hail
- Heat
- Hot Wind
- Hurricane/Tropical Depression
- Inability to Prepare Land for Irrigation
- Insects
- Mycotoxin
- Not recorded
- Other (Snow, Lightning, Etc.)
- Plant Disease
- Tornado
- Volcanic Eruption
- Wildlife
- Wind/Excess Wind
Merge Danger
Low. Rename-only in staging. Risk: a live cause I haven't seen that matches the plan pattern (e.g. a real cause containing "grip") would be folded into Area plan; none of the 31 live causes were affected. Saved bookmarks/URLs using old cause names (
?cause=...) will show no filter match.Closes #33
Follow-ups (filed as tickets when this PR merges)
pipeline/macros/cause_name.sql:9): A future real cause containing grip or arpi would silently be folded into Area plan. Anchor the pattern to known plan prefixes or add a dbt test that flags new causes in that bucket.pipeline/models/staging/stg_cause_of_loss.sql:7): Old links with the previous cause names match nothing after this change. Check what the UI does with an unknown cause and add a fallback and a test if needed.<!-- factory-follow-ups
[{"kind":"follow-up","title":"Plan pattern is a loose substring match","path":"pipeline/macros/cause_name.sql","line":9,"body":"A future real cause containing grip or arpi would silently be folded into Area plan. Anchor the pattern to known plan prefixes or add a dbt test that flags new causes in that bucket."},{"kind":"follow-up","title":"Renamed causes break saved ?cause= links","path":"pipeline/models/staging/stg_cause_of_loss.sql","line":7,"body":"Old links with the previous cause names match nothing after this change. Check what the UI does with an unknown cause and add a fallback and a test if needed."}]
-->