From c3dcefbdcca829964c1bb3f0c9a42317049c0309 Mon Sep 17 00:00:00 2001 From: Joseph Armstrong <70788681+armstjc@users.noreply.github.com> Date: Mon, 1 Apr 2024 14:16:34 -0400 Subject: [PATCH] hotfix on `parse_statsbomb_data.py` Hotfix on an edge case where the GSIS Player ID is not available for this player for some reason. --- .github/workflows/update_statsbomb_data_csv.yml | 2 +- .github/workflows/update_statsbomb_data_parquet.yml | 2 +- check_data_advalibility.py | 6 +++--- parse_statsbomb_data.py | 7 +++++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/update_statsbomb_data_csv.yml b/.github/workflows/update_statsbomb_data_csv.yml index c74b028..dbb028d 100644 --- a/.github/workflows/update_statsbomb_data_csv.yml +++ b/.github/workflows/update_statsbomb_data_csv.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10"] + python-version: ["3.12"] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/update_statsbomb_data_parquet.yml b/.github/workflows/update_statsbomb_data_parquet.yml index e89f886..cc468c8 100644 --- a/.github/workflows/update_statsbomb_data_parquet.yml +++ b/.github/workflows/update_statsbomb_data_parquet.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10"] + python-version: ["3.12"] steps: - uses: actions/checkout@v3 diff --git a/check_data_advalibility.py b/check_data_advalibility.py index 55ffe4e..8442ac0 100644 --- a/check_data_advalibility.py +++ b/check_data_advalibility.py @@ -18,7 +18,7 @@ ) -def check_data_advalibility( +def check_data_availability( check_csv: bool = False, check_parquet: bool = False, check_all_seasons: bool = True @@ -123,12 +123,12 @@ def check_data_advalibility( "files, or the `.parquet` files." ) elif csv_flag is True: - check_data_advalibility( + check_data_availability( check_csv=True, check_all_seasons=check_all_seasons ) elif parquet_flag is True: - check_data_advalibility( + check_data_availability( check_parquet=True, check_all_seasons=check_all_seasons ) diff --git a/parse_statsbomb_data.py b/parse_statsbomb_data.py index 74898f4..c28f404 100644 --- a/parse_statsbomb_data.py +++ b/parse_statsbomb_data.py @@ -226,7 +226,10 @@ def parse_statsbomb_amf_tracking_data(json_data: dict): position_code = player["player"]["position_code"] player_name = player["player"]["name"] player_jersey_number = player["player"]["jersey_number"] - gsis_player_id = player["player"]["gsis_player_id"] + try: + gsis_player_id = player["player"]["gsis_player_id"] + except: + gsis_player_id = None on_camera_ratio = player["on_camera_ratio"] row_df = pd.DataFrame(player["steps"]) @@ -410,7 +413,7 @@ def get_statsbomb_tracking_data(season: int): if __name__ == "__main__": print("starting up") - for i in range(2018, 2024): + for i in range(2016, 2017): get_statsbomb_tracking_data(i) # get_statsbomb_tracking_data(2019)