Skip to content

Domain Concepts

The kloppy.domain module defines entities that reflect real-world concepts within the domain of soccer match data. These entities serve as the framework upon which kloppy's logic is structured. The domain concepts are arranged hierarchically. At the highest level, kloppy defines the concept of a Dataset. Each dataset is linked with a Metadata entity, which holds all external information that describes the dataset.

Dataset

A Dataset describes specific aspects of what happened during a single match as a sequence of DataRecord entities. Kloppy defines three main types of match datasets: EventDataset, TrackingDataset, and CodeDataset.

DatasetEventDatasetTrackingDatasetCodeDatasetDataRecordEventFrameCodeMetadata +consists of1* +has*1

First, we describe the entities related to each of these three dataset types. Next, we discuss the structure of the metadata.

EventDataset

An EventDataset is a chronologically ordered sequence of Event entities. Each Event represents an on-the-ball action (e.g., pass, shot, tackle) or tactical change (e.g., substitution) and is annotated with a set of attributes that describe the event:

Depending on the EventType, an event can have additional attributes.

EventDatasetEvent+event_idstr+event_typeEventType+event_namestr+timeTime+teamTeam+playerPlayer+coordinatesPoint+resultResultType+raw_eventobj+statedict+related_event_ids[]str+qualifiers[]Qualifier+freeze_frameFrame+attacking_directionAttackingDirection+ball_owning_teamTeam+ball_stateBallState11

TrackingDataset

A TrackingDataset is a sequence of Frame entities. Each frame describes the locations of the ball and the players as a Point on the pitch at a particular Time.

TrackingDatasetFrame+frame_idstr+timeTime+ball_coordinatesPoint3D+players_dataPlayer -> PlayerData+ball_speedfloat+other_datadict+attacking_directionAttackingDirection+ball_owning_teamTeam+ball_stateBallState+has1*

CodeDataset

A CodeDataset is a sequence of Code entities, each representing a tagged event within a match.

CodeDatasetCode+code_idstr+codestr+timeTime+end_timestamptimedelta+labelsstr -> bool | str+attacking_directionAttackingDirection+ball_owning_teamTeam+ball_stateBallState+has1*

Metadata

A Metadata object contains all external information describing the match: two Team entities that describe the line-ups of both teams, the Period entities that describe the start and end times of each period of the match, the final Score, the Provider that collected the data, the Orientation (i.e., playing direction) of both teams, and the CoordinateSystem in which locations are defined.

MetadataDatasetTeamGroundFormationTypePlayerPositionPeriodOrientationCoordinateSystemOriginVerticalOrientationPitchDimensionsProviderScoreDatasetFlag+has11+has12+has12+has12+has1*+has1*+has12+has12+has12+has11+has11+has11+has12+has12+has12