football-docs 0.12.2 → 0.12.3
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 +7 -2
- package/data/docs.db +0 -0
- package/dist/ingest.d.ts +1 -1
- package/dist/ingest.js +4 -1
- package/docs/free-sources/understat.md +65 -48
- package/docs/opta/api-access.md +1 -1
- package/docs/opta/charting-game-state.md +4 -2
- package/docs/opta/charting-lineups.md +1 -1
- package/docs/opta/charting-set-pieces.md +6 -5
- package/docs/opta/charting-shot-placement.md +6 -7
- package/docs/opta/event-types.md +21 -11
- package/docs/opta/qualifiers.md +52 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -119,7 +119,7 @@ Provider filters use the indexed provider keys shown by `list_providers`, but co
|
|
|
119
119
|
| mplsoccer | 65 | overview, pitch-types, visualizations |
|
|
120
120
|
| Impect | 79 | overview, data-model, event-types, coordinate-system, concepts, kpi-definitions, identity-surfaces, data-provenance |
|
|
121
121
|
| SkillCorner | 51 | api-access, api-endpoints, data-model, physical-data, coordinate-system, concepts, identity-surfaces, data-provenance |
|
|
122
|
-
| Free sources |
|
|
122
|
+
| Free sources | 60 | overview, fbref, understat, contextual-story-joins, xg-timelines, data-provenance |
|
|
123
123
|
| soccerdata | 40 | overview, data-sources, usage |
|
|
124
124
|
| TransferRoom | 45 | api-access, api-endpoints, charting-availability, data-model, identity-surfaces, data-provenance |
|
|
125
125
|
| Opta | 73 | event-types, qualifiers, coordinate-system, api-access, charting-game-state, charting-lineups, charting-passmaps, charting-set-pieces, charting-shot-placement, identity-surfaces, data-provenance |
|
|
@@ -135,7 +135,7 @@ Provider filters use the indexed provider keys shown by `list_providers`, but co
|
|
|
135
135
|
| Soccerdonna | 5 | identity-surfaces, data-provenance |
|
|
136
136
|
| Transfermarkt | 5 | identity-surfaces, data-provenance |
|
|
137
137
|
|
|
138
|
-
**2,
|
|
138
|
+
**2,850 searchable chunks** across 26 providers and tools.
|
|
139
139
|
|
|
140
140
|
ESPN coverage consists of curated, dated observations of ESPN-hosted soccer
|
|
141
141
|
endpoints, checked for eng.1 and esp.1. These observations are not an official API
|
|
@@ -254,6 +254,11 @@ Each crawled doc carries provenance metadata (source URL, source type, upstream
|
|
|
254
254
|
`v*` tag and does the rest: it re-runs the full check suite, creates the GitHub
|
|
255
255
|
Release, and publishes to npm.
|
|
256
256
|
|
|
257
|
+
Before a release, run `pnpm check:upstream` (see "Documentation validation"). It
|
|
258
|
+
reports any provider whose package, spec or live access path has moved since the
|
|
259
|
+
docs were written, so a release does not ship docs that are already stale. Fix or
|
|
260
|
+
note what it lists; a known, tracked failure (an open issue) need not block.
|
|
261
|
+
|
|
257
262
|
```bash
|
|
258
263
|
# 1. Bump the version in package.json and server.json (three fields in total).
|
|
259
264
|
# Land it on main through a pull request, as `chore: release vX.Y.Z`.
|
package/data/docs.db
CHANGED
|
Binary file
|
package/dist/ingest.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ interface DocChunk {
|
|
|
35
35
|
crawled_at: string | null;
|
|
36
36
|
}
|
|
37
37
|
/** Parse optional YAML frontmatter from a markdown file. */
|
|
38
|
-
export declare function parseFrontmatter(
|
|
38
|
+
export declare function parseFrontmatter(raw: string): {
|
|
39
39
|
frontmatter: Frontmatter;
|
|
40
40
|
body: string;
|
|
41
41
|
};
|
package/dist/ingest.js
CHANGED
|
@@ -27,7 +27,10 @@ const DOCS_DIR = resolve(__dirname, "..", "docs");
|
|
|
27
27
|
const DB_DIR = resolve(__dirname, "..", "data");
|
|
28
28
|
const DB_PATH = resolve(DB_DIR, "docs.db");
|
|
29
29
|
/** Parse optional YAML frontmatter from a markdown file. */
|
|
30
|
-
export function parseFrontmatter(
|
|
30
|
+
export function parseFrontmatter(raw) {
|
|
31
|
+
// A Windows checkout reads docs with CRLF endings. Left in, the \r stops the
|
|
32
|
+
// frontmatter matching and ends up inside every chunk in the shipped index.
|
|
33
|
+
const text = raw.replace(/\r\n?/g, "\n");
|
|
31
34
|
const defaults = {
|
|
32
35
|
source_url: null,
|
|
33
36
|
source_type: "curated",
|
|
@@ -69,20 +69,25 @@ Per-player per-season:
|
|
|
69
69
|
| `xGChain` | xG chain (total xG of possessions player was involved in) |
|
|
70
70
|
| `xGBuildup` | xG buildup (xG chain minus shots and key passes) |
|
|
71
71
|
|
|
72
|
-
### Team
|
|
72
|
+
### Team Match Stats
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
One entry per team per league match, in `teams[<team_id>].history` from
|
|
75
|
+
`getLeagueData`. Each entry holds the team's values and its opponent's, not a
|
|
76
|
+
season total; sum the entries to get season figures.
|
|
75
77
|
|
|
76
78
|
| Field | Description |
|
|
77
79
|
|---|---|
|
|
80
|
+
| `date` / `h_a` | Kickoff time and venue (`h` home, `a` away) |
|
|
81
|
+
| `result` | `w`, `d` or `l` |
|
|
82
|
+
| `wins` / `draws` / `loses` / `pts` | This match only (`1`/`0` flags and points), not a running total |
|
|
78
83
|
| `xG` / `xGA` | Expected goals for / against |
|
|
79
84
|
| `npxG` / `npxGA` | Non-penalty xG for / against |
|
|
80
85
|
| `deep` / `deep_allowed` | Deep completions (passes within 20m of goal) |
|
|
81
86
|
| `scored` / `missed` | Goals scored / conceded |
|
|
82
87
|
| `xpts` | Expected points |
|
|
83
88
|
| `npxGD` | Non-penalty xG difference |
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
89
|
+
| `ppda.att` / `ppda.def` | PPDA components (pressing intensity) |
|
|
90
|
+
| `ppda_allowed.att` / `ppda_allowed.def` | Opponent PPDA components |
|
|
86
91
|
|
|
87
92
|
## Access methods
|
|
88
93
|
|
|
@@ -98,57 +103,69 @@ player_stats = understat.read_player_season_stats()
|
|
|
98
103
|
|
|
99
104
|
**Direct HTTP:**
|
|
100
105
|
|
|
101
|
-
Understat
|
|
106
|
+
Understat pages now return a shell without the former embedded JSONP blobs. Fetch the
|
|
107
|
+
AJAX endpoints instead. The `X-Requested-With` header is required; the browser headers
|
|
108
|
+
below also make the request shape explicit. `requests` handles the compressed response.
|
|
109
|
+
|
|
110
|
+
The season in a league or team path is the start year: `2026` means the 2026/27
|
|
111
|
+
campaign.
|
|
102
112
|
|
|
103
113
|
```python
|
|
104
|
-
import requests
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
#
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
# Team match-by-match
|
|
125
|
-
|
|
114
|
+
import requests
|
|
115
|
+
|
|
116
|
+
BASE = "https://understat.com/"
|
|
117
|
+
HEADERS = {
|
|
118
|
+
"User-Agent": "Mozilla/5.0",
|
|
119
|
+
"X-Requested-With": "XMLHttpRequest",
|
|
120
|
+
"Referer": BASE,
|
|
121
|
+
"Accept": "application/json, text/javascript, */*; q=0.01",
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
def get_understat_data(path):
|
|
125
|
+
response = requests.get(
|
|
126
|
+
f"{BASE}{path.lstrip('/')}", headers=HEADERS, timeout=30
|
|
127
|
+
)
|
|
128
|
+
response.raise_for_status()
|
|
129
|
+
return response.json()
|
|
130
|
+
|
|
131
|
+
# League data: teams, players and match dates
|
|
132
|
+
league = get_understat_data("getLeagueData/Serie_A/2026")
|
|
133
|
+
|
|
134
|
+
# Team match-by-match data and season statistics
|
|
135
|
+
team = get_understat_data("getTeamData/AC_Milan/2025")
|
|
136
|
+
|
|
137
|
+
# Match shots and rosters
|
|
138
|
+
match = get_understat_data("getMatchData/12345")
|
|
139
|
+
home_shots = match["shots"]["h"]
|
|
140
|
+
away_shots = match["shots"]["a"]
|
|
141
|
+
|
|
142
|
+
# Player profile, aggregates and shots
|
|
143
|
+
player = get_understat_data("getPlayerData/1250")
|
|
144
|
+
player_shots = player["shots"]
|
|
126
145
|
```
|
|
127
146
|
|
|
128
|
-
### URL Patterns
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
# League: https://understat.com/league/{league}/{season}
|
|
132
|
-
# league: EPL, La_Liga, Bundesliga, Serie_A, Ligue_1, RFPL
|
|
133
|
-
# season: start year (2024 for 2024/25)
|
|
134
|
-
# Player: https://understat.com/player/{player_id}
|
|
135
|
-
# Team: https://understat.com/team/{team_name}/{season}
|
|
136
|
-
# Match: https://understat.com/match/{match_id}
|
|
137
|
-
```
|
|
147
|
+
### URL Patterns and API Paths
|
|
138
148
|
|
|
139
|
-
|
|
149
|
+
Use the page URL for a browser view and the corresponding API path for data access.
|
|
150
|
+
Team names use Understat's slug (for example, `AC_Milan`).
|
|
140
151
|
|
|
141
|
-
| Page |
|
|
152
|
+
| Page | Page URL | API path |
|
|
142
153
|
|---|---|---|
|
|
143
|
-
| League | `
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
| Match | `
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
154
|
+
| League | `https://understat.com/league/{league}/{season}` | `getLeagueData/{league}/{season}` |
|
|
155
|
+
| Player | `https://understat.com/player/{player_id}` | `getPlayerData/{player_id}` |
|
|
156
|
+
| Team | `https://understat.com/team/{team_name}/{season}` | `getTeamData/{team_name}/{season}` |
|
|
157
|
+
| Match | `https://understat.com/match/{match_id}` | `getMatchData/{match_id}` |
|
|
158
|
+
|
|
159
|
+
`league` is one of `EPL`, `La_Liga`, `Bundesliga`, `Serie_A`, `Ligue_1` or `RFPL`.
|
|
160
|
+
|
|
161
|
+
### API Response Keys
|
|
162
|
+
|
|
163
|
+
| API path | Response keys |
|
|
164
|
+
|---|---|
|
|
165
|
+
| `getLeagueData/{league}/{season}` | `teams` (dict keyed by team ID, each with `id`, `title` and `history`), `players` (list), `dates` (list) |
|
|
166
|
+
| `getTeamData/{team}/{season}` | `dates`, `players`, `statistics` (`situation`, `formation`, `gameState`, `timing`, `shotZone`, `attackSpeed`, `result`) |
|
|
167
|
+
| `getMatchData/{match_id}` | `shots` (`h` and `a`), `rosters` (`h` and `a`), `tmpl` |
|
|
168
|
+
| `getPlayerData/{player_id}` | `player`, `matches`, `groups`, `positionsList`, `minMaxPlayerStats`, `shots`, `lastMatch` |
|
|
152
169
|
|
|
153
170
|
## Coordinate System
|
|
154
171
|
|
package/docs/opta/api-access.md
CHANGED
|
@@ -56,5 +56,5 @@ The public Opta Analyst website (theanalyst.com) uses a static feed key that pro
|
|
|
56
56
|
- This is an unofficial access path via theanalyst.com's frontend key
|
|
57
57
|
- No SLA or guaranteed uptime
|
|
58
58
|
- Token could be rotated at any time
|
|
59
|
-
-
|
|
59
|
+
- xG is not on `matchevent`; use q321 from `matchexpectedgoals` (q213 is the pass angle, not xG)
|
|
60
60
|
- Data redistribution likely prohibited under Stats Perform terms
|
|
@@ -10,7 +10,7 @@ specific match minute.
|
|
|
10
10
|
| Field or qualifier | Meaning |
|
|
11
11
|
|---|---|
|
|
12
12
|
| typeId `16` | goal event |
|
|
13
|
-
| qualifier `8` | disallowed goal
|
|
13
|
+
| qualifier `8` | goal disallowed; Stats Perform lists it on the pass (typeId `2`) that led to the disallowed goal, not on goal events |
|
|
14
14
|
| qualifier `28` | own goal; credit the opposing team, not the event `contestantId` |
|
|
15
15
|
| event `contestantId` / `teamId` | team attached to the event |
|
|
16
16
|
| `timeMin` + `timeSec` | event clock in the Opta feed |
|
|
@@ -24,7 +24,9 @@ Recommended scoreline reconstruction:
|
|
|
24
24
|
|
|
25
25
|
1. Select goal events: Opta typeId `16`, or `isGoal === true` in a WhoScored-shaped
|
|
26
26
|
event model.
|
|
27
|
-
2.
|
|
27
|
+
2. As a guard, drop any goal event that carries qualifier `8` (`goalDisallowed`).
|
|
28
|
+
Stats Perform's MA36 table lists Q8 only on the pass (typeId `2`) that led to a
|
|
29
|
+
disallowed goal, so in a clean feed this step removes nothing.
|
|
28
30
|
3. If qualifier `28` (`ownGoal`) is present, add the goal to the opponent's
|
|
29
31
|
score; otherwise add it to the event team.
|
|
30
32
|
4. Sort goals by period and clock/expanded minute.
|
|
@@ -8,7 +8,7 @@ match-stats rows, and squad metadata.
|
|
|
8
8
|
| Need | Best Opta surface | Notes |
|
|
9
9
|
|---|---|---|
|
|
10
10
|
| Kickoff team setup | `matchevent/{token}?fx={matchId}` typeId `34` | Team set-up event. Qualifiers `30`, `44`, `59`, `130`, `131`, and sometimes `194` describe the player list, positions, shirt numbers, formation, and captain. |
|
|
11
|
-
| Formation changes | `matchevent/{token}?fx={matchId}` typeId `40`
|
|
11
|
+
| Formation changes | `matchevent/{token}?fx={matchId}` typeId `40` | Formation-change event. It carries the same set-up qualifiers as typeId `34` (`30`, `44`, `59`, `130`, `131`, `194`), so read the new shape from it. |
|
|
12
12
|
| Player on/off timing | typeId `18` and typeId `19`, or `matchstats` substitution fields | Use the explicit substitution event or substitution row. Do not derive minutes from starter/bench status alone. |
|
|
13
13
|
| Player labels and squad context | `squads/{token}?tmcl={seasonId}` plus `matchstats/{token}?fx={matchId}` | Join by Opta player ID for display labels, positions, and match-day rows. |
|
|
14
14
|
| Pass-map or shot-map roles | `matchstats` player rows | `formationPlace` gives the starting XI slot for many match-stats exports. |
|
|
@@ -11,7 +11,7 @@ rates, or delivery-to-shot sequence charts from Opta/WhoScored-shaped event data
|
|
|
11
11
|
| Corner delivery event | `matchevent/{token}?fx={matchId}` pass events with qualifier `6` (`cornerTaken`) | Treat typeId `1` + Q6 as the delivery, not typeId `6` (`Corner awarded`). |
|
|
12
12
|
| Delivery endpoint | qualifiers `140` (`passEndX`) and `141` (`passEndY`) | Fall back to provider `endX`/`endY` fields only when the qualifier values are absent and the export defines those fields. |
|
|
13
13
|
| Corner-sourced shots | shot events typeIds `13`, `14`, `15`, `16` with qualifier `25` (`fromCorner`) | Use this for shot/result counts; it does not identify the delivery by itself. |
|
|
14
|
-
| Body part | qualifiers `15
|
|
14
|
+
| Body part | qualifiers `15` head, `20` right foot, `72` left foot, `21` other body part | `22` is regular (open) play, not a body part, and `56` is a pitch-zone qualifier. |
|
|
15
15
|
| Direct corner / Olimpico | qualifier `263` where present | Keep direct corners separate from normal delivery-to-shot sequences because timestamp order can look like a near-zero-second shot. |
|
|
16
16
|
|
|
17
17
|
For xG or xGOT, join the shot row to `matchexpectedgoals/{token}?fx={matchId}`
|
|
@@ -28,7 +28,7 @@ Opta/WhoScored-style event stream.
|
|
|
28
28
|
| Need | Opta surface | Implementation note |
|
|
29
29
|
|---|---|---|
|
|
30
30
|
| Throw-in delivery | `matchevent/{token}?fx={matchId}` pass events with qualifier `107` (`throwIn`) | Treat the throw as a pass-like restart. Filter to attacking-third or box-targeted throws before calling them dangerous set pieces. |
|
|
31
|
-
|
|
|
31
|
+
| Throw-in set-piece flag | qualifier `160` where present | Q160 marks a shot or pass that came from a throw-in set piece. It does not measure throw length, so a long-throw cut still needs a geometric rule, such as throw origin and endpoint into the box. |
|
|
32
32
|
| Delivery endpoint | qualifiers `140` (`passEndX`) and `141` (`passEndY`) | Fall back to event `endX`/`endY` only when the export defines those fields. |
|
|
33
33
|
| Throw-sourced shot | shot typeIds `13`, `14`, `15`, `16` after the throw | Link by related event when present, otherwise by same-team time proximity in the same period. |
|
|
34
34
|
| Shot quality | `matchexpectedgoals` qualifiers `321`/`322` joined to shot rows | Keep xG per throw, shots per throw, and goals per throw as separate denominators. |
|
|
@@ -36,8 +36,9 @@ Opta/WhoScored-style event stream.
|
|
|
36
36
|
Implementation notes:
|
|
37
37
|
|
|
38
38
|
- Do not treat every qualifier `107` throw-in as a long throw. Define the entry
|
|
39
|
-
rule explicitly:
|
|
40
|
-
the
|
|
39
|
+
rule explicitly: endpoint into the penalty area, origin in the final third, or
|
|
40
|
+
another named proxy. Qualifier `160` only says the action came from a throw-in
|
|
41
|
+
set piece.
|
|
41
42
|
- Long throws often create first contacts, flick-ons, blocks, and second balls.
|
|
42
43
|
Preserve the link method as `direct` when a related event points to the throw,
|
|
43
44
|
and `inferred` or `second_phase` when the shot is linked by time window.
|
|
@@ -96,7 +97,7 @@ Useful public chart fields:
|
|
|
96
97
|
| delivery zone | Q140/Q141 after mirroring |
|
|
97
98
|
| short-corner flag | `end_x < 83` or a separately coded short-corner action |
|
|
98
99
|
| shot outcome | shot typeId plus goal/post/saved/miss/block handling |
|
|
99
|
-
| body-part split | Q15 head, Q20
|
|
100
|
+
| body-part split | Q15 head, Q20 right foot, Q72 left foot, Q21 other |
|
|
100
101
|
| phase | direct related-event link versus inferred time-window link |
|
|
101
102
|
| xG / xGOT | Q321/Q322 from `matchexpectedgoals` when joined |
|
|
102
103
|
|
|
@@ -31,9 +31,8 @@ available, the separate expected-goals endpoint:
|
|
|
31
31
|
| Continuous provider xG and xGOT | `matchexpectedgoals/{token}?fx={matchId}` | Use qualifiers `321` (`expectedGoals`) and `322` (`expectedGoalsOnTarget`) from this endpoint when present. |
|
|
32
32
|
| Lineups and player labels | `matchstats/{token}?fx={matchId}` | Join by `playerId`; use `matchName`, position, and lineup fields for display. |
|
|
33
33
|
|
|
34
|
-
Do not
|
|
35
|
-
|
|
36
|
-
populates xG as qualifier `321` on `matchexpectedgoals` instead.
|
|
34
|
+
Do not read qualifier `213` as xG: it is the pass or clearance angle. The public
|
|
35
|
+
Opta Analyst-style feed supplies xG as qualifier `321` on `matchexpectedgoals`.
|
|
37
36
|
|
|
38
37
|
## Provider-first xG service recipe
|
|
39
38
|
|
|
@@ -90,8 +89,8 @@ Implementation notes:
|
|
|
90
89
|
| qualifier `82` | blocked shot |
|
|
91
90
|
| qualifier `102` | `GoalMouthY`, horizontal endpoint across the goal mouth |
|
|
92
91
|
| qualifier `103` | `GoalMouthZ`, vertical endpoint / height |
|
|
93
|
-
| qualifier `146` |
|
|
94
|
-
| qualifier `147` |
|
|
92
|
+
| qualifier `146` | X coordinate where the shot was blocked |
|
|
93
|
+
| qualifier `147` | Y coordinate where the shot was blocked |
|
|
95
94
|
|
|
96
95
|
When deriving a shot result, handle qualifier `82` before treating typeId `15` as
|
|
97
96
|
a normal saved shot. Some serializers classify a shot as blocked from the qualifier
|
|
@@ -224,8 +223,8 @@ proxy, but label the result as a proxy rather than xG:
|
|
|
224
223
|
| `18` | out-of-box centre |
|
|
225
224
|
| `66`, `67`, `68`, `69` | out-of-box wide/deep zones |
|
|
226
225
|
| `19`, `70`, `71` | thirty-five-plus / long-range zones |
|
|
227
|
-
| `
|
|
228
|
-
| `9
|
|
226
|
+
| `214` | big chance; usually exclude from low-xG placement-skill cuts |
|
|
227
|
+
| `9` | penalty; exclude or analyse separately |
|
|
229
228
|
|
|
230
229
|
For a robust first pass, join continuous xG from `matchexpectedgoals` where possible.
|
|
231
230
|
If you only have `matchevent`, a low-xG proxy can exclude small-box, big-chance, and
|
package/docs/opta/event-types.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Opta Event Types (F24 Specification)
|
|
2
2
|
|
|
3
3
|
Opta's event stream uses numeric `typeId` values on each event. Source: F24 Appendix 1.
|
|
4
|
+
The IDs and names are checked against Stats Perform's event type table for the
|
|
5
|
+
MA36 feed (August 2025), and against the Opta type lists in socceraction 1.5.3
|
|
6
|
+
(`socceraction.data.opta.loader`) and kloppy 3.19 (`statsperform` deserializer).
|
|
4
7
|
|
|
5
8
|
## Event Type Reference
|
|
6
9
|
|
|
@@ -24,16 +27,18 @@ Opta's event stream uses numeric `typeId` values on each event. Source: F24 Appe
|
|
|
24
27
|
| 17 | Card | ~4 | always 1 | Yellow/second yellow/red via qualifiers |
|
|
25
28
|
| 18 | Player off | ~9 | always 1 | Substituted off |
|
|
26
29
|
| 19 | Player on | ~1 | always 1 | Substituted on |
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
30
|
+
| 20 | Player retired | — | — | Player leaves the pitch |
|
|
31
|
+
| 21 | Player returns | — | — | Player comes back on after leaving the pitch |
|
|
32
|
+
| 27 | Start delay | ~3 | always 1 | Play stops for a delay. With qualifier 364, a VAR review |
|
|
33
|
+
| 28 | End delay | ~3 | always 1 | The delay ends and play restarts |
|
|
34
|
+
| 30 | End | ~6 | always 1 | End of a period. kloppy reads the period end time from it |
|
|
35
|
+
| 32 | Start | — | — | Start of a period. kloppy reads the period start time from it |
|
|
31
36
|
| 34 | Team set up | ~2 | always 1 | Formation/lineup event |
|
|
32
|
-
| 37 |
|
|
33
|
-
| 40 |
|
|
34
|
-
| 41 |
|
|
35
|
-
| 42 |
|
|
36
|
-
| 43 |
|
|
37
|
+
| 37 | Collection end | — | — | |
|
|
38
|
+
| 40 | Formation change | — | — | In-game formation change |
|
|
39
|
+
| 41 | Punch | — | — | GK punches the ball |
|
|
40
|
+
| 42 | Good skill | — | — | |
|
|
41
|
+
| 43 | Deleted event | — | — | Opta removed this event. Drop it before analysis; kloppy does |
|
|
37
42
|
| 44 | Aerial | ~60 | 0=lost, 1=won | Aerial duel |
|
|
38
43
|
| 45 | Challenge | ~15 | always 0 | Unsuccessful tackle attempt |
|
|
39
44
|
| 49 | Ball recovery | ~80 | always 1 | Player gathers loose ball |
|
|
@@ -45,9 +50,11 @@ Opta's event stream uses numeric `typeId` values on each event. Source: F24 Appe
|
|
|
45
50
|
| 59 | Keeper sweeper | ~5 | always 1 | GK comes off line to clear/claim |
|
|
46
51
|
| 61 | Ball touch | ~3 | always 1 | Bad touch / loss of control |
|
|
47
52
|
| 67 | 50/50 | ~2 | 0=lost, 1=won | Two players contest loose ball |
|
|
48
|
-
| 74 | Blocked pass | ~10 | always 1 |
|
|
53
|
+
| 74 | Blocked pass | ~10 | always 1 | Player blocks an opponent's pass |
|
|
49
54
|
| 83 | Attempted tackle | ~15 | always 0 | Unsuccessful tackle |
|
|
50
55
|
|
|
56
|
+
A dash means the per-match average or outcome has not been checked for that type.
|
|
57
|
+
|
|
51
58
|
## Shot Events
|
|
52
59
|
|
|
53
60
|
Shot events are types 13 (miss), 14 (post), 15 (attempt saved), and 16 (goal). All share the same qualifier set for location, body part, and shot details.
|
|
@@ -65,6 +72,9 @@ Shot events are types 13 (miss), 14 (post), 15 (attempt saved), and 16 (goal). A
|
|
|
65
72
|
|-------|---------|
|
|
66
73
|
| 1 | First half |
|
|
67
74
|
| 2 | Second half |
|
|
75
|
+
| 3 | Extra time, first half |
|
|
76
|
+
| 4 | Extra time, second half |
|
|
77
|
+
| 5 | Penalty shoot-out |
|
|
68
78
|
| 14 | Post-match / full-time |
|
|
69
79
|
| 16 | Pre-match |
|
|
70
80
|
|
|
@@ -82,7 +92,7 @@ PPDA, pass maps, dead-time, or game-state timelines.
|
|
|
82
92
|
| `duplicate_events` | event id or scoped fingerprint | De-duplicate exact repeats before state machines; keep a duplicate count in `quality_flags`. |
|
|
83
93
|
| `paired_events` | typeId `4` fouls, typeId `5` outs, duel events, `relatedEventId` where available | Validate expected pairs or links, but do not fabricate the missing side. |
|
|
84
94
|
| `scoreline_consistency` | typeId `16` goals, qualifier `8`, qualifier `28`, final score | Reconstruct valid goals and compare with the final score. Flag mismatches rather than forcing the event stream to agree. |
|
|
85
|
-
| `lineup_state` | typeIds `18`, `19`, `34`, `
|
|
95
|
+
| `lineup_state` | typeIds `18`, `19`, `20`, `21`, `34`, `40`, qualifiers `130`, `131`, `145` | Check that substitutions and formation changes do not create impossible on-pitch player states. |
|
|
86
96
|
| `coordinate_bounds` | event `x`/`y`, pass end qualifiers `140`/`141`, goal-mouth qualifiers `102`/`103` | Validate against the field-specific coordinate scale before calculating derived metrics. |
|
|
87
97
|
| `raw_vs_corrected` | raw event row plus validation output | Store validation flags and any corrected interpretation separately from raw provider facts. |
|
|
88
98
|
|
package/docs/opta/qualifiers.md
CHANGED
|
@@ -2,22 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Qualifiers add context to events. Each event has a `qualifier[]` array where each entry has a `qualifierId` (numeric) and optional `value` (string).
|
|
4
4
|
|
|
5
|
+
The IDs and names below are checked against Stats Perform's qualifier table for the
|
|
6
|
+
MA36 feed (August 2025). The camelCase names in the Name column are labels for this
|
|
7
|
+
doc, not field names: the feed carries only the numeric `qualifierId`.
|
|
8
|
+
|
|
5
9
|
## Pass Qualifiers
|
|
6
10
|
|
|
7
11
|
| ID | Name | Notes |
|
|
8
12
|
|----|------|-------|
|
|
9
|
-
| 1 | longBall |
|
|
13
|
+
| 1 | longBall | Pass longer than 32 metres |
|
|
10
14
|
| 2 | cross | Cross (Q2). Corners commonly carry Q2 + Q6; free-kick crosses commonly carry Q2 + Q5; open-play crosses are Q2 without Q5/Q6. |
|
|
11
|
-
| 3 | headPass | Headed pass (Q3). Distinct from
|
|
15
|
+
| 3 | headPass | Headed pass (Q3). Distinct from Q15, the headed shot qualifier. |
|
|
12
16
|
| 4 | throughBall | Through ball (Q4). Do not confuse with Q5 free-kick delivery. |
|
|
13
|
-
| 5 | freeKickTaken | Free kick pass / free-kick delivery (Q5). |
|
|
17
|
+
| 5 | freeKickTaken | Free kick pass / free-kick delivery (Q5), direct or indirect. |
|
|
14
18
|
| 6 | cornerTaken | Corner kick / corner delivery (Q6). |
|
|
15
|
-
| 7 | goalKick | Goal kick in the F24 spec. Some JSON/event-stream exports use qualifier 124 for goal-kick passes instead. |
|
|
16
19
|
| 107 | throwIn | Throw-in |
|
|
17
|
-
| 124 | goalKick | Goal kick pass
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
+
| 124 | goalKick | Goal kick pass. For goal-kick distribution charts, combine with pass end coordinates Q140/Q141. |
|
|
21
|
+
| 279 | kickOff | Kick-off pass. Value `S` is the kick-off that starts a period; `G` is the kick-off after a goal. |
|
|
22
|
+
| 7 | playersCaughtOffside | On an offside pass (typeId 2). The value is the ID of the player caught offside. It is not a goal-kick flag; goal kicks are Q124. |
|
|
23
|
+
| 154 | intentionalAssist | Pass that creates a scoring chance, for example a cross into the box or a through ball |
|
|
24
|
+
| 210 | assist | The pass set up a shot, a goal or a missed chance |
|
|
20
25
|
| 196 | switchOfPlay | Pass crossing centre zone, y-distance > 60 |
|
|
26
|
+
| 212 | length | Estimated distance in metres that the ball travelled on the pass or clearance |
|
|
27
|
+
| 213 | angle | Direction of the pass or clearance relative to the direction of play, in radians (0.00 to 6.28) |
|
|
21
28
|
|
|
22
29
|
## Location Qualifiers
|
|
23
30
|
|
|
@@ -25,37 +32,44 @@ Qualifiers add context to events. Each event has a `qualifier[]` array where eac
|
|
|
25
32
|
|----|------|------------|-------|
|
|
26
33
|
| 140 | passEndX | number (0-100) | Pass destination X coordinate |
|
|
27
34
|
| 141 | passEndY | number (0-100) | Pass destination Y coordinate |
|
|
28
|
-
| 20 | involvedPlayer | player ID | Other player involved in the event |
|
|
29
35
|
|
|
30
36
|
## Shot Qualifiers
|
|
31
37
|
|
|
32
38
|
| ID | Name | Notes |
|
|
33
39
|
|----|------|-------|
|
|
34
40
|
| 15 | head | Headed shot/goal |
|
|
35
|
-
| 20 | rightFoot
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
| 22 |
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
41
|
+
| 20 | rightFoot | Right-footed shot |
|
|
42
|
+
| 72 | leftFoot | Left-footed shot |
|
|
43
|
+
| 21 | otherBodyPart | Knee, chest, etc. |
|
|
44
|
+
| 22 | regularPlay | The event happened in open play, not from a set play |
|
|
45
|
+
| 24 | setPiece | The event followed a free kick that was not struck directly. A shot struck directly from a free kick is Q26 |
|
|
46
|
+
| 25 | fromCorner | Shot followed a corner |
|
|
47
|
+
| 26 | freeKick | Shot struck directly from a free kick |
|
|
48
|
+
| 29 | assisted | A team-mate's pass set up the shot or chance |
|
|
49
|
+
| 160 | throwInSetPiece | The shot or pass came from a throw-in set piece |
|
|
50
|
+
| 214 | bigChance | Big chance: a clear-cut chance the player should score, such as a one-on-one |
|
|
51
|
+
| 9 | penalty | Penalty taken, or penalty awarded (on a foul, typeId 4) |
|
|
52
|
+
| 108 | volley | Volley: the ball did not bounce before the shot |
|
|
53
|
+
| 328 | firstTouch | Shot struck first time, without a controlling touch |
|
|
54
|
+
| 263 | directCorner | Shot or goal directly from a corner (Olimpico) |
|
|
55
|
+
| 136 | keeperTouched | Goal where the goalkeeper got a touch on the ball |
|
|
56
|
+
| 82 | blocked | The shot was blocked |
|
|
57
|
+
| 146 | blockedX | X coordinate where the shot was blocked, or where an opponent touched an off-target shot |
|
|
58
|
+
| 147 | blockedY | Y coordinate for the same point as Q146 |
|
|
59
|
+
|
|
60
|
+
Qualifiers 16-19 and 60-71 are pitch zones for the shot location (for example 16
|
|
61
|
+
small box centre, 17 box centre, 18 out of box centre, 19 35+ centre). See
|
|
62
|
+
charting-shot-placement for the full zone list.
|
|
49
63
|
|
|
50
64
|
## Goal Qualifiers
|
|
51
65
|
|
|
52
66
|
| ID | Name | Notes |
|
|
53
67
|
|----|------|-------|
|
|
54
|
-
| 28 | ownGoal | Own goal. contestantId is the team that scored it; credit opposing team |
|
|
55
|
-
| 280 |
|
|
56
|
-
| 8 | goalDisallowed |
|
|
57
|
-
| 102 | goalMouthY | Y coord in goal mouth
|
|
58
|
-
| 103 | goalMouthZ | Z coord / height in goal mouth
|
|
68
|
+
| 28 | ownGoal | Own goal. contestantId is the team that scored it; credit the opposing team. Own-goal coordinates are near the defending end, so exclude or reattribute them before shot-distance analysis. |
|
|
69
|
+
| 280 | fantasyAssistType | Fantasy assist type on a goal, as a string (open data shows values such as `PENALTY_WON`, `HANDBALL_WON`, `PASS_LOST` and `BLOCKED_SHOT`). It is not an own-goal flag; use Q28. |
|
|
70
|
+
| 8 | goalDisallowed | On a pass (typeId 2): the pass led to a goal that was disallowed for a foul or offside. It is not a flag on goal events. |
|
|
71
|
+
| 102 | goalMouthY | Y coord in goal mouth; the posts are at 45.2 and 54.8 |
|
|
72
|
+
| 103 | goalMouthZ | Z coord / height in goal mouth; 0 is the ground and the crossbar is at 38 |
|
|
59
73
|
|
|
60
74
|
### Goal Mouth Zones (F24 Appendix 12)
|
|
61
75
|
|
|
@@ -75,34 +89,35 @@ Qualifiers add context to events. Each event has a `qualifier[]` array where eac
|
|
|
75
89
|
| 321 | expectedGoals | xG value (on `matchexpectedgoals` endpoint only, NOT on standard `matchevent`) |
|
|
76
90
|
| 322 | expectedGoalsOnTarget | xGOT value (on `matchexpectedgoals` endpoint only) |
|
|
77
91
|
|
|
78
|
-
**Important:**
|
|
92
|
+
**Important:** Qualifier 213 is the pass angle, not xG. Use qualifiers 321/322 from the separate `matchexpectedgoals` endpoint for xG.
|
|
79
93
|
|
|
80
94
|
## Context Qualifiers
|
|
81
95
|
|
|
82
96
|
| ID | Name | Notes |
|
|
83
97
|
|----|------|-------|
|
|
98
|
+
| 30 | involved | Player (or coach) IDs as a list, on team set-up and formation-change events |
|
|
99
|
+
| 44 | playerPosition | Player positions in the team formation, on set-up, formation-change and substitution events |
|
|
84
100
|
| 130 | teamFormation | Formation ID (on lineup events) |
|
|
85
101
|
| 131 | teamPlayerFormation | Player positions 1-11 (on lineup events) |
|
|
86
102
|
| 145 | formationSlot | Formation position of player coming on (1-11) |
|
|
87
103
|
| 59 | jerseyNumber | Shirt number of player(s), shown for substitutions, lineups, and lineup changes |
|
|
88
104
|
| 194 | captain | Player ID of the team captain |
|
|
89
|
-
| 214 | length | Estimated metres ball travelled |
|
|
90
105
|
| 292 | detailedPositionId | Granular position on sub-on events (1-10) |
|
|
91
|
-
| 364 |
|
|
106
|
+
| 364 | VARDelay | VAR delay marker on a start delay event (typeId 27) |
|
|
92
107
|
|
|
93
108
|
## Card Qualifiers
|
|
94
109
|
|
|
95
110
|
| ID | Name | Notes |
|
|
96
111
|
|----|------|-------|
|
|
97
|
-
| 31 |
|
|
98
|
-
| 32 |
|
|
112
|
+
| 31 | yellowCard | Yellow card |
|
|
113
|
+
| 32 | secondYellow | Second yellow card |
|
|
99
114
|
| 33 | redCard | Straight red card |
|
|
100
115
|
|
|
101
|
-
##
|
|
116
|
+
## Goalkeeper Position Qualifiers
|
|
102
117
|
|
|
103
118
|
| ID | Name | Notes |
|
|
104
119
|
|----|------|-------|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
120
|
+
| 230 | gkX | Goalkeeper's X position for the shot (post, goal and, for some competitions, other shots) |
|
|
121
|
+
| 231 | gkY | Goalkeeper's Y position for the shot |
|
|
122
|
+
| 395 | gkXAtGoal | Goalkeeper's X position when the ball crossed the line for a goal (post-match) |
|
|
123
|
+
| 396 | gkYAtGoal | Goalkeeper's Y position when the ball crossed the line for a goal (post-match) |
|
package/package.json
CHANGED