football-docs 0.12.1 → 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 +16 -3
- package/data/docs.db +0 -0
- package/dist/crawl.d.ts +55 -0
- package/dist/crawl.js +231 -0
- package/dist/ingest.d.ts +1 -1
- package/dist/ingest.js +4 -1
- package/dist/tools.js +27 -6
- 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/docs/sportradar/api-access.md +10 -0
- package/docs/sportradar/api-endpoints.md +0 -14
- package/docs/sportradar/monitoring-data-changes.md +310 -0
- package/docs/sportradar/soccer-api-vs-soccer-extended-api.md +194 -0
- package/docs/sportradar/soccer-extended-competition-info.md +23 -0
- package/docs/sportradar/soccer-extended-competition-seasons.md +31 -0
- package/docs/sportradar/soccer-extended-competitions.md +39 -0
- package/docs/sportradar/soccer-extended-competitor-mappings.md +27 -0
- package/docs/sportradar/soccer-extended-competitor-merge-mappings.md +28 -0
- package/docs/sportradar/soccer-extended-competitor-profile.md +115 -0
- package/docs/sportradar/soccer-extended-competitor-schedules.md +219 -0
- package/docs/sportradar/soccer-extended-competitor-summaries.md +150 -0
- package/docs/sportradar/soccer-extended-competitor-vs-competitor.md +39 -0
- package/docs/sportradar/soccer-extended-daily-schedules.md +23 -0
- package/docs/sportradar/soccer-extended-daily-summaries.md +23 -0
- package/docs/sportradar/soccer-extended-faq.md +1332 -0
- package/docs/sportradar/soccer-extended-fifa-rankings.md +56 -0
- package/docs/sportradar/soccer-extended-league-timeline.md +116 -0
- package/docs/sportradar/soccer-extended-live-schedules.md +23 -0
- package/docs/sportradar/soccer-extended-live-summaries.md +23 -0
- package/docs/sportradar/soccer-extended-live-timelines-delta.md +58 -0
- package/docs/sportradar/soccer-extended-live-timelines.md +65 -0
- package/docs/sportradar/soccer-extended-overview.md +241 -0
- package/docs/sportradar/soccer-extended-player-mappings.md +27 -0
- package/docs/sportradar/soccer-extended-player-merge-mappings.md +28 -0
- package/docs/sportradar/soccer-extended-player-profile.md +64 -0
- package/docs/sportradar/soccer-extended-player-schedules.md +23 -0
- package/docs/sportradar/soccer-extended-player-summaries.md +23 -0
- package/docs/sportradar/soccer-extended-push-events.md +252 -0
- package/docs/sportradar/soccer-extended-push-feeds.md +129 -0
- package/docs/sportradar/soccer-extended-push-statistics.md +258 -0
- package/docs/sportradar/soccer-extended-season-competitors.md +34 -0
- package/docs/sportradar/soccer-extended-season-form-standings.md +59 -0
- package/docs/sportradar/soccer-extended-season-info.md +146 -0
- package/docs/sportradar/soccer-extended-season-leaders.md +46 -0
- package/docs/sportradar/soccer-extended-season-lineups.md +86 -0
- package/docs/sportradar/soccer-extended-season-links.md +53 -0
- package/docs/sportradar/soccer-extended-season-missing-players.md +45 -0
- package/docs/sportradar/soccer-extended-season-overunder-statistics.md +36 -0
- package/docs/sportradar/soccer-extended-season-players.md +34 -0
- package/docs/sportradar/soccer-extended-season-schedule.md +50 -0
- package/docs/sportradar/soccer-extended-season-standings.md +77 -0
- package/docs/sportradar/soccer-extended-season-summaries.md +23 -0
- package/docs/sportradar/soccer-extended-season-transfers.md +61 -0
- package/docs/sportradar/soccer-extended-season-venues.md +31 -0
- package/docs/sportradar/soccer-extended-seasonal-competitor-extended-stati.md +398 -0
- package/docs/sportradar/soccer-extended-seasonal-competitor-players.md +48 -0
- package/docs/sportradar/soccer-extended-seasonal-competitor-statistics.md +143 -0
- package/docs/sportradar/soccer-extended-seasons-disabled.md +44 -0
- package/docs/sportradar/soccer-extended-seasons.md +32 -0
- package/docs/sportradar/soccer-extended-sport-event-extended-summary.md +712 -0
- package/docs/sportradar/soccer-extended-sport-event-extended-timeline.md +126 -0
- package/docs/sportradar/soccer-extended-sport-event-fun-facts.md +26 -0
- package/docs/sportradar/soccer-extended-sport-event-insights.md +32 -0
- package/docs/sportradar/soccer-extended-sport-event-lineups.md +23 -0
- package/docs/sportradar/soccer-extended-sport-event-momentum.md +39 -0
- package/docs/sportradar/soccer-extended-sport-event-summary.md +23 -0
- package/docs/sportradar/soccer-extended-sport-event-timeline.md +71 -0
- package/docs/sportradar/soccer-extended-sport-events-created.md +28 -0
- package/docs/sportradar/soccer-extended-sport-events-removed.md +27 -0
- package/docs/sportradar/soccer-extended-sport-events-updated.md +28 -0
- package/docs/sportradar/soccer-ig-api-basics.md +248 -0
- package/docs/sportradar/soccer-ig-data-coverage-tiers.md +399 -0
- package/docs/sportradar/soccer-ig-fixtures.md +1193 -0
- package/docs/sportradar/soccer-ig-historical-data.md +596 -0
- package/docs/sportradar/soccer-ig-id-handling.md +991 -0
- package/docs/sportradar/soccer-ig-live-match-retrieval.md +1078 -0
- package/docs/sportradar/soccer-ig-match-status-workflow.md +777 -0
- package/docs/sportradar/soccer-ig-overview.md +30 -0
- package/docs/sportradar/soccer-ig-push.md +515 -0
- package/docs/sportradar/soccer-ig-rosters-lineups-transfers.md +1400 -0
- package/docs/sportradar/soccer-ig-scenarios.md +17 -0
- package/docs/sportradar/soccer-ig-seasonal-stats.md +798 -0
- package/docs/sportradar/soccer-ig-tracking-standings.md +725 -0
- package/docs/sportradar/soccer-ig-tracking-tournaments.md +408 -0
- package/docs/sportradar/soccer-ig-update-frequencies.md +1313 -0
- package/package.json +3 -2
- package/providers.json +24 -7
package/README.md
CHANGED
|
@@ -119,12 +119,12 @@ 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 |
|
|
126
126
|
| FMDB Pro | 37 | api-access, api-endpoints, data-model, identity-surfaces, data-provenance |
|
|
127
|
-
| Sportradar |
|
|
127
|
+
| Sportradar | 480 | integration guide (API basics, coverage tiers, ID handling, match status, update frequencies, push, historical data), Soccer Extended v4 endpoint reference with data-point tables, FAQ, plus curated api-access, api-endpoints, data-model, charting-and-stories, integration-notes, data-provenance |
|
|
128
128
|
| socceraction | 34 | SPADL format, VAEP, Expected Threat |
|
|
129
129
|
| BeSoccer | 16 | api-access, api-endpoints, data-provenance |
|
|
130
130
|
| Driblab | 32 | api-access, api-endpoints, data-model, 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
|
|
@@ -180,6 +180,12 @@ Reep's snapshots age weekly, as a new release is cut each week. Run
|
|
|
180
180
|
`python3 scripts/check_reep_live.py` to check every download link and list what
|
|
181
181
|
has changed since the snapshots; the refresh steps are in [specs/README.md](specs/README.md#reep).
|
|
182
182
|
|
|
183
|
+
`pnpm check:upstream` runs every upstream check in one report: pinned package
|
|
184
|
+
versions against PyPI, npm and GitHub, each spec snapshot against its public URL,
|
|
185
|
+
BeSoccer's and Driblab's truth regenerated from their Postman collection and Notion
|
|
186
|
+
page, and the free-source and Reep live checks below. It runs by hand, never in CI, and
|
|
187
|
+
lists what to review.
|
|
188
|
+
|
|
183
189
|
Free sources have no spec, and they tend to fail quietly: a page still answers
|
|
184
190
|
200 after the data has gone. Run `python3 scripts/check_free_sources_live.py` to
|
|
185
191
|
request each access path documented in `docs/free-sources/` and check that the
|
|
@@ -230,6 +236,8 @@ Contributions are welcome from everyone. There are three ways to help:
|
|
|
230
236
|
|
|
231
237
|
Provider doc sources are tracked in `providers.json`. The crawl pipeline discovers the best doc source (llms.txt > ReadTheDocs > GitHub README) and writes markdown with provenance frontmatter.
|
|
232
238
|
|
|
239
|
+
Two registry fields narrow a crawl. `llms_indexes` lists llms.txt files that link to pages rather than contain them; the crawler follows those links (and nested indexes) to each page's markdown copy instead of running discovery. Sportradar uses it for its integration guide and Soccer Extended reference. `exclude_categories` skips whole pages, and `exclude_sections` drops named `##`/`###` sections from pages that are otherwise kept, for content INCLUSION.md keeps out, such as odds. Pages crawled through an index are not byte-for-byte copies: the crawler drops the OpenAPI definition ReadMe appends and SVG diagrams, cuts example payloads over 3 KB with a note, replaces a data-point table repeated from an earlier page with a line naming that page, and marks a split long section "(continued)". It adds no other text.
|
|
240
|
+
|
|
233
241
|
```bash
|
|
234
242
|
npm run discover # probe sources without crawling
|
|
235
243
|
npm run crawl # crawl all providers with sources
|
|
@@ -246,6 +254,11 @@ Each crawled doc carries provenance metadata (source URL, source type, upstream
|
|
|
246
254
|
`v*` tag and does the rest: it re-runs the full check suite, creates the GitHub
|
|
247
255
|
Release, and publishes to npm.
|
|
248
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
|
+
|
|
249
262
|
```bash
|
|
250
263
|
# 1. Bump the version in package.json and server.json (three fields in total).
|
|
251
264
|
# Land it on main through a pull request, as `chore: release vX.Y.Z`.
|
package/data/docs.db
CHANGED
|
Binary file
|
package/dist/crawl.d.ts
CHANGED
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
* paraphrase, summarise, or interpret. The content in the output files should
|
|
9
9
|
* be directly traceable to the source URL.
|
|
10
10
|
*
|
|
11
|
+
* One exception, for pages reached through an llms.txt index (llms_indexes):
|
|
12
|
+
* the crawler removes markup and bulk, and marks each removal in the text.
|
|
13
|
+
* It drops the OpenAPI definition ReadMe appends and SVG diagrams, cuts long
|
|
14
|
+
* example payloads with a note, replaces a data-point table repeated from an
|
|
15
|
+
* earlier page with a line naming that page, and repeats a heading with
|
|
16
|
+
* "(continued)" where it splits a long section. Every sentence that remains is
|
|
17
|
+
* the source's own.
|
|
18
|
+
*
|
|
11
19
|
* Usage:
|
|
12
20
|
* npm run crawl # crawl all providers with sources
|
|
13
21
|
* npm run crawl -- --provider kloppy # crawl one provider
|
|
@@ -37,5 +45,52 @@ export declare function applyCategoryExclusions<T extends {
|
|
|
37
45
|
* Already structured for LLM consumption — chunk by top-level heading.
|
|
38
46
|
*/
|
|
39
47
|
export declare function crawlLlmsTxt(content: string, sourceUrl: string): CrawledDoc[];
|
|
48
|
+
/**
|
|
49
|
+
* Read the links out of an llms.txt index. Page links point at a page's
|
|
50
|
+
* markdown copy (`.md`); index links point at a further `llms.txt`. Links to
|
|
51
|
+
* another host are ignored, so an index cannot send the crawl off-site.
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseLlmsIndex(content: string, indexUrl: string): {
|
|
54
|
+
pages: string[];
|
|
55
|
+
indexes: string[];
|
|
56
|
+
};
|
|
57
|
+
/** The category a page is stored under: the last path segment, without `.md`. */
|
|
58
|
+
export declare function llmsPageCategory(pageUrl: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Turn a ReadMe-hosted page's markdown copy into plain markdown.
|
|
61
|
+
*
|
|
62
|
+
* ReadMe appends the endpoint's full OpenAPI definition to every reference page;
|
|
63
|
+
* the spec is mirrored separately (specs/), so everything from that heading on is
|
|
64
|
+
* dropped. Accordions become `###` headings, because their titles are where one
|
|
65
|
+
* data-point table ends and the next begins. Other MDX components and list markup
|
|
66
|
+
* are unwrapped to their text. Long example payloads are cut to their opening.
|
|
67
|
+
*/
|
|
68
|
+
export declare function cleanLlmsPage(text: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Split any `##`/`###` section longer than `max` at paragraph breaks, repeating
|
|
71
|
+
* its heading with "(continued)" so each piece is still a searchable section.
|
|
72
|
+
*/
|
|
73
|
+
export declare function splitOversizedSections(text: string, max?: number): string;
|
|
74
|
+
/**
|
|
75
|
+
* Reference pages repeat the same data-point tables (the competition, the
|
|
76
|
+
* season, the venue) on every endpoint that returns them. Keep the first copy
|
|
77
|
+
* of each `###` section and replace later identical copies with one line per
|
|
78
|
+
* page naming where the table is.
|
|
79
|
+
*/
|
|
80
|
+
export declare function dedupeSharedSections<T extends {
|
|
81
|
+
category: string;
|
|
82
|
+
content: string;
|
|
83
|
+
}>(docs: T[]): T[];
|
|
84
|
+
/**
|
|
85
|
+
* Drop each `##`/`###` section whose heading is listed, with any deeper
|
|
86
|
+
* sections nested under it. Headings match case-insensitively.
|
|
87
|
+
*/
|
|
88
|
+
export declare function dropSections(text: string, headings: string[] | undefined): string;
|
|
89
|
+
/**
|
|
90
|
+
* Crawl the pages listed by one or more llms.txt indexes, following nested
|
|
91
|
+
* indexes. Excluded categories are skipped before they are fetched, and
|
|
92
|
+
* excluded sections are dropped from the pages that are kept.
|
|
93
|
+
*/
|
|
94
|
+
export declare function crawlLlmsIndexes(indexUrls: string[], excluded: string[] | undefined, fetcher?: (url: string) => Promise<string | null>, pauseMs?: number, excludedSections?: string[]): Promise<CrawledDoc[]>;
|
|
40
95
|
export declare function slugify(text: string): string;
|
|
41
96
|
export {};
|
package/dist/crawl.js
CHANGED
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
* paraphrase, summarise, or interpret. The content in the output files should
|
|
9
9
|
* be directly traceable to the source URL.
|
|
10
10
|
*
|
|
11
|
+
* One exception, for pages reached through an llms.txt index (llms_indexes):
|
|
12
|
+
* the crawler removes markup and bulk, and marks each removal in the text.
|
|
13
|
+
* It drops the OpenAPI definition ReadMe appends and SVG diagrams, cuts long
|
|
14
|
+
* example payloads with a note, replaces a data-point table repeated from an
|
|
15
|
+
* earlier page with a line naming that page, and repeats a heading with
|
|
16
|
+
* "(continued)" where it splits a long section. Every sentence that remains is
|
|
17
|
+
* the source's own.
|
|
18
|
+
*
|
|
11
19
|
* Usage:
|
|
12
20
|
* npm run crawl # crawl all providers with sources
|
|
13
21
|
* npm run crawl -- --provider kloppy # crawl one provider
|
|
@@ -336,6 +344,215 @@ export function crawlLlmsTxt(content, sourceUrl) {
|
|
|
336
344
|
}
|
|
337
345
|
return sections;
|
|
338
346
|
}
|
|
347
|
+
// ── llms.txt indexes ────────────────────────────────────────────────
|
|
348
|
+
/** Most pages a single llms.txt index crawl will fetch. */
|
|
349
|
+
const LLMS_INDEX_MAX_PAGES = 200;
|
|
350
|
+
/** A code fence longer than this is cut, with a note of how much was dropped. */
|
|
351
|
+
const MAX_FENCE_CHARS = 3000;
|
|
352
|
+
/** A section longer than this is split, so no chunk swamps an agent's context. */
|
|
353
|
+
const MAX_SECTION_CHARS = 30000;
|
|
354
|
+
/** A repeated section shorter than this is left in place; it costs little. */
|
|
355
|
+
const MIN_SHARED_SECTION_CHARS = 300;
|
|
356
|
+
/**
|
|
357
|
+
* Read the links out of an llms.txt index. Page links point at a page's
|
|
358
|
+
* markdown copy (`.md`); index links point at a further `llms.txt`. Links to
|
|
359
|
+
* another host are ignored, so an index cannot send the crawl off-site.
|
|
360
|
+
*/
|
|
361
|
+
export function parseLlmsIndex(content, indexUrl) {
|
|
362
|
+
const host = new URL(indexUrl).hostname;
|
|
363
|
+
const pages = [];
|
|
364
|
+
const indexes = [];
|
|
365
|
+
for (const match of content.matchAll(/\]\((https?:\/\/[^)\s]+)\)/g)) {
|
|
366
|
+
let url;
|
|
367
|
+
try {
|
|
368
|
+
url = new URL(match[1]);
|
|
369
|
+
}
|
|
370
|
+
catch {
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
if (url.hostname !== host)
|
|
374
|
+
continue;
|
|
375
|
+
url.hash = "";
|
|
376
|
+
if (url.pathname.endsWith("/llms.txt"))
|
|
377
|
+
indexes.push(url.href);
|
|
378
|
+
else if (url.pathname.endsWith(".md"))
|
|
379
|
+
pages.push(url.href);
|
|
380
|
+
}
|
|
381
|
+
return { pages: [...new Set(pages)], indexes: [...new Set(indexes)] };
|
|
382
|
+
}
|
|
383
|
+
/** The category a page is stored under: the last path segment, without `.md`. */
|
|
384
|
+
export function llmsPageCategory(pageUrl) {
|
|
385
|
+
const segment = new URL(pageUrl).pathname.split("/").pop() ?? "";
|
|
386
|
+
return slugify(segment.replace(/\.md$/, ""));
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Turn a ReadMe-hosted page's markdown copy into plain markdown.
|
|
390
|
+
*
|
|
391
|
+
* ReadMe appends the endpoint's full OpenAPI definition to every reference page;
|
|
392
|
+
* the spec is mirrored separately (specs/), so everything from that heading on is
|
|
393
|
+
* dropped. Accordions become `###` headings, because their titles are where one
|
|
394
|
+
* data-point table ends and the next begins. Other MDX components and list markup
|
|
395
|
+
* are unwrapped to their text. Long example payloads are cut to their opening.
|
|
396
|
+
*/
|
|
397
|
+
export function cleanLlmsPage(text) {
|
|
398
|
+
let out = text.replace(/^---\n[\s\S]*?\n---\n/, "");
|
|
399
|
+
out = out.split(/\n# OpenAPI definition\b/)[0];
|
|
400
|
+
out = out.replace(/^Fetch the complete documentation index.*\n/m, "");
|
|
401
|
+
out = out.replace(/<HTMLBlock>\{`([\s\S]*?)`\}<\/HTMLBlock>/g, (_m, html) => html.includes("<svg")
|
|
402
|
+
? "_(Diagram omitted: see the source page.)_"
|
|
403
|
+
: html.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim());
|
|
404
|
+
out = out.replace(/<Accordion\b[^>]*\btitle="([^"]+)"[^>]*>/g, (_m, title) => `### ${title}`);
|
|
405
|
+
out = out.replace(/<li\b[^>]*>([\s\S]*?)<\/li>/g, (_m, item) => `- ${item.replace(/<[^>]+>/g, "").trim()}`);
|
|
406
|
+
out = out.replace(/<\/?(?:AccordionGroup|Accordion|Callout|Tabs|Tab|Cards|Card|Columns|Column|Anchor|Image|Embed|Recipe|Glossary|div|ul|ol|span)\b[^>]*>/g, "");
|
|
407
|
+
out = out.replace(/\n[ \t]+- /g, "\n- ");
|
|
408
|
+
out = out.replace(/```(\w*)\n[\s\S]*?\n```/g, (fence, lang) => {
|
|
409
|
+
if (fence.length <= MAX_FENCE_CHARS)
|
|
410
|
+
return fence;
|
|
411
|
+
const kept = fence.slice(lang.length + 4, MAX_FENCE_CHARS).trimEnd();
|
|
412
|
+
const kb = Math.round(fence.length / 1024);
|
|
413
|
+
return `\`\`\`${lang}\n${kept}\n... (example cut here; ${kb} KB in the source page)\n\`\`\``;
|
|
414
|
+
});
|
|
415
|
+
return `${out.replace(/\n{3,}/g, "\n\n").trim()}\n`;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Split any `##`/`###` section longer than `max` at paragraph breaks, repeating
|
|
419
|
+
* its heading with "(continued)" so each piece is still a searchable section.
|
|
420
|
+
*/
|
|
421
|
+
export function splitOversizedSections(text, max = MAX_SECTION_CHARS) {
|
|
422
|
+
const sections = text.split(/(?=^#{2,3} )/m);
|
|
423
|
+
return sections
|
|
424
|
+
.map((section) => {
|
|
425
|
+
if (section.length <= max)
|
|
426
|
+
return section;
|
|
427
|
+
const heading = section.match(/^(#{2,3}) (.+)\n/);
|
|
428
|
+
const level = heading?.[1] ?? "###";
|
|
429
|
+
const title = heading?.[2] ?? "Section";
|
|
430
|
+
const pieces = [];
|
|
431
|
+
let current = "";
|
|
432
|
+
for (const paragraph of section.split(/\n\n/)) {
|
|
433
|
+
const insideFence = (current.match(/^```/gm)?.length ?? 0) % 2 === 1;
|
|
434
|
+
if (current && !insideFence && current.length + paragraph.length > max) {
|
|
435
|
+
pieces.push(current);
|
|
436
|
+
current = `${level} ${title} (continued)\n\n`;
|
|
437
|
+
}
|
|
438
|
+
current += `${paragraph}\n\n`;
|
|
439
|
+
}
|
|
440
|
+
pieces.push(current);
|
|
441
|
+
return pieces.join("");
|
|
442
|
+
})
|
|
443
|
+
.join("");
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Reference pages repeat the same data-point tables (the competition, the
|
|
447
|
+
* season, the venue) on every endpoint that returns them. Keep the first copy
|
|
448
|
+
* of each `###` section and replace later identical copies with one line per
|
|
449
|
+
* page naming where the table is.
|
|
450
|
+
*/
|
|
451
|
+
export function dedupeSharedSections(docs) {
|
|
452
|
+
const firstSeen = new Map();
|
|
453
|
+
return docs.map((doc) => {
|
|
454
|
+
const kept = [];
|
|
455
|
+
const shared = [];
|
|
456
|
+
for (const section of doc.content.split(/(?=^#{2,3} )/m)) {
|
|
457
|
+
const heading = section.match(/^### (.+)\n/);
|
|
458
|
+
if (heading) {
|
|
459
|
+
const body = section.slice(heading[0].length).replace(/\s+/g, " ").trim();
|
|
460
|
+
const key = `${heading[1]}\u0000${body}`;
|
|
461
|
+
const owner = firstSeen.get(key);
|
|
462
|
+
if (body.length >= MIN_SHARED_SECTION_CHARS && owner && owner !== doc.category) {
|
|
463
|
+
shared.push(`${heading[1]} (\`${owner}\`)`);
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
if (!owner)
|
|
467
|
+
firstSeen.set(key, doc.category);
|
|
468
|
+
}
|
|
469
|
+
kept.push(section);
|
|
470
|
+
}
|
|
471
|
+
let content = kept.join("").trimEnd();
|
|
472
|
+
if (shared.length > 0) {
|
|
473
|
+
content += `\n\nAlso returns these data points, documented on the page named in brackets: ${shared.join(", ")}.`;
|
|
474
|
+
}
|
|
475
|
+
return { ...doc, content: `${content}\n` };
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Drop each `##`/`###` section whose heading is listed, with any deeper
|
|
480
|
+
* sections nested under it. Headings match case-insensitively.
|
|
481
|
+
*/
|
|
482
|
+
export function dropSections(text, headings) {
|
|
483
|
+
if (!headings?.length)
|
|
484
|
+
return text;
|
|
485
|
+
const drop = new Set(headings.map((h) => h.trim().toLowerCase()));
|
|
486
|
+
const kept = [];
|
|
487
|
+
let droppingLevel = 0;
|
|
488
|
+
let fenced = false;
|
|
489
|
+
for (const line of text.split("\n")) {
|
|
490
|
+
if (/^ {0,3}(`{3,}|~{3,})/.test(line))
|
|
491
|
+
fenced = !fenced;
|
|
492
|
+
const heading = fenced ? null : line.match(/^(#{2,3}) (.+?)\s*$/);
|
|
493
|
+
if (heading) {
|
|
494
|
+
const level = heading[1].length;
|
|
495
|
+
if (droppingLevel && level <= droppingLevel)
|
|
496
|
+
droppingLevel = 0;
|
|
497
|
+
if (!droppingLevel && drop.has(heading[2].toLowerCase()))
|
|
498
|
+
droppingLevel = level;
|
|
499
|
+
}
|
|
500
|
+
if (!droppingLevel)
|
|
501
|
+
kept.push(line);
|
|
502
|
+
}
|
|
503
|
+
return kept.join("\n");
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Crawl the pages listed by one or more llms.txt indexes, following nested
|
|
507
|
+
* indexes. Excluded categories are skipped before they are fetched, and
|
|
508
|
+
* excluded sections are dropped from the pages that are kept.
|
|
509
|
+
*/
|
|
510
|
+
export async function crawlLlmsIndexes(indexUrls, excluded, fetcher = fetchText, pauseMs = 250, excludedSections) {
|
|
511
|
+
const skip = new Set(excluded ?? []);
|
|
512
|
+
const pageUrls = [];
|
|
513
|
+
const queue = [...indexUrls];
|
|
514
|
+
const visited = new Set();
|
|
515
|
+
while (queue.length > 0) {
|
|
516
|
+
const indexUrl = queue.shift();
|
|
517
|
+
if (visited.has(indexUrl))
|
|
518
|
+
continue;
|
|
519
|
+
visited.add(indexUrl);
|
|
520
|
+
const content = await fetcher(indexUrl);
|
|
521
|
+
if (!content)
|
|
522
|
+
continue;
|
|
523
|
+
const { pages, indexes } = parseLlmsIndex(content, indexUrl);
|
|
524
|
+
pageUrls.push(...pages);
|
|
525
|
+
queue.push(...indexes);
|
|
526
|
+
}
|
|
527
|
+
const docs = [];
|
|
528
|
+
const categories = new Set();
|
|
529
|
+
for (const pageUrl of [...new Set(pageUrls)]) {
|
|
530
|
+
if (docs.length >= LLMS_INDEX_MAX_PAGES)
|
|
531
|
+
break;
|
|
532
|
+
const category = llmsPageCategory(pageUrl);
|
|
533
|
+
if (!category || skip.has(category) || categories.has(category))
|
|
534
|
+
continue;
|
|
535
|
+
if (pauseMs > 0)
|
|
536
|
+
await new Promise((done) => setTimeout(done, pauseMs));
|
|
537
|
+
const markdown = await fetcher(pageUrl);
|
|
538
|
+
if (!markdown)
|
|
539
|
+
continue;
|
|
540
|
+
const content = dropSections(cleanLlmsPage(markdown), excludedSections);
|
|
541
|
+
if (content.length < 100)
|
|
542
|
+
continue;
|
|
543
|
+
categories.add(category);
|
|
544
|
+
docs.push({
|
|
545
|
+
category,
|
|
546
|
+
content,
|
|
547
|
+
source_url: pageUrl.replace(/\.md$/, ""),
|
|
548
|
+
source_type: "llms_txt",
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
return dedupeSharedSections(docs).map((doc) => ({
|
|
552
|
+
...doc,
|
|
553
|
+
content: splitOversizedSections(doc.content),
|
|
554
|
+
}));
|
|
555
|
+
}
|
|
339
556
|
/**
|
|
340
557
|
* Crawl a documentation website by fetching linked pages from the index.
|
|
341
558
|
* Works with Sphinx/RTD, MkDocs, GitBook HTML, Docusaurus, and most
|
|
@@ -617,6 +834,20 @@ async function main() {
|
|
|
617
834
|
for (const [name, config] of Object.entries(targets)) {
|
|
618
835
|
if (!config)
|
|
619
836
|
continue;
|
|
837
|
+
if (config.llms_indexes?.length) {
|
|
838
|
+
console.log(`\n${name}: following ${config.llms_indexes.length} llms.txt index(es)`);
|
|
839
|
+
for (const url of config.llms_indexes)
|
|
840
|
+
console.log(` ${url}`);
|
|
841
|
+
if (discoverOnly)
|
|
842
|
+
continue;
|
|
843
|
+
const docs = await crawlLlmsIndexes(config.llms_indexes, config.exclude_categories, fetchText, 250, config.exclude_sections);
|
|
844
|
+
for (const doc of docs) {
|
|
845
|
+
writeCrawledDoc(name, doc, config.version);
|
|
846
|
+
console.log(` wrote ${name}/${doc.category}.md (${doc.content.length} chars) [${doc.source_type}]`);
|
|
847
|
+
}
|
|
848
|
+
console.log(` → ${docs.length} doc(s) written`);
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
620
851
|
const sources = config.sources
|
|
621
852
|
.filter((s) => !!s.url)
|
|
622
853
|
.map((s) => ({
|
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",
|
package/dist/tools.js
CHANGED
|
@@ -181,6 +181,27 @@ function searchRows(db, matchQuery, provider, limit) {
|
|
|
181
181
|
params.push(limit);
|
|
182
182
|
return db.prepare(sql).all(...params);
|
|
183
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* The strict query needs every term to match, so it finds the most specific
|
|
186
|
+
* chunks but can find very few. Keep its matches first, then fill the remaining
|
|
187
|
+
* slots from the relaxed query, skipping chunks already listed. Returning only
|
|
188
|
+
* the strict matches let one chunk that happened to contain every term crowd
|
|
189
|
+
* out the rest of the answer.
|
|
190
|
+
*/
|
|
191
|
+
function topUpRows(strict, relaxed, limit) {
|
|
192
|
+
const key = (row) => `${row.provider}\u0000${row.category}\u0000${row.title}\u0000${row.content}`;
|
|
193
|
+
const seen = new Set(strict.map(key));
|
|
194
|
+
const rows = [...strict];
|
|
195
|
+
for (const row of relaxed) {
|
|
196
|
+
if (rows.length >= limit)
|
|
197
|
+
break;
|
|
198
|
+
if (seen.has(key(row)))
|
|
199
|
+
continue;
|
|
200
|
+
seen.add(key(row));
|
|
201
|
+
rows.push(row);
|
|
202
|
+
}
|
|
203
|
+
return rows;
|
|
204
|
+
}
|
|
184
205
|
function compareRows(db, matchQuery, providers) {
|
|
185
206
|
let sql = `
|
|
186
207
|
SELECT d.provider, d.category, d.title, d.content,
|
|
@@ -327,8 +348,8 @@ export function getProviderDocs(db, args) {
|
|
|
327
348
|
const strictQuery = args.topic ? sanitiseFtsQuery(args.topic) : undefined;
|
|
328
349
|
const fallbackQuery = args.topic ? relaxedFtsQuery(args.topic) : undefined;
|
|
329
350
|
let rows = providerDocsRows(db, provider, strictQuery, category, limit);
|
|
330
|
-
if (rows.length
|
|
331
|
-
rows = providerDocsRows(db, provider, fallbackQuery, category, limit);
|
|
351
|
+
if (rows.length < limit && fallbackQuery && fallbackQuery !== strictQuery) {
|
|
352
|
+
rows = topUpRows(rows, providerDocsRows(db, provider, fallbackQuery, category, limit), limit);
|
|
332
353
|
}
|
|
333
354
|
if (rows.length === 0) {
|
|
334
355
|
return textResult(`No provider docs found for "${providerFilterLabel(args.provider, provider)}"${category ? ` in category "${category}"` : ""}${args.topic ? ` matching "${args.topic}"` : ""}. Call resolve_provider_id or list_providers to inspect available coverage.`);
|
|
@@ -353,8 +374,8 @@ export function searchDocs(db, args) {
|
|
|
353
374
|
}
|
|
354
375
|
}
|
|
355
376
|
let rows = searchRows(db, strictQuery, provider, limit);
|
|
356
|
-
if (rows.length
|
|
357
|
-
rows = searchRows(db, fallbackQuery, provider, limit);
|
|
377
|
+
if (rows.length < limit && fallbackQuery !== strictQuery) {
|
|
378
|
+
rows = topUpRows(rows, searchRows(db, fallbackQuery, provider, limit), limit);
|
|
358
379
|
}
|
|
359
380
|
if (rows.length === 0) {
|
|
360
381
|
const providerLabel = providerFilterLabel(args.provider, provider);
|
|
@@ -403,9 +424,9 @@ export function compareProviders(db, args) {
|
|
|
403
424
|
if (!providerSet.has(provider))
|
|
404
425
|
return [];
|
|
405
426
|
const strictRows = compareRowsForProvider(db, strictQuery, provider, 3);
|
|
406
|
-
if (strictRows.length
|
|
427
|
+
if (strictRows.length >= 3 || fallbackQuery === strictQuery)
|
|
407
428
|
return strictRows;
|
|
408
|
-
return compareRowsForProvider(db, fallbackQuery, provider, 3);
|
|
429
|
+
return topUpRows(strictRows, compareRowsForProvider(db, fallbackQuery, provider, 3), 3);
|
|
409
430
|
});
|
|
410
431
|
}
|
|
411
432
|
else {
|
|
@@ -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. |
|