PitchKit

metrica

Metrica Sports sample-data loader: two anonymised games of synchronised tracking and event data.

import { fetchEvents, fetchTrackingWindow, isGoal, shots } from "@pitchkit/data-providers/metrica";

const goal = shots(await fetchEvents(1)).find(isGoal)!;
const frames = await fetchTrackingWindow(1, {
  fromFrame: goal["Start Frame"],
  toFrame: goal["End Frame"],
});

The same four layers as the other providers: parse* (pure), load* / fetch* / stream* (network), narrowing selectors, and composable predicates. Three things to know before you plot anything:

  1. The grid is 0..1, origin top-left, y downward. Plot it with <Pitch type="metrica">. It is Wyscout's orientation at a hundredth of the scale, so neither type stands in for the other.
  2. Coordinates are absolute. Teams swap ends at half time, and which end each side starts at differs between the games. attackingDirection reads it off a kick-off frame.
  3. Events and tracking share a clock. An event's "Start Frame" is a tracking Frame, and its From is a tracked player's player. A game's tracking is two 32 MB files, one per team, so prefer streamTracking or fetchTrackingWindow over fetchTracking.

Field names are Metrica's own CSV headers, spaces and units included (event["Start Frame"]). What this package adds is lowercase.

Metrica ask that anything public made from the data acknowledges them.

See

https://github.com/metrica-sports/sample-data

Interfaces

Type Aliases

Variables

Functions

References

DataProviderError

Re-exports DataProviderError


DataProviderErrorKind

Re-exports DataProviderErrorKind


LoadOptions

Re-exports LoadOptions

On this page