The FullCard migration requires offense_col and player_id on each player's
DataFrame row. The retrosheet pipeline calculates ratings before posting,
so both fields were missing — causing silent card layout builder failures.
Adds a three-tier resolution: CSV cache → API bulk fetch → deterministic
hash fallback. Also includes player_id fallback in both calcs modules.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move each ratings model class (and, for batters, the helper functions it
depends on) into a dedicated models.py so that calcs_*.py can import from
card_builder.py at module level without circular imports.
- batters/models.py: BattingCardRatingsModel + bp_singles, wh_singles,
one_singles, bp_homeruns, triples, two_doubles, hit_by_pitch, strikeouts,
flyout_a, flyout_bq, flyout_b, groundball_a, groundball_c
- pitchers/models.py: PitchingCardRatingsModel (no helper deps needed)
- batters/calcs_batter.py: imports model + build_batter_full_cards at top
- pitchers/calcs_pitcher.py: imports model + build_pitcher_full_cards at top
- batters/card_builder.py: imports from batters.models
- pitchers/card_builder.py: imports from pitchers.models
- tests/test_batter_calcs.py: import bp_singles, wh_singles from batters.models
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- card_layout.py: Port PlayResult, PLAY_RESULTS, EXACT_CHANCES, get_chances(),
CardResult, CardColumn, FullCard, FullBattingCard, FullPitchingCard from
database/app/card_creation.py. card_output() uses col_* key names.
get_chances() always returns Decimal to avoid float/Decimal type errors.
- batters/card_builder.py: Port get_batter_card_data() algorithm as
build_batter_full_cards(ratings_vl, ratings_vr, offense_col, player_id, hand).
assign_bchances() returns float tuples for compatibility with float-based
BattingCardRatingsModel fields.
- pitchers/card_builder.py: Port get_pitcher_card_data() algorithm as
build_pitcher_full_cards(). assign_pchances() returns float tuples.
Includes card.add_fatigue() at end of each card iteration.
- batters/calcs_batter.py: Integrate card builder in get_batter_ratings().
After computing raw ratings, call build_batter_full_cards() and merge
9 col_* rendered column fields into each ratings dict. Lazy import to
avoid circular dependency.
- pitchers/calcs_pitcher.py: Same integration for get_pitcher_ratings().
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>