Last active
August 30, 2021 13:34
-
-
Save dlareau/bb848b2e35f5537fc1f2b4d12a81d24a to your computer and use it in GitHub Desktop.
Proposal of packets and how to calculate stats
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
// Items always in a standard feed event | |
- id | |
- playerTags | |
- teamTags | |
- gameTags | |
- metadata | |
- created | |
- day | |
- season | |
- phase | |
- tournament | |
- type | |
- category | |
- description | |
- nuts | |
// Items added from a game update to a feed event to make a packet | |
- gameId | |
- gamePhase | |
- homeTeam | |
- awayTeam | |
- homeBatter | |
- awayBatter | |
- homeBatterMod | |
- awayBatterMod | |
- homePitcher | |
- awayPitcher | |
- homePitcherMod | |
- awayPitcherMod | |
- homeOuts | |
- homeStrikes | |
- homeBalls | |
- homeBases | |
- awayOuts | |
- awayStrikes | |
- awayBalls | |
- awayBases | |
- stadiumId | |
- weather | |
- seriesLength | |
- seriesIndex | |
- isPostseason | |
- isTitleMatch | |
- inning | |
- topOfInning | |
- halfInningScore | |
- homeScore | |
- awayScore | |
- atBatBalls | |
- atBatStrikes | |
- halfInningOuts | |
- baserunnerCount | |
- basesOccupied | |
- baseRunners | |
- baseRunnerMods | |
- lastUpdate | |
- scoreLedger | |
- scoreUpdate | |
- awayTeamBatterCount | |
- homeTeamBatterCount | |
- shame | |
- outcomes | |
- secretBaserunner | |
- state // Starting mid season 17 | |
// Items added to a packet in post-processing: | |
- current batter (mix of homeBatter and awayBatter) | |
- current pitcher (mix of homePicher and awayPitcher) | |
- batCount (neither PA nor atBat, increments every time a new person is at the plate) | |
- lastInBatCount (true if this is the last packet in a certain batCount) | |
- runsScored (number of runs scored in this packet, just using scores) | |
- realRunsScored (number of runs scored in this packet, treated like normal baseball) | |
- runnersScored (list of playerIds that scored a run this packet) | |
- home responsible pitcher (set to the homePitcher currently "responsible" for this game) | |
- away responsible pitcher (set to the awayPitcher currently "responsible" for this game) | |
// Batting | |
first_appearance - day/season of first packet | |
appearances/games - find events with a batter, unique per gameId | |
plate_appearances - last batCount events that match a list | |
at_bats - last batCount events that match a smaller list | |
hits - Count of type 10 + type 9 | |
walks - count of type 5 + mind walks | |
singles - count of type 10 with description "hits a single" | |
doubles - count of type 10 with description "hits a double" | |
triples - count of type 10 with description "hits a triple" | |
quadruples - count of type 10 with description "hits a quadruple" | |
home_runs - count of type 9 | |
total_bases - weighted sum of singles, doubles, triples, quads, and 4/5 homes | |
strikeouts - count of type 6 | |
ground_outs - count of type 8 | |
flyouts - count of type 7 | |
hit_by_pitches - count of type 22 | |
sacrifice_bunts - text contains "sacrifice" | |
sacrifice_flies - text contains "tags up and scores" | |
batting_average - hits/at_bats | |
on_base_percentage - (hits+walks+hbp)/PA | |
slugging - total_bases/at_bats | |
runs_batted_in - resulting runs scored | |
at_bats_risp - at bats but with risp | |
hits_risp - hits but with risp | |
batting_average_risp - hits_risp/at_bats_risp | |
on_base_slugging - OBP + SLG | |
gidp - type 8 that contain "double play" | |
// Running | |
stolen_bases - count of type 4 without "caught" | |
caught_stealing - count of type 4 with "caught" | |
runs - count appearances in runnersScored | |
// Pitching | |
games - find events with a pitcher, unique per gameId | |
wins - | |
losses - | |
win_pct - wins/(wins+losses) | |
pitches_thrown - number of events that match a certain list | |
batters_faced - count of unique (game, batCount) sets with batter=Null items filtered out | |
outs_recorded - count of type 6, 7, or 8 events | |
innings - outs_recorded/3 with dumb decimal point math | |
runs_allowed - | |
shutouts - check realRunsScored == 0 and no pitcher swap per game | |
quality_starts - check runs_allowed < 4 and outs_recorded > 18 and no pitcher swap per game | |
strikeouts - count of type 6 events | |
walks - count of type 5 events | |
home_runs_allowed - count of type 9 events | |
hits_allowed - count of type 9 and 10 events | |
hit_by_pitches - count of type 22 events | |
earned_run_average - 9 * (runs_allowed)/innings | |
walks_per_9 - 9 * walks/innings | |
hits_per_9 - 9 * hits/innings | |
strikeouts_per_9 - 9 * strikeouts/innings | |
home_runs_per_9 - 9 * hrs/innings | |
whip - (walks + hits)/innings | |
strikeouts_per_walk - stikeouts/walks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment