Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor StatsBomb deserializer #262

Merged
merged 4 commits into from Dec 26, 2023

Conversation

probberechts
Copy link
Contributor

Started with a small bugfix, ... ended up with a complete rewrite 😬


  • refactor: Split up StatsBombDeserializer.deserialize method
  • refactor: Group code for deserializing events per StatsBomb event type
  • refactor: Reorganize constants for StatsBomb event types and outcomes in a hierarchical structure
  • refactor: Group tests per StatsBomb event type
  • test: Load data from open data repository to automatically catch data updates
  • test: Add unit tests for each deserialized event type
  • fix: An interception before a pas must always be successful. Previously, the result of the pass was used.
  • fix: Do not throw away bad behaviour events without a card, map them to a generic event
  • fix: Incorrect card ids. In the open data, the following IDs are used: 7/Yellow Card, 6/Second Yellow, 5/Red. This is incorrect in the documentation.
  • fix: Add BALL_STATE flag to metadata
  • fix: Add prefix to synthetic events to avoid duplicate event IDs
  • fix: The get_qualifier_values method returned qualifiers instead of qualifier values
  • fix: Interceptions do not have a body part.
  • fix: Duels do not have a body part.
  • fix: The set of synthetically-generated ball out events was very incomplete.
  • fix: StatsBomb has no Dribble.OUT outcome. The TakeOnResult.OUT result must be derived from the related duel.
  • fix: Freeze frame coordinates should be parsed with the shot fidelity version.

refactor: Split up StatsBombDeserializer.deserialize method
refactor: Group code for deserialing events per StatsBomb event type
refactor: Reorganize constants for event types and outcomes in a hierarchical structure
refactor: Group tests per StatsBomb event type
test: Load data from open data repository to automatically catch data updates
test: Add unit tests for each deserialized event type
fix: An interception before a pas must always be successful. Previously, the result of the pass was used.
fix: Do not throw away bad behaviour events without a card, map them to a generic event
fix: Incorrect card ids. In the open data, the following IDs are used: 7/Yellow Card, 6/Second Yellow, 5/Red. This is incorrect in the documentation.
fix: Add BALL_STATE flag to metadata
fix: Add prefix to synthetic events to avoid duplicate event ids
fix: The get_qualifier_values method returned qualfiers instead of qualifier values
fix: Interceptions do not have a body part.
fix: Duels do not have a bodypart.
fix: The set of synthetically-generated ball out events was very incomplete.
fix: StatsBomb has no Dribble.OUT outcome. The TakeOnResult.OUT result must be derived from the related duel.
fix: Freeze frame coordinates should be parsed with the shot fidelity version.
@JanVanHaaren JanVanHaaren self-requested a review December 19, 2023 12:30
@JanVanHaaren
Copy link
Collaborator

Thank you very much, @probberechts. I will review this pull request as soon as possible.

Copy link
Collaborator

@JanVanHaaren JanVanHaaren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your great effort on this pull request, @probberechts!

I left a few small questions and suggestions.

kloppy/infra/serializers/event/statsbomb/__init__.py Outdated Show resolved Hide resolved
kloppy/infra/serializers/event/statsbomb/helpers.py Outdated Show resolved Hide resolved
kloppy/infra/serializers/event/statsbomb/specification.py Outdated Show resolved Hide resolved
kloppy/infra/serializers/event/statsbomb/specification.py Outdated Show resolved Hide resolved
kloppy/infra/serializers/event/statsbomb/deserializer.py Outdated Show resolved Hide resolved
kloppy/infra/serializers/event/statsbomb/deserializer.py Outdated Show resolved Hide resolved
kloppy/infra/serializers/event/statsbomb/deserializer.py Outdated Show resolved Hide resolved
kloppy/tests/test_statsbomb.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@JanVanHaaren JanVanHaaren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff. Thanks!

@koenvo
Copy link
Contributor

koenvo commented Dec 26, 2023

Great work. I really like the approach with the intermediate SB format!

@koenvo koenvo merged commit 0de2285 into PySport:master Dec 26, 2023
19 checks passed
@koenvo koenvo added this to the 3.14 - Pi milestone Dec 29, 2023
@probberechts probberechts deleted the refactor/statsbomb branch January 1, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants