You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inserting pressing events derived from a tracking dataset.
To support these needs, I propose adding an insert method to the EventDataset interface.
Sometimes the correct position can be easily determined by parameters such as the index, the ID of the preceding or succeeding event. or an exact timestamp. However, when the exact position is unknown, the insert method should be able to determine the optimal insert location based on a set of constraints. For example, if the approximate time of a substitution is known, the event should be inserted within a window where the ball state is dead, closest to the given timestamp. Similarly, pressing events should be inserted into sequences where the opponent team is in possession.
Below is the API that Copilot suggests. I'm not sure whether this is exactly what we want, but I think it provides a good starting point.
classEventDataset:
definsert(
self,
event: Event,
position: Optional[int] =None,
before_event_id: Optional[str] =None,
after_event_id: Optional[str] =None,
timestamp: Optional[datetime] =None,
constraints: Optional[Callable[[Event, EventDataset], bool]] =None
) ->None:
""" Inserts an event into the dataset at the appropriate position. Parameters: ---------- event : Event The event to be inserted into the dataset. position : Optional[int], default=None The exact index where the event should be inserted. If provided, overrides all other positioning parameters. before_event_id : Optional[str], default=None The ID of the event before which the new event should be inserted. Ignored if `position` is provided. after_event_id : Optional[str], default=None The ID of the event after which the new event should be inserted. Ignored if `position` or `before_event_id` is provided. timestamp : Optional[datetime], default=None The timestamp of the event, used to determine its position based on chronological order if no other positional parameters are specified. constraints : Optional[Callable[[Event, EventDataset], bool]], default=None A custom function that takes the event and dataset as arguments and evaluates whether the event satisfies specific conditions to determine its position. Useful for more complex insertion logic, such as inserting into a valid contextual window (e.g., dead ball states or possession sequences). Returns: ------- None The method modifies the dataset in place. Raises: ------ ValueError If the insertion position cannot be determined or is invalid. Notes: ------ - If multiple parameters are provided to specify the position, the precedence is: 1. `position` 2. `before_event_id` 3. `after_event_id` 4. `timestamp` 5. `constraints` - If none of the above parameters are specified, the method raises a `ValueError`. """
The text was updated successfully, but these errors were encountered:
A recurring requirement seems to be having the ability to insert events into an existing
EventDataset
. Some use cases are:To support these needs, I propose adding an
insert
method to the EventDataset interface.Sometimes the correct position can be easily determined by parameters such as the index, the ID of the preceding or succeeding event. or an exact timestamp. However, when the exact position is unknown, the
insert
method should be able to determine the optimal insert location based on a set of constraints. For example, if the approximate time of a substitution is known, the event should be inserted within a window where the ball state is dead, closest to the given timestamp. Similarly, pressing events should be inserted into sequences where the opponent team is in possession.Below is the API that Copilot suggests. I'm not sure whether this is exactly what we want, but I think it provides a good starting point.
The text was updated successfully, but these errors were encountered: