PySport / kloppy

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

Add support for parsing events that occur during extra time #256

Closed DriesDeprest closed 3 months ago

DriesDeprest commented 7 months ago

I wanted to add support for parsing events that occur during extra time. I believe currently we don't do this for any serializer, as we only consider two possible Periods, and as a result events during extra time are skipped (see e.g. Opta).

Thoughts @koenvo @JanVanHaaren ?

JanVanHaaren commented 7 months ago

I like this proposal. I think we could even extend this proposal from extra time to penalty shoot-outs.

dvilches commented 7 months ago

Hi, in Wyscout v3 we had the same problem.

period_id = int(raw_event["matchPeriod"].replace("H", ""))

We changed it to:

if "H" in raw_event["matchPeriod"]: period_id = int(raw_event["matchPeriod"].replace("H", "")) else: period_id = int(raw_event["matchPeriod"].replace("E", "")) + 2

This solution may not be the most elegant but it works for us.