Problem
/ charts Hits/Game by a team's hitters. Nothing charts the mirror image: hits surrendered by its pitchers. Now that team_game_pitching_lines exists (#41), hits_allowed is already stored, so this needs no migration and no new MLB request.
Two properties worth building on
1. The pitching figure agrees with the opposing batting row. Every hit by one team is a hit allowed by another. Verified across all 162 games of the 2025 Mariners: team_game_pitching_lines.hits_allowed equals the opponent's own team_game_batting_lines.hits for the same game_pk, with zero mismatches. Two independently fetched MLB stat groups agreeing exactly is worth asserting as a test rather than assuming.
2. The MLB average can come from the batting table. Because every hit is allowed by someone, league-wide total hits and total hits allowed are the same number, over the same count of team-game records. So:
MLB Hits Allowed/Game == MLB Hits/Game
For 2025 that is 40,138 hits over 4,860 team-game records = 8.2588.
This means the page can reuse LeagueHitsContext, built from team_game_batting_lines, and show an MLB reference line for any season with complete batting coverage. It does not need every club's pitching imported, which the ERA comparison on /pitching currently does.
Proposed page: /hits-allowed
Hits Allowed/Game with the same rolling and season-average treatment as the other count pages, plus the MLB reference line. H/9 belongs in the summary cards as the rate companion, calculated from outs the way the other pitching rates are.
Sign convention note: fewer hits allowed is better, the opposite of the Hits page it mirrors. The page should say so rather than leaving a reader to assume a positive difference is good.
Missing-data state
A team-season imported before pitching was collected has no pitching rows, so this page returns 409 asking for a team re-import, exactly as /pitching does.
Problem
/charts Hits/Game by a team's hitters. Nothing charts the mirror image: hits surrendered by its pitchers. Now thatteam_game_pitching_linesexists (#41),hits_allowedis already stored, so this needs no migration and no new MLB request.Two properties worth building on
1. The pitching figure agrees with the opposing batting row. Every hit by one team is a hit allowed by another. Verified across all 162 games of the 2025 Mariners:
team_game_pitching_lines.hits_allowedequals the opponent's ownteam_game_batting_lines.hitsfor the samegame_pk, with zero mismatches. Two independently fetched MLB stat groups agreeing exactly is worth asserting as a test rather than assuming.2. The MLB average can come from the batting table. Because every hit is allowed by someone, league-wide total hits and total hits allowed are the same number, over the same count of team-game records. So:
For 2025 that is 40,138 hits over 4,860 team-game records = 8.2588.
This means the page can reuse
LeagueHitsContext, built fromteam_game_batting_lines, and show an MLB reference line for any season with complete batting coverage. It does not need every club's pitching imported, which the ERA comparison on/pitchingcurrently does.Proposed page:
/hits-allowedHits Allowed/Game with the same rolling and season-average treatment as the other count pages, plus the MLB reference line. H/9 belongs in the summary cards as the rate companion, calculated from outs the way the other pitching rates are.
Sign convention note: fewer hits allowed is better, the opposite of the Hits page it mirrors. The page should say so rather than leaving a reader to assume a positive difference is good.
Missing-data state
A team-season imported before pitching was collected has no pitching rows, so this page returns 409 asking for a team re-import, exactly as
/pitchingdoes.