You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All 3 signals flow through the adjustment dampener (logit-space decay at 0.70/signal) — no stacking blowup.
All 3 signals added to _layer_audit JSONB and _all_adjs dampener list.
Signal ranges (calibrated conservatively)
Arm angle: max +3pp (requires >8° deviation from 42° MLB avg)
Swing path: max +4pp combined (tilt + ideal rate)
Chase discipline: max ±2.5pp
No regressions
All fallback-safe: try/except blocks, no hard failures
hitter_strikeouts props already flowed through BPV layer — signals appended after
Adds three new Statcast signals to enrich K props. Improves pitcher and hitter strikeout accuracy with dampened adjustments and new audit fields.
New Features
Arm angle deception (pitcher strikeouts): uses pitcher_arm_angles.csv to measure deviation from the 42° MLB average; adds _arm_angle_adj (up to +3pp), recorded in _all_adjs and audit (arm_angle).
Swing path K-susceptibility (hitter_strikeouts): uses bat-tracking-swing-path.csv (swing_tilt, ideal_attack_angle_rate); adds _swing_path_k_adj (up to +4pp), plus _swing_tilt/_ideal_attack_rate; logged in _all_adjs and audit (swing_path_k).
Chase discipline (hitter_strikeouts): loads swing-take.csv into a new _swing_take store and exposes get_batter_chase_discipline; computes _chase_discipline_k_adj from runs_chase_pa (±2.5pp), logged in _all_adjs and audit (chase_disc_k).
All three signals run through the logit-space dampener (0.70 per signal) and use safe try/except fallbacks to avoid hard failures.
Written for commit fe11e06. Summary will update on new commits.
@jaayslaughter-cpu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 53 seconds before requesting another review.
You’ve run out of usage credits. Purchase more in the billing tab.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.
We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
We reviewed changes in 58c74d8...fe11e06 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer TIP This summary will be updated as you push new changes.
The reason will be displayed to describe this comment to others. Learn more.
Undefined variable '_LOADED'
The variable name is not defined where it is used.
This will lead to an error during the runtime.
Make sure there is no typo. If the name was supposed to be imported, verify that you've actually imported the name.
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces new enrichment signals for pitcher strikeouts and batter strikeout susceptibility by incorporating Statcast data on arm angle deception, swing path mechanics, and chase zone discipline. The feedback highlights a critical error where an undefined variable _LOADED is referenced instead of _loaded, and a high-severity bug in the data loading logic where 0.0 values are incorrectly handled by _safe_float, causing valid player records to be skipped.
The reason will be displayed to describe this comment to others. Learn more.
The variable _LOADED is not defined in this module; the correct variable name is _loaded (lowercase), as seen on line 68. Furthermore, the _load() function already contains an internal check for the _loaded state (line 137), making this manual check redundant. Calling _load() directly is the standard pattern used throughout this module.
The reason will be displayed to describe this comment to others. Learn more.
The current implementation of _safe_float (line 111) returns the default value (which is None here) when the input is 0.0. This causes a TypeError during the division by pa on lines 551-554, which is then caught by the except block on line 557, resulting in the entire player record being skipped. Since 0.0 is a valid and common run value in the Statcast dataset, it should be handled correctly. Using float() directly is safe here because the if condition already ensures the value is a non-empty string.
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
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.
PR #564: Wire 3 new Statcast signals into prop enrichment
What's added
statcast_static_layer.py(+38 lines)data/statcast/swing-take.csvinto_swing_takedict (per-PA runs gained/lost by zone)get_batter_chase_discipline(player_id)→{runs_chase_pa, runs_shadow_pa, pa}prop_enrichment_layer.py(+90 lines, 3 signal blocks)pitcher_arm_angles.csvstrikeoutsbat-tracking-swing-path.csvhitter_strikeoutsswing-take.csvhitter_strikeoutsAll 3 signals flow through the adjustment dampener (logit-space decay at 0.70/signal) — no stacking blowup.
All 3 signals added to
_layer_auditJSONB and_all_adjsdampener list.Signal ranges (calibrated conservatively)
No regressions
try/exceptblocks, no hard failureshitter_strikeoutsprops already flowed through BPV layer — signals appended afterstatcast_static_layer.py: 911 → 1011 lines;prop_enrichment_layer.py: 1966 → 2055 linesSummary by cubic
Adds three new Statcast signals to enrich K props. Improves pitcher and hitter strikeout accuracy with dampened adjustments and new audit fields.
strikeouts): usespitcher_arm_angles.csvto measure deviation from the 42° MLB average; adds_arm_angle_adj(up to +3pp), recorded in_all_adjsand audit (arm_angle).hitter_strikeouts): usesbat-tracking-swing-path.csv(swing_tilt,ideal_attack_angle_rate); adds_swing_path_k_adj(up to +4pp), plus_swing_tilt/_ideal_attack_rate; logged in_all_adjsand audit (swing_path_k).hitter_strikeouts): loadsswing-take.csvinto a new_swing_takestore and exposesget_batter_chase_discipline; computes_chase_discipline_k_adjfromruns_chase_pa(±2.5pp), logged in_all_adjsand audit (chase_disc_k).try/exceptfallbacks to avoid hard failures.Written for commit fe11e06. Summary will update on new commits.