API Reference@pitchkit/data-providers
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:
- 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. - Coordinates are absolute. Teams swap ends at half time, and which
end each side starts at differs between the games.
attackingDirectionreads it off a kick-off frame. - Events and tracking share a clock. An event's
"Start Frame"is a trackingFrame, and itsFromis a tracked player'splayer. A game's tracking is two 32 MB files, one per team, so preferstreamTrackingorfetchTrackingWindowoverfetchTracking.
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
- MetricaEvent
- MetricaFrame
- MetricaLoadOptions
- MetricaPoint
- MetricaTrackedPlayer
- MetricaTrackingUrls
- TrackingWindowOptions
Type Aliases
Variables
Functions
- attackingDirection
- byPlayer
- byTeam
- challenges
- eventsUrl
- fetchEvents
- fetchTracking
- fetchTrackingWindow
- findPlayer
- hasEndLocation
- hasLocation
- hasSubtype
- inPeriod
- isBlocked
- isClearance
- isCornerKick
- isCross
- isFault
- isFreeKick
- isGoal
- isGoalKick
- isHeader
- isKickOff
- isOnTarget
- isOwnGoal
- isPenalty
- isRedCard
- isSaved
- isThroughBall
- isThrowIn
- isWoodwork
- isYellowCard
- loadEvents
- loadTracking
- loadTrackingWindow
- lostChallenge
- ofType
- parseEvents
- parseTracking
- passes
- playersOfTeam
- setPieces
- shots
- streamTracking
- streamTrackingFrom
- subtypesOf
- trackingUrls
- wonChallenge
References
DataProviderError
Re-exports DataProviderError
DataProviderErrorKind
Re-exports DataProviderErrorKind
LoadOptions
Re-exports LoadOptions