Open DriesDeprest opened 8 months ago
Ah yes, that would indeed be repetitive.
You could add the qualifier after parsing the events:
def deserialize(self, event_factory: EventFactory) -> List[Event]:
"""Deserialize the event.
"""
generic_event_kwargs = self._parse_generic_kwargs()
events = (
self._create_aerial_won_event(
event_factory, **generic_event_kwargs
)
+ self._create_events(event_factory, **generic_event_kwargs)
+ self._create_ball_out_event(
event_factory, **generic_event_kwargs
)
)
for event in events:
# add possession qualfiers
return events
I would like to recognize the "From Counter" play pattern in our StatsBomb deserializer and thus add
CounterAttackQualifier
s to events with this play pattern.I'm not sure what would be an elegant way to implement this.
I could create a function
_get_counter_attack_qualifiers(event_dict: Dict) -> List[CounterAttackQualifier]
which recognizes the "From Counter" play pattern. And then add this function in all the_create_events()
methods of the different event type classes. But it feels a bit repetitive to add it to almost all of these event classes - @probberechts thoughts?