PySport / kloppy

kloppy: standardizing soccer tracking- and event data
https://kloppy.pysport.org
BSD 3-Clause "New" or "Revised" License
326 stars 55 forks source link

[Opta] add formation and lineup changes #333

Open DriesDeprest opened 3 days ago

DriesDeprest commented 3 days ago

Added recognition of player position changes in formation changes and introduced more detailed starting positions for players.

However, I'm still struggling on how to properly set the detailed starting positions for players. I want to use the qualifier information of the team setup events (ID 34) present in the F24 / MA3 files, since they contain more detailed information about the starting positions of the players in comparison with the starting positions present in the F7 / MA1 files.

In the draft implementation of my PR, I update the starting positions of the player based on the team setup events, but this results into a dataclasses.FrozenInstanceError: cannot assign to field 'starting_position'.

Should we refactor the code so that the creation of teams (and players) doesn't rely only on F7 / MA1 files, but also on F24 / MA3 files? Thoughts e.g. @probberechts ?

Also, the position labels I've chosen in theformation_mapping are based on my best effort estimations of what the correct description of a position in the zone shown in the StatsPerform documentation appendix. Below, an example of how the positional information is described in the appendix.

image