Example #1
0
 def as_dict(self):
     """Convert boxscore to a dictionary."""
     return {
         "__bbref_boxscore__": True,
         "boxscore_url": self.boxscore_url,
         "bbref_game_id": self.bbref_game_id,
         "game_meta_info": self.game_meta_info.as_dict(),
         "away_team_data": self.away_team_data.as_dict(),
         "home_team_data": self.home_team_data.as_dict(),
         "innings_list": as_dict_list(self.innings_list),
         "player_id_match_log": self.player_id_match_log,
         "umpires": as_dict_list(self.umpires),
         "player_team_dict": self.player_team_dict,
         "player_name_dict": self.player_name_dict,
     }
Example #2
0
 def as_dict(self):
     """Convert batting statistics for one player in a single game to a dictionary."""
     return {
         "player_id_br": self.player_id_br,
         "player_team_id_br": self.player_team_id_br,
         "opponent_team_id_br": self.opponent_team_id_br,
         "plate_appearances": int(self.plate_appearances),
         "at_bats": int(self.at_bats),
         "hits": int(self.hits),
         "runs_scored": int(self.runs_scored),
         "rbis": int(self.rbis),
         "bases_on_balls": int(self.bases_on_balls),
         "strikeouts": int(self.strikeouts),
         "avg_to_date": float(self.avg_to_date),
         "obp_to_date": float(self.obp_to_date),
         "slg_to_date": float(self.slg_to_date),
         "ops_to_date": float(self.ops_to_date),
         "total_pitches": int(self.total_pitches),
         "total_strikes": int(self.total_strikes),
         "wpa_bat": float(self.wpa_bat),
         "avg_lvg_index": float(self.avg_lvg_index),
         "wpa_bat_pos": float(self.wpa_bat_pos),
         "wpa_bat_neg": float(self.wpa_bat_neg),
         "re24_bat": float(self.re24_bat),
         "details": as_dict_list(self.details),
     }
Example #3
0
 def as_dict(self):
     """Convert daily boxscore URL values to a dictionary."""
     return {
         "__brooks_games_for_date__": True,
         "dashboard_url": self.dashboard_url,
         "game_date_str": self.game_date_str,
         "game_count": int(self.game_count),
         "games": as_dict_list(self.games),
     }
Example #4
0
 def as_dict(self):
     """Convert bbref games for date to a dictionary."""
     return {
         "__bbref_games_for_date__": True,
         "dashboard_url": self.dashboard_url,
         "game_date_str": self.game_date_str,
         "game_count": int(self.game_count),
         "games": as_dict_list(self.games),
     }
Example #5
0
 def as_dict(self):
     """Convert pitch logs for game to a dictionary."""
     return {
         "__brooks_pitch_logs_for_game__": True,
         "bb_game_id": self.bb_game_id,
         "bbref_game_id": self.bbref_game_id,
         "pitch_log_count": int(self.pitch_log_count),
         "pitch_logs": as_dict_list(self.pitch_logs),
     }
Example #6
0
 def as_dict(self):
     """Convert half-inning to a dictionary."""
     return {
         "__bbref_boxscore_half_inning__": True,
         "inning_id": self.inning_id,
         "inning_label": self.inning_label,
         "begin_inning_summary": self.begin_inning_summary,
         "end_inning_summary": self.end_inning_summary,
         "inning_total_runs": int(self.inning_total_runs),
         "inning_total_hits": int(self.inning_total_hits),
         "inning_total_errors": int(self.inning_total_errors),
         "inning_total_left_on_base": int(self.inning_total_left_on_base),
         "away_team_runs_after_inning":
         int(self.away_team_runs_after_inning),
         "home_team_runs_after_inning":
         int(self.home_team_runs_after_inning),
         "game_events": as_dict_list(self.game_events),
         "substitutions": as_dict_list(self.substitutions),
         "misc_events": as_dict_list(self.misc_events),
     }
Example #7
0
 def as_dict(self):
     return {
         "__bbref_boxscore_team_data__": True,
         "team_id_br": self.team_id_br,
         "total_wins_before_game": self.total_wins_before_game,
         "total_losses_before_game": self.total_losses_before_game,
         "total_runs_scored_by_team": self.total_runs_scored_by_team,
         "total_runs_scored_by_opponent":
         self.total_runs_scored_by_opponent,
         "total_hits_by_team": self.total_hits_by_team,
         "total_hits_by_opponent": self.total_hits_by_opponent,
         "total_errors_by_team": self.total_errors_by_team,
         "total_errors_by_opponent": self.total_errors_by_opponent,
         "team_won": self.team_won,
         "pitcher_of_record": self.pitcher_of_record,
         "pitcher_earned_save": self.pitcher_earned_save,
         "starting_lineup": as_dict_list(self.starting_lineup),
         "batting_stats": as_dict_list(self.batting_stats),
         "pitching_stats": as_dict_list(self.pitching_stats),
     }
Example #8
0
 def as_dict(self):
     return {
         "__brooks_pitchfx_log__": True,
         "pitchfx_log": as_dict_list(self.pitchfx_log),
         "pitch_count_by_inning": self.pitch_count_by_inning,
         "pitcher_name": self.pitcher_name,
         "pitcher_id_mlb": int(self.pitcher_id_mlb),
         "pitch_app_id": self.pitch_app_id,
         "total_pitch_count": int(self.total_pitch_count),
         "pitcher_team_id_bb": self.pitcher_team_id_bb,
         "opponent_team_id_bb": self.opponent_team_id_bb,
         "bb_game_id": self.bb_game_id,
         "bbref_game_id": self.bbref_game_id,
         "game_date_year": int(self.game_date_year),
         "game_date_month": int(self.game_date_month),
         "game_date_day": int(self.game_date_day),
         "game_time_hour": int(self.game_time_hour),
         "game_time_minute": int(self.game_time_minute),
         "time_zone_name": self.time_zone_name,
         "pitchfx_url": self.pitchfx_url,
     }
Example #9
0
 def as_dict(self):
     return {
         self.patch_list_id: True,
         "url_id": self.url_id,
         "patch_list": as_dict_list(self.patch_list),
     }