football-docs 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -9
- package/data/docs.db +0 -0
- package/dist/provider-truth.d.ts +122 -0
- package/dist/provider-truth.js +290 -0
- package/docs/besoccer/api-access.md +84 -0
- package/docs/besoccer/api-endpoints.md +131 -0
- package/docs/databallpy/data-model.md +6 -6
- package/docs/databallpy/overview.md +1 -1
- package/docs/fmdb-pro/api-access.md +2 -2
- package/docs/fotmob/identity-surfaces.md +1 -1
- package/docs/free-sources/fbref.md +17 -5
- package/docs/free-sources/overview.md +13 -4
- package/docs/kloppy/data-model.md +68 -43
- package/docs/kloppy/provider-mapping.md +30 -51
- package/docs/kloppy/usage.md +61 -49
- package/docs/mplsoccer/overview.md +1 -1
- package/docs/mplsoccer/pitch-types.md +3 -3
- package/docs/opta/api-access.md +6 -1
- package/docs/socceraction/spadl.md +16 -11
- package/docs/socceraction/vaep-xt.md +23 -6
- package/docs/soccerdata/data-sources.md +7 -42
- package/docs/soccerdata/overview.md +7 -6
- package/docs/soccerdata/usage.md +1 -1
- package/docs/sportmonks/api-access.md +18 -6
- package/docs/statsbomb/event-types.md +50 -32
- package/docs/thesportsdb/api-endpoints.md +8 -3
- package/docs/transferroom/api-endpoints.md +16 -5
- package/docs/wyscout/glossary-events.md +2 -2
- package/docs/wyscout/identity-surfaces.md +18 -14
- package/package.json +5 -2
- package/providers.json +23 -8
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
source_url: https://documenter.getpostman.com/view/6414020/2s93JwM1t4
|
|
3
|
+
source_type: curated
|
|
4
|
+
upstream_version: Postman collection "Apiclient"
|
|
5
|
+
crawled_at: 2026-07-31
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# BeSoccer API Endpoints
|
|
9
|
+
|
|
10
|
+
BeSoccer exposes a **single endpoint**. Every call goes to the same URL and the
|
|
11
|
+
`req` query parameter selects the resource — there are no REST paths.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
GET https://apiclient.besoccerapps.com/scripts/api/api.php?key={key}&req={resource}&format=json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Getting `req` wrong is the main failure mode, so the full vocabulary is listed
|
|
18
|
+
below. These 57 values are the complete set published in BeSoccer's Postman
|
|
19
|
+
collection; anything not listed here should be treated as not existing until you
|
|
20
|
+
have checked the collection yourself.
|
|
21
|
+
|
|
22
|
+
## Common parameters
|
|
23
|
+
|
|
24
|
+
| Parameter | Notes |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `key` | **Required.** Unique key that allows users to connect to the API |
|
|
27
|
+
| `req` | **Required.** Name of the request to be consulted — see the tables below |
|
|
28
|
+
| `format` | Response format: `json`, `xml`, `text`, `js` |
|
|
29
|
+
| `tz` | Time zone, e.g. `Europe/Madrid` |
|
|
30
|
+
| `lang` | Output language, where the request supports it |
|
|
31
|
+
|
|
32
|
+
Pagination, where supported, uses `page`; some requests instead take an index and
|
|
33
|
+
count. Season is selected with `year`.
|
|
34
|
+
|
|
35
|
+
> **Coverage window.** BeSoccer states you can consult **the current season plus
|
|
36
|
+
> the two previous years**. Older seasons are outside the API's range.
|
|
37
|
+
|
|
38
|
+
## Access levels
|
|
39
|
+
|
|
40
|
+
Requests are grouped into three levels, which correspond to access tiers. A key
|
|
41
|
+
that is not entitled to a level cannot call the requests in it.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Level 1 (15 requests)
|
|
45
|
+
|
|
46
|
+
| `req` value | Purpose | Additional parameters |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `categories` | Competitions | `filter` |
|
|
49
|
+
| `competition` | Complete competition detail | `id`, `year` |
|
|
50
|
+
| `competition_info` | Detail of competition phases | `competitions`, `year` |
|
|
51
|
+
| `competition_playoffs` | Table of matches | `id`, `lang`, `year` |
|
|
52
|
+
| `competitions` | Top competitions | — |
|
|
53
|
+
| `countries_competitions` | Competitions by continent | `filter`, `lang` |
|
|
54
|
+
| `data_competitions` | Competition detail | `competitions` |
|
|
55
|
+
| `league_status` | Competition status | `id`, `year` |
|
|
56
|
+
| `live_matches` | Live matches | — |
|
|
57
|
+
| `matchs` | Matches per day | `league` |
|
|
58
|
+
| `matchsday` | Matches of the day | — |
|
|
59
|
+
| `seasons` | Seasons | `id` |
|
|
60
|
+
| `tables` | Classification | `league` |
|
|
61
|
+
| `teams` | Teams | `league` |
|
|
62
|
+
| `verify_datetime` | Modified timetables | `competitions` |
|
|
63
|
+
|
|
64
|
+
## Level 2 (24 requests)
|
|
65
|
+
|
|
66
|
+
| `req` value | Purpose | Additional parameters |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `agenda` | Calendar | `page` |
|
|
69
|
+
| `competition_referees` | Competition referees | `id` |
|
|
70
|
+
| `competition_summary` | Competition summary | `id`, `year` |
|
|
71
|
+
| `crosses` | Crosses | `id`, `lang`, `year` |
|
|
72
|
+
| `get_players_club` | Obtain player equipment | `players` |
|
|
73
|
+
| `get_teams` | Get equipment | — |
|
|
74
|
+
| `league_stats` | Statistics competition | `league` |
|
|
75
|
+
| `live` | Live match | `id`, `lang`, `year` |
|
|
76
|
+
| `live_results_today` | Consult matches of the day | `competitions` |
|
|
77
|
+
| `match` | Match detail | `id`, `lang`, `year` |
|
|
78
|
+
| `match_lineups` | Match lineups | `match`, `year` |
|
|
79
|
+
| `matches_team` | Matches by team | `id` |
|
|
80
|
+
| `matchs_month` | Matches of the month | `category`, `extra`, `year` |
|
|
81
|
+
| `matchsday_watch` | Matches of the day | — |
|
|
82
|
+
| `player_transfers_history` | Player transfers complete | `id`, `lang` |
|
|
83
|
+
| `quiniela` | Quiniela | — |
|
|
84
|
+
| `quinigol` | Quinigol | — |
|
|
85
|
+
| `team` | Team detail | `id`, `year` |
|
|
86
|
+
| `team_competitions` | Team Core Competition | `id` |
|
|
87
|
+
| `team_info` | Equipment information | `id` |
|
|
88
|
+
| `team_players` | Squad competition | `team`, `year` |
|
|
89
|
+
| `team_squad` | Team squad | `category`, `team`, `year` |
|
|
90
|
+
| `transfer_market` | Transfers | `league` |
|
|
91
|
+
| `tv_channel_matches` | TV and matches | `date` |
|
|
92
|
+
|
|
93
|
+
## Level 3 (18 requests)
|
|
94
|
+
|
|
95
|
+
| `req` value | Purpose | Additional parameters |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `all_stats_team` | Team statistics in match | `id`, `year` |
|
|
98
|
+
| `historical_players_team` | Team player history | `id` |
|
|
99
|
+
| `match_history` | Historic match detail | `id`, `year` |
|
|
100
|
+
| `player` | Player detail | `id`, `lang`, `year` |
|
|
101
|
+
| `player_detail_info` | Detailed player information | `id`, `lang` |
|
|
102
|
+
| `player_injuries` | Player injury information | `id`, `lang` |
|
|
103
|
+
| `player_matches` | Player games in season | `id`, `year` |
|
|
104
|
+
| `player_matches_st` | Detail of player matches | `category`, `id`, `year` |
|
|
105
|
+
| `player_palmares_st` | Player's achievements extended | `id` |
|
|
106
|
+
| `player_seasons` | Player seasons | `id` |
|
|
107
|
+
| `player_teams_seasons` | Player team information | `id` |
|
|
108
|
+
| `player_trajectory` | Player's trajectory | `id` |
|
|
109
|
+
| `players_compare` | Players compare | `competition`, `p1`, `p2`, `year` |
|
|
110
|
+
| `players_status` | Player status | `id`, `lang`, `year` |
|
|
111
|
+
| `team_complete_stats` | Team statistics in seasons | `id` |
|
|
112
|
+
| `team_players_stats` | Advanced equipment statistics | `category`, `team`, `year` |
|
|
113
|
+
| `teams_history` | Team history | `id`, `teams`, `year` |
|
|
114
|
+
| `transfer_leagues` | Transfers by competition | `id`, `isocode`, `team`, `year` |
|
|
115
|
+
|
|
116
|
+
## Notes on the vocabulary
|
|
117
|
+
|
|
118
|
+
A few `req` values are easy to confuse:
|
|
119
|
+
|
|
120
|
+
- `matchs` (matches per day for a league), `matchsday` (matches of the day) and
|
|
121
|
+
`matchs_month` (matches of the month) are three different requests. Note the
|
|
122
|
+
missing "e" in `matchs` — it is not `matches`.
|
|
123
|
+
- `competitions` returns top competitions with no parameters, while
|
|
124
|
+
`data_competitions` takes a comma-separated `competitions` list and
|
|
125
|
+
`countries_competitions` filters by continent.
|
|
126
|
+
- `team` and `team_info` are distinct, as are `player` and `player_detail_info`.
|
|
127
|
+
- `live` returns a single live match by `id`; `live_matches` returns all of them.
|
|
128
|
+
|
|
129
|
+
Spanish and English variants of the collection document the same request
|
|
130
|
+
vocabulary; only the descriptions differ.
|
|
131
|
+
|
|
@@ -12,12 +12,12 @@ The `Game` dataclass is the central object, holding tracking data, event data, a
|
|
|
12
12
|
| `event_data` | `EventData` | Custom pandas DataFrame subclass |
|
|
13
13
|
| `pitch_dimensions` | `list[float]` | [length, width] in metres (typically [106.0, 68.0]) |
|
|
14
14
|
| `periods` | `pd.DataFrame` | Start/end frames and datetimes for periods 1-5 |
|
|
15
|
-
| `home_team_id` | `int` | |
|
|
15
|
+
| `home_team_id` | `int \| str` | |
|
|
16
16
|
| `home_team_name` | `str` | |
|
|
17
17
|
| `home_players` | `pd.DataFrame` | Player info (see PlayersSchema) |
|
|
18
18
|
| `home_score` | `int` | |
|
|
19
19
|
| `home_formation` | `str` | |
|
|
20
|
-
| `away_team_id` | `int` | |
|
|
20
|
+
| `away_team_id` | `int \| str` | |
|
|
21
21
|
| `away_team_name` | `str` | |
|
|
22
22
|
| `away_players` | `pd.DataFrame` | |
|
|
23
23
|
| `away_score` | `int` | |
|
|
@@ -66,10 +66,10 @@ Custom `pd.DataFrame` subclass with extra attribute: `provider: str`.
|
|
|
66
66
|
| `databallpy_event` | str (nullable) | One of: `"pass"`, `"shot"`, `"dribble"`, `"tackle"`, `"own_goal"` |
|
|
67
67
|
| `period_id` | int | Period number |
|
|
68
68
|
| `minutes` | int | Minute of event |
|
|
69
|
-
| `seconds` |
|
|
70
|
-
| `player_id` |
|
|
69
|
+
| `seconds` | float | Second within minute |
|
|
70
|
+
| `player_id` | object | Player identifier (coerced; not int-only, some providers use non-integer IDs) |
|
|
71
71
|
| `player_name` | str | |
|
|
72
|
-
| `team_id` |
|
|
72
|
+
| `team_id` | object | Coerced; not int-only, some providers use non-integer IDs |
|
|
73
73
|
| `is_successful` | bool | |
|
|
74
74
|
| `start_x` | float | Range: -60 to 60 |
|
|
75
75
|
| `start_y` | float | Range: -45 to 45 |
|
|
@@ -85,7 +85,7 @@ Custom `pd.DataFrame` subclass with extra attribute: `provider: str`.
|
|
|
85
85
|
|
|
86
86
|
| Column | Type | Constraints |
|
|
87
87
|
|---|---|---|
|
|
88
|
-
| `id` |
|
|
88
|
+
| `id` | object | Unique, coerced; not int-only, some providers use non-integer IDs |
|
|
89
89
|
| `full_name` | str | Unique |
|
|
90
90
|
| `shirt_num` | int | Unique, 0-100 |
|
|
91
91
|
| `position` | str | goalkeeper / defender / midfielder / forward / unspecified |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
DataBallPy is a Python package for loading, synchronizing, and analyzing soccer event and tracking data. Developed by Alexander Oonk and Daan Grob, licensed under MIT. Current version: 0.7.
|
|
5
|
+
DataBallPy is a Python package for loading, synchronizing, and analyzing soccer event and tracking data. Developed by Alexander Oonk and Daan Grob, licensed under MIT. Current version: 0.7.3.
|
|
6
6
|
|
|
7
7
|
Its key distinguishing feature is **smart synchronization of tracking and event data** using the Needleman-Wunsch algorithm (borrowed from bioinformatics sequence alignment), which preserves event ordering during alignment. Naive cost-function approaches do not guarantee this.
|
|
8
8
|
|
|
@@ -94,8 +94,8 @@ Sorting cannot be used with continuation pagination.
|
|
|
94
94
|
Use `includeFields` or `excludeFields` to shape first-level response fields:
|
|
95
95
|
|
|
96
96
|
```http
|
|
97
|
-
GET /api/players?includeFields=id,name,dateOfBirth,fmId,
|
|
98
|
-
GET /api/clubs?excludeFields=
|
|
97
|
+
GET /api/players?includeFields=id,name,dateOfBirth,fmId,currentAbility
|
|
98
|
+
GET /api/clubs?excludeFields=stadium,trainingGround,trainingFacilities
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
Field shaping applies only to first-level fields, not nested objects.
|
|
@@ -15,7 +15,7 @@ consumer-facing endpoints.
|
|
|
15
15
|
| Entity | Common surface |
|
|
16
16
|
|---|---|
|
|
17
17
|
| Competition | league or tournament ID |
|
|
18
|
-
| Season |
|
|
18
|
+
| Season | expressed as a parameter value on competition and team surfaces; no standalone season entity observed |
|
|
19
19
|
| Match | match ID |
|
|
20
20
|
| Team | team ID |
|
|
21
21
|
| Player | player ID |
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# FBref
|
|
2
2
|
|
|
3
|
-
Football Reference (fbref.com).
|
|
3
|
+
Football Reference (fbref.com). A comprehensive free source for historical results,
|
|
4
|
+
basic statistics and squad information across 100+ competitions.
|
|
5
|
+
|
|
6
|
+
> **Advanced statistics were removed on 20 January 2026.** Stats Perform (which owns
|
|
7
|
+
> Opta, FBref's provider since 2022) terminated FBref's access to its feeds, and
|
|
8
|
+
> Sports Reference removed the Opta-sourced data with immediate effect. Everything
|
|
9
|
+
> beyond basic goals, assists and appearances went with it — xG, xAG, progressive
|
|
10
|
+
> passes and carries, shot- and goal-creating actions, defensive actions, possession
|
|
11
|
+
> and the advanced goalkeeping tables. No replacement provider has been announced.
|
|
12
|
+
>
|
|
13
|
+
> Anything written before that date describing FBref as a free xG source is stale.
|
|
14
|
+
> For xG, use Understat or StatsBomb open data instead.
|
|
4
15
|
|
|
5
16
|
## What's available
|
|
6
17
|
|
|
@@ -8,8 +19,8 @@ Football Reference (fbref.com). The most comprehensive free source for season-le
|
|
|
8
19
|
|
|
9
20
|
| Category | Examples |
|
|
10
21
|
|----------|---------|
|
|
11
|
-
| Standard | Goals, assists,
|
|
12
|
-
| Shooting |
|
|
22
|
+
| Standard | Goals, assists, appearances, minutes |
|
|
23
|
+
| Shooting | Goals, penalties (basic shooting only since January 2026) |
|
|
13
24
|
| Passing | Total/short/medium/long, key passes, final third passes, progressive passes |
|
|
14
25
|
| Pass types | Live ball, dead ball, free kicks, through balls, switches, crosses |
|
|
15
26
|
| Goal and shot creation | SCA, GCA, types (live, dead, take-on, shot, foul, defensive) |
|
|
@@ -38,11 +49,12 @@ player_stats <- fb_big5_advanced_season_stats(season_end_year=2024, stat_type="s
|
|
|
38
49
|
|
|
39
50
|
## Coverage
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
100+ competitions. Basic stats and results go back to the 1990s for many leagues. Advanced metrics existed from 2017/18 until January 2026 and are no longer served.
|
|
42
53
|
|
|
43
54
|
## Caveats
|
|
44
55
|
|
|
45
|
-
-
|
|
56
|
+
- FBref has never computed its own advanced metrics; they came from its data provider,
|
|
57
|
+
and are unavailable since that agreement ended in January 2026.
|
|
46
58
|
- No event-level data (pass-by-pass). Only aggregates.
|
|
47
59
|
- Rate limit: max ~10 requests per minute. Use `time.sleep(6)` between requests.
|
|
48
60
|
- Cache results locally. Aggressive scraping will get you blocked.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
| Source | Data Type | Access Method | Coverage | Rate Limits |
|
|
6
6
|
|---|---|---|---|---|
|
|
7
7
|
| StatsBomb Open Data | Event-level (full) | GitHub download / API | Select matches (World Cups, specific leagues/seasons) | None |
|
|
8
|
-
| FBref |
|
|
8
|
+
| FBref | Results, basic stats (no advanced metrics since Jan 2026) | Web scrape / soccerdata | 100+ competitions | Strict (3s between requests) |
|
|
9
9
|
| Understat | xG, shot-level | Web scrape / soccerdata | Top 5 European leagues | Moderate |
|
|
10
10
|
| ClubElo | Historical Elo ratings | HTTP API | All top European leagues, 1946-present | Generous |
|
|
11
11
|
| football-data.co.uk | Match results + odds | CSV download | 25+ leagues, 20+ seasons | None |
|
|
@@ -46,11 +46,20 @@ dataset = statsbomb.load_open_data(match_id=3788741)
|
|
|
46
46
|
|
|
47
47
|
## FBref
|
|
48
48
|
|
|
49
|
-
**What it provides**:
|
|
49
|
+
**What it provides**: Historical results, basic player and team statistics, and squad
|
|
50
|
+
information across 100+ competitions.
|
|
50
51
|
|
|
51
|
-
**
|
|
52
|
+
**Advanced statistics ended on 20 January 2026**, when Stats Perform terminated
|
|
53
|
+
FBref's access to the Opta feeds that supplied them. No replacement has been
|
|
54
|
+
announced. Treat any guidance that presents FBref as a free source of xG or
|
|
55
|
+
possession-adjusted metrics as out of date.
|
|
52
56
|
|
|
53
|
-
**
|
|
57
|
+
**Stat categories still available**: goals, assists, appearances, minutes, cards and
|
|
58
|
+
match results. The advanced tables (passing detail, pass types, GCA/SCA, defensive
|
|
59
|
+
actions, possession, advanced goalkeeping) are no longer served.
|
|
60
|
+
|
|
61
|
+
**Coverage**: 100+ competitions. Basic stats and results run back to the 1990s for
|
|
62
|
+
many leagues. Advanced metrics covered 2017/18 to January 2026 only.
|
|
54
63
|
|
|
55
64
|
**Access**: Web scraping or `soccerdata` Python library. See `fbref.md` for details.
|
|
56
65
|
|
|
@@ -8,7 +8,7 @@ Repository: https://github.com/kloppy-project/kloppy
|
|
|
8
8
|
|
|
9
9
|
## Canonical Event Types
|
|
10
10
|
|
|
11
|
-
kloppy defines **
|
|
11
|
+
kloppy defines **19 canonical event types** that all provider events map to:
|
|
12
12
|
|
|
13
13
|
| Event Type | Class | Description |
|
|
14
14
|
|---|---|---|
|
|
@@ -25,6 +25,12 @@ kloppy defines **13 canonical event types** that all provider events map to:
|
|
|
25
25
|
| `GOALKEEPER` | `GoalkeeperEvent` | Goalkeeper-specific action (save, punch, claim, etc.) |
|
|
26
26
|
| `FORMATION_CHANGE` | `FormationChangeEvent` | Tactical formation change |
|
|
27
27
|
| `GENERIC` | `GenericEvent` | Catch-all for provider events that don't map to a canonical type |
|
|
28
|
+
| `SUBSTITUTION` | `SubstitutionEvent` | A player is substituted off and replaced by another player |
|
|
29
|
+
| `CARD` | `CardEvent` | A player receives a card |
|
|
30
|
+
| `PLAYER_ON` | `PlayerOnEvent` | A player returns to the pitch after a `PLAYER_OFF` event |
|
|
31
|
+
| `PLAYER_OFF` | `PlayerOffEvent` | A player goes/is carried off the pitch without a substitution |
|
|
32
|
+
| `RECOVERY` | `RecoveryEvent` | A player gathers a loose ball and gains possession for their team |
|
|
33
|
+
| `PRESSURE` | `PressureEvent` | A player pressures an opponent to force a mistake |
|
|
28
34
|
|
|
29
35
|
### Result Enums
|
|
30
36
|
|
|
@@ -48,6 +54,7 @@ Each event has a `result` property with type-specific enum values:
|
|
|
48
54
|
| `OFF_TARGET` | Shot off target (wide or over) |
|
|
49
55
|
| `BLOCKED` | Shot blocked by defender |
|
|
50
56
|
| `POST` | Shot hit the post/crossbar |
|
|
57
|
+
| `OWN_GOAL` | Shot resulted in an own goal |
|
|
51
58
|
|
|
52
59
|
#### TakeOnResult
|
|
53
60
|
|
|
@@ -55,13 +62,15 @@ Each event has a `result` property with type-specific enum values:
|
|
|
55
62
|
|---|---|
|
|
56
63
|
| `COMPLETE` | Successful dribble |
|
|
57
64
|
| `INCOMPLETE` | Failed dribble, lost possession |
|
|
65
|
+
| `OUT` | Ball went out of play during the take-on |
|
|
58
66
|
|
|
59
67
|
#### DuelResult
|
|
60
68
|
|
|
61
69
|
| Value | Description |
|
|
62
70
|
|---|---|
|
|
63
|
-
| `WON` | Won the duel |
|
|
64
|
-
| `LOST` | Lost the duel |
|
|
71
|
+
| `WON` | Won the duel (player touching the ball first) |
|
|
72
|
+
| `LOST` | Lost the duel (opponent touches the ball first) |
|
|
73
|
+
| `NEUTRAL` | Neither player won the duel (mainly for Wyscout v2) |
|
|
65
74
|
|
|
66
75
|
#### InterceptionResult
|
|
67
76
|
|
|
@@ -69,14 +78,9 @@ Each event has a `result` property with type-specific enum values:
|
|
|
69
78
|
|---|---|
|
|
70
79
|
| `SUCCESS` | Successfully intercepted |
|
|
71
80
|
| `LOST` | Interception attempt failed |
|
|
72
|
-
| `
|
|
81
|
+
| `OUT` | Interception knocked the ball out of play |
|
|
73
82
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
| Value | Description |
|
|
77
|
-
|---|---|
|
|
78
|
-
| `SUCCESS` | Successful goalkeeper action |
|
|
79
|
-
| `FAILURE` | Failed goalkeeper action |
|
|
83
|
+
Note: `GoalkeeperEvent` has no `result` property (its `result` is always `None`) -- there is no `GoalkeeperActionResult` enum in kloppy.
|
|
80
84
|
|
|
81
85
|
## Qualifiers
|
|
82
86
|
|
|
@@ -97,10 +101,18 @@ Qualifiers add additional context to events without creating separate event type
|
|
|
97
101
|
|
|
98
102
|
| Value | Description |
|
|
99
103
|
|---|---|
|
|
100
|
-
| `RIGHT_FOOT` |
|
|
101
|
-
| `LEFT_FOOT` |
|
|
102
|
-
| `HEAD` |
|
|
103
|
-
| `
|
|
104
|
+
| `RIGHT_FOOT` | Pass, shot, or (for goalkeepers) save with the right foot |
|
|
105
|
+
| `LEFT_FOOT` | Pass, shot, or (for goalkeepers) save with the left foot |
|
|
106
|
+
| `HEAD` | Pass, shot, or (for goalkeepers) save with the head |
|
|
107
|
+
| `OTHER` | Other body part (chest, back, etc.), for pass and shot |
|
|
108
|
+
| `HEAD_OTHER` | Pass or shot with head or other body part (used when the provider does not distinguish `HEAD` from `OTHER`) |
|
|
109
|
+
| `BOTH_HANDS` | Goalkeeper only. Save with both hands |
|
|
110
|
+
| `CHEST` | Goalkeeper only. Save with chest |
|
|
111
|
+
| `LEFT_HAND` | Goalkeeper only. Save with left hand |
|
|
112
|
+
| `RIGHT_HAND` | Goalkeeper only. Save with right hand |
|
|
113
|
+
| `DROP_KICK` | Pass is a keeper drop kick |
|
|
114
|
+
| `KEEPER_ARM` | Pass thrown from the keeper's hands |
|
|
115
|
+
| `NO_TOUCH` | Pass only. A player deliberately let the pass go past them instead of receiving it (a "dummy") |
|
|
104
116
|
|
|
105
117
|
### CardQualifier
|
|
106
118
|
|
|
@@ -115,26 +127,32 @@ Qualifiers add additional context to events without creating separate event type
|
|
|
115
127
|
| Value | Description |
|
|
116
128
|
|---|---|
|
|
117
129
|
| `CROSS` | Cross into the box |
|
|
118
|
-
| `LONG_BALL` |
|
|
119
|
-
| `THROUGH_BALL` | Through ball |
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `LAUNCH` |
|
|
130
|
+
| `LONG_BALL` | A pass that travels at least 32 metres |
|
|
131
|
+
| `THROUGH_BALL` | Through ball, played into space behind the defence |
|
|
132
|
+
| `CHIPPED_PASS` | Chipped pass, lifted into the air |
|
|
133
|
+
| `SWITCH_OF_PLAY` | Any pass which crosses the centre zone and travels more than 50% of the pitch width |
|
|
134
|
+
| `LAUNCH` | A long forward pass with no specific target |
|
|
123
135
|
| `HEAD_PASS` | Headed pass |
|
|
124
136
|
| `HIGH_PASS` | High/lofted pass |
|
|
125
137
|
| `HAND_PASS` | Goalkeeper hand pass |
|
|
126
|
-
| `SMART_PASS` | Creative pass
|
|
138
|
+
| `SMART_PASS` | Creative, penetrative pass attempting to break defensive lines |
|
|
139
|
+
| `SIMPLE_PASS` | A standard pass without complex manoeuvres |
|
|
140
|
+
| `FLICK_ON` | A pass where a player flicks the ball on towards a teammate, usually with their head |
|
|
141
|
+
| `SHOT_ASSIST` | A pass leading directly to a shot attempt (not necessarily a goal) |
|
|
142
|
+
| `ASSIST` | A pass leading directly to a goal |
|
|
143
|
+
| `ASSIST_2ND` | A pass leading to another pass which then leads to a goal |
|
|
127
144
|
|
|
128
145
|
### GoalkeeperQualifier
|
|
129
146
|
|
|
130
147
|
| Value | Description |
|
|
131
148
|
|---|---|
|
|
132
|
-
| `SAVE` |
|
|
133
|
-
| `CLAIM` |
|
|
134
|
-
| `PUNCH` |
|
|
135
|
-
| `PICK_UP` |
|
|
136
|
-
| `SMOTHER` |
|
|
137
|
-
| `
|
|
149
|
+
| `SAVE` | Goalkeeper faces a shot and saves |
|
|
150
|
+
| `CLAIM` | Goalkeeper catches a cross |
|
|
151
|
+
| `PUNCH` | Goalkeeper punches ball clear |
|
|
152
|
+
| `PICK_UP` | Goalkeeper picks up the ball |
|
|
153
|
+
| `SMOTHER` | Goalkeeper comes out to dispossess a player (equivalent to a tackle for an outfield player) |
|
|
154
|
+
| `REFLEX` | Goalkeeper performs a reflex save |
|
|
155
|
+
| `SAVE_ATTEMPT` | Goalkeeper attempts to save a shot |
|
|
138
156
|
|
|
139
157
|
## Event Structure
|
|
140
158
|
|
|
@@ -143,7 +161,7 @@ Every event shares a common base:
|
|
|
143
161
|
```python
|
|
144
162
|
class Event:
|
|
145
163
|
event_id: str # Unique event ID
|
|
146
|
-
event_type: EventType # One of the
|
|
164
|
+
event_type: EventType # One of the 19 canonical types
|
|
147
165
|
result: Optional[ResultType] # Type-specific result enum
|
|
148
166
|
qualifiers: List[Qualifier] # Additional context
|
|
149
167
|
period: Period # Match period (1H, 2H, etc.)
|
|
@@ -192,43 +210,49 @@ kloppy abstracts coordinate systems through the `CoordinateSystem` class.
|
|
|
192
210
|
|
|
193
211
|
| System | Dimensions | Origin | Y Direction |
|
|
194
212
|
|---|---|---|---|
|
|
195
|
-
| `kloppy` |
|
|
213
|
+
| `kloppy` | 1 x 1 | Top-left | Down (normalised) |
|
|
196
214
|
| `opta` | 100 x 100 | Bottom-left | Up |
|
|
197
215
|
| `wyscout` | 100 x 100 | Top-left | Down |
|
|
198
216
|
| `statsbomb` | 120 x 80 | Top-left | Down |
|
|
199
217
|
| `secondspectrum` | 105 x 68 | Centre | Up |
|
|
200
218
|
| `tracab` | 10500 x 6800 | Centre | Up (centimetres) |
|
|
201
|
-
| `metrica` | 1 x 1 |
|
|
219
|
+
| `metrica` | 1 x 1 | Top-left | Down (normalised) |
|
|
202
220
|
| `sportec` | 105 x 68 | Bottom-left | Up |
|
|
203
221
|
| `skillcorner` | 105 x 68 | Centre | Up |
|
|
204
|
-
| `datafactory` |
|
|
222
|
+
| `datafactory` | 2 x 2 | Centre | Down (normalised) |
|
|
205
223
|
|
|
206
224
|
### Transforming Coordinates
|
|
207
225
|
|
|
208
226
|
```python
|
|
209
|
-
from kloppy.domain import
|
|
227
|
+
from kloppy.domain import MetricPitchDimensions, Dimension
|
|
210
228
|
|
|
211
229
|
# Transform to kloppy's standard system
|
|
212
230
|
dataset = dataset.transform(
|
|
213
|
-
to_pitch_dimensions=
|
|
214
|
-
|
|
231
|
+
to_pitch_dimensions=MetricPitchDimensions(
|
|
232
|
+
x_dim=Dimension(0, 105),
|
|
233
|
+
y_dim=Dimension(0, 68),
|
|
234
|
+
pitch_length=105,
|
|
235
|
+
pitch_width=68,
|
|
236
|
+
standardized=False,
|
|
237
|
+
),
|
|
238
|
+
to_orientation="STATIC_HOME_AWAY"
|
|
215
239
|
)
|
|
216
240
|
|
|
217
|
-
# Or
|
|
218
|
-
|
|
219
|
-
df = to_pandas(dataset, additional_columns={"coordinates_x": lambda e: e.coordinates.x})
|
|
241
|
+
# Or export with additional derived columns
|
|
242
|
+
df = dataset.to_df(engine="pandas", coordinates_x=lambda e: e.coordinates.x)
|
|
220
243
|
```
|
|
221
244
|
|
|
222
245
|
### Orientation
|
|
223
246
|
|
|
224
247
|
| Orientation | Description |
|
|
225
248
|
|---|---|
|
|
226
|
-
| `
|
|
227
|
-
| `ACTION_EXECUTING_TEAM` |
|
|
228
|
-
| `
|
|
229
|
-
| `
|
|
230
|
-
| `
|
|
231
|
-
| `
|
|
249
|
+
| `BALL_OWNING_TEAM` | The team currently in possession always attacks left-to-right |
|
|
250
|
+
| `ACTION_EXECUTING_TEAM` | The team executing the action always attacks left-to-right (event data only; equivalent to `BALL_OWNING_TEAM` for tracking data) |
|
|
251
|
+
| `HOME_AWAY` | Home team attacks left-to-right in the first period, away team in the second |
|
|
252
|
+
| `AWAY_HOME` | Away team attacks left-to-right in the first period, home team in the second |
|
|
253
|
+
| `STATIC_HOME_AWAY` | Home team attacks left-to-right in both periods (physical pitch) |
|
|
254
|
+
| `STATIC_AWAY_HOME` | Away team attacks left-to-right in both periods (physical pitch) |
|
|
255
|
+
| `NOT_SET` | Attacking direction is not defined |
|
|
232
256
|
|
|
233
257
|
## Dataset Structure
|
|
234
258
|
|
|
@@ -269,7 +293,8 @@ class Player:
|
|
|
269
293
|
name: str
|
|
270
294
|
team: Team
|
|
271
295
|
jersey_no: Optional[int]
|
|
272
|
-
position: Optional[Position] #
|
|
296
|
+
position: Optional[Position] # PositionType has 33 members, e.g. Goalkeeper,
|
|
297
|
+
# LeftBack, CenterDefensiveMidfield, Striker
|
|
273
298
|
starting: bool # In starting XI
|
|
274
299
|
```
|
|
275
300
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## How Mapping Works
|
|
4
4
|
|
|
5
|
-
kloppy maps each provider's native event types to its
|
|
5
|
+
kloppy maps each provider's native event types to its 19 canonical event types. When a provider event has no clean canonical match, it becomes a `GenericEvent` with the original type preserved in `raw_event`.
|
|
6
6
|
|
|
7
|
-
Each provider has a **deserializer** class (e.g., `
|
|
7
|
+
Each provider has a **deserializer** class (e.g., `StatsPerformDeserializer` for Opta, `StatsBombDeserializer`) that handles the translation. The mapping is deterministic -- the same provider event always produces the same kloppy event type.
|
|
8
8
|
|
|
9
9
|
## Mapping Tables
|
|
10
10
|
|
|
@@ -12,66 +12,45 @@ Each provider has a **deserializer** class (e.g., `OptaDeserializer`, `StatsBomb
|
|
|
12
12
|
|
|
13
13
|
| Opta Type ID | Opta Name | kloppy Event Type | Notes |
|
|
14
14
|
|---|---|---|---|
|
|
15
|
-
| 1 | Pass | `PASS` |
|
|
15
|
+
| 1 | Pass | `PASS` | Subtypes preserved as qualifiers |
|
|
16
16
|
| 2 | Offside Pass | `PASS` | Result set to `OFFSIDE` |
|
|
17
17
|
| 3 | Take On | `TAKE_ON` | |
|
|
18
|
-
| 4 | Foul | `FOUL_COMMITTED` | |
|
|
18
|
+
| 4 | Foul Committed | `FOUL_COMMITTED` | Only when `outcome == 0` |
|
|
19
19
|
| 5 | Out | `BALL_OUT` | |
|
|
20
|
-
| 6 | Corner Awarded | `
|
|
21
|
-
| 7 | Tackle | `DUEL` | |
|
|
20
|
+
| 6 | Corner Awarded | `BALL_OUT` | |
|
|
21
|
+
| 7 | Tackle | `DUEL` | With `GROUND` duel qualifier |
|
|
22
22
|
| 8 | Interception | `INTERCEPTION` | |
|
|
23
|
-
| 9 | Turnover | `GENERIC` | |
|
|
24
23
|
| 10 | Save | `GOALKEEPER` | With `SAVE` qualifier |
|
|
25
24
|
| 11 | Claim | `GOALKEEPER` | With `CLAIM` qualifier |
|
|
26
25
|
| 12 | Clearance | `CLEARANCE` | |
|
|
27
26
|
| 13 | Miss | `SHOT` | Result: `OFF_TARGET` |
|
|
28
|
-
| 14 | Post | `SHOT` | Result: `
|
|
27
|
+
| 14 | Post | `SHOT` | Result: `OFF_TARGET` |
|
|
29
28
|
| 15 | Attempt Saved | `SHOT` | Result: `SAVED` |
|
|
30
29
|
| 16 | Goal | `SHOT` | Result: `GOAL` |
|
|
31
|
-
| 17 | Card | `
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
| 37 | Collection End | `GENERIC` | |
|
|
40
|
-
| 38 | Temp_GoalKick | `GENERIC` | |
|
|
41
|
-
| 39 | Temp_FreekickCross | `GENERIC` | |
|
|
30
|
+
| 17 | Card | `CARD` | |
|
|
31
|
+
| 18 | Player Off | `PLAYER_OFF` | |
|
|
32
|
+
| 19 | Player On | `PLAYER_ON` | Also read as the replacement in a substitution |
|
|
33
|
+
| 27 | Start Delay | — | Treated as a dead-ball event |
|
|
34
|
+
| 28 | End Delay | — | Treated as a dead-ball event |
|
|
35
|
+
| 30 | End Period | — | Sets the period end timestamp |
|
|
36
|
+
| 32 | Start Period | — | Sets the period start timestamp |
|
|
37
|
+
| 34 | Team Set Up | — | Starting formations and line-ups |
|
|
42
38
|
| 40 | Formation Change | `FORMATION_CHANGE` | |
|
|
43
39
|
| 41 | Punch | `GOALKEEPER` | With `PUNCH` qualifier |
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
| 59 | Possession Loss | `GENERIC` | |
|
|
59
|
-
| 61 | Keeper Pick-up | `GOALKEEPER` | With `PICK_UP` qualifier |
|
|
60
|
-
| 63 | Temp_Thing | `GENERIC` | |
|
|
61
|
-
| 64 | Shield Ball | `GENERIC` | |
|
|
62
|
-
| 65 | Ball Touch | `GENERIC` | |
|
|
63
|
-
| 66 | Temp_Cross | `GENERIC` | |
|
|
64
|
-
| 67 | Keeper Sweeper | `GOALKEEPER` | With `KEEPER_SWEEP` qualifier |
|
|
65
|
-
| 68 | Chance Missed | `SHOT` | |
|
|
66
|
-
| 69 | Ball Recovery | `GENERIC` | |
|
|
67
|
-
| 70 | Blocked | `SHOT` | Result: `BLOCKED` |
|
|
68
|
-
| 71 | Delayed Start | `GENERIC` | |
|
|
69
|
-
| 72 | Tackle Effective | `DUEL` | |
|
|
70
|
-
| 73 | Attendance | `GENERIC` | |
|
|
71
|
-
| 74 | Referee Stop | `GENERIC` | |
|
|
72
|
-
| 75 | Injury Clearance | `CLEARANCE` | |
|
|
73
|
-
| 76 | Tackle | `DUEL` | |
|
|
74
|
-
| 77 | Keeper Smother | `GOALKEEPER` | With `SMOTHER` qualifier |
|
|
40
|
+
| 43 | Deleted Event | — | Filtered out before parsing |
|
|
41
|
+
| 44 | Aerial | `DUEL` | With `AERIAL` duel qualifier |
|
|
42
|
+
| 45 | Challenge | — | Read as look-ahead context for take-ons |
|
|
43
|
+
| 49 | Ball Recovery | `RECOVERY` | |
|
|
44
|
+
| 52 | Keeper Pick-up | `GOALKEEPER` | With `PICK_UP` qualifier |
|
|
45
|
+
| 54 | Smother | `GOALKEEPER` | With `SMOTHER` qualifier |
|
|
46
|
+
| 55 | Offside Provoked | — | Treated as a dead-ball event |
|
|
47
|
+
| 61 | Ball Touch | `MISCONTROL` | Only when `outcome == 0` |
|
|
48
|
+
| 67 | 50/50 | `DUEL` | With `LOOSE_BALL` and `GROUND` qualifiers |
|
|
49
|
+
| 74 | Blocked Pass | `PASS` | |
|
|
50
|
+
|
|
51
|
+
These are the 35 Opta type IDs kloppy's `StatsPerformDeserializer` names explicitly;
|
|
52
|
+
IDs it does not name are not silently mapped, so check the deserializer source before
|
|
53
|
+
relying on any other ID.
|
|
75
54
|
|
|
76
55
|
### StatsBomb to kloppy
|
|
77
56
|
|
|
@@ -247,4 +226,4 @@ elif dataset.metadata.provider == Provider.WYSCOUT:
|
|
|
247
226
|
print("Wyscout data")
|
|
248
227
|
```
|
|
249
228
|
|
|
250
|
-
Available providers: `
|
|
229
|
+
Available providers (`kloppy.domain.Provider`, 17 members): `DATAFACTORY`, `HAWKEYE`, `IMPECT`, `KLOPPY`, `METRICA`, `OPTA`, `OTHER`, `PFF`, `SECONDSPECTRUM`, `SIGNALITY`, `SKILLCORNER`, `SPORTEC`, `SPORTVU`, `STATSBOMB`, `STATSPERFORM`, `TRACAB`, `WYSCOUT`.
|