Example pattern

As an example, the below code defines a pattern that will look for all passes into the opponents box. Moreover to be imported into Metrica Play, it will add an arrow and a 2s pause in the video at the moment of the pass, and will add an arrow to the 2D field indicating start and end position of the pass.

class PassesIntoTheBox(Pattern):
    def __init__(
        game_dataset: GameDataset,
        name: str,
        code: str,
        in_time: int = 0,
        out_time: int = 0,
        parameters: dict = None,
            name, code, in_time, out_time, parameters, game_dataset

    def run(self) -> List[PatternEvent]:

        passes_into_the_box = (

        return [
            for i, event_row in passes_into_the_box.iterrows()

    def build_pattern_event(self, event_row) -> PatternEvent:
        pattern_event = self.from_event(event_row)

        return pattern_event

With this configuration:

    "include": true,
    "name": "Passes into the box",
    "code": "MET_003",
    "pattern_class": "PassesIntoTheBox",
    "parameters": null,
    "in_time": 2,
    "out_time": 2

Produces this output when imported into Metrica Play: