football-docs 0.7.0 → 0.9.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.
Files changed (144) hide show
  1. package/README.md +53 -10
  2. package/data/docs.db +0 -0
  3. package/dist/crawl.js +125 -15
  4. package/dist/provider-truth.d.ts +152 -0
  5. package/dist/provider-truth.js +341 -0
  6. package/docs/besoccer/api-access.md +84 -0
  7. package/docs/besoccer/api-endpoints.md +131 -0
  8. package/docs/databallpy/data-model.md +6 -6
  9. package/docs/databallpy/overview.md +1 -1
  10. package/docs/fast-forward/api.md +605 -0
  11. package/docs/fast-forward/benchmarks.md +39 -0
  12. package/docs/fast-forward/concepts-coordinate-systems.md +129 -0
  13. package/docs/fast-forward/concepts-dataset.md +210 -0
  14. package/docs/fast-forward/concepts-distributed-compute.md +189 -0
  15. package/docs/fast-forward/concepts-filelike.md +56 -0
  16. package/docs/fast-forward/concepts-layouts.md +106 -0
  17. package/docs/fast-forward/concepts-orientations.md +90 -0
  18. package/docs/fast-forward/concepts-transformations.md +108 -0
  19. package/docs/fast-forward/getting-started.md +130 -0
  20. package/docs/fast-forward/index.md +129 -0
  21. package/docs/fast-forward/providers-cdf.md +60 -0
  22. package/docs/fast-forward/providers-gradientsports.md +65 -0
  23. package/docs/fast-forward/providers-hawkeye.md +104 -0
  24. package/docs/fast-forward/providers-optavision.md +62 -0
  25. package/docs/fast-forward/providers-respovision.md +74 -0
  26. package/docs/fast-forward/providers-scisports.md +58 -0
  27. package/docs/fast-forward/providers-secondspectrum.md +61 -0
  28. package/docs/fast-forward/providers-signality.md +78 -0
  29. package/docs/fast-forward/providers-skillcorner.md +86 -0
  30. package/docs/fast-forward/providers-sportec.md +58 -0
  31. package/docs/fast-forward/providers-statsperform.md +77 -0
  32. package/docs/fast-forward/providers-tracab.md +69 -0
  33. package/docs/fast-forward/providers.md +62 -0
  34. package/docs/fast-forward/reporting-issues.md +88 -0
  35. package/docs/fmdb-pro/api-access.md +2 -2
  36. package/docs/fotmob/identity-surfaces.md +1 -1
  37. package/docs/free-sources/fbref.md +17 -5
  38. package/docs/free-sources/overview.md +13 -4
  39. package/docs/kloppy/data-model.md +68 -43
  40. package/docs/kloppy/provider-mapping.md +30 -51
  41. package/docs/kloppy/usage.md +61 -49
  42. package/docs/mplsoccer/overview.md +1 -1
  43. package/docs/mplsoccer/pitch-types.md +3 -3
  44. package/docs/opta/api-access.md +6 -1
  45. package/docs/socceraction/spadl.md +16 -11
  46. package/docs/socceraction/vaep-xt.md +23 -6
  47. package/docs/soccerdata/data-sources.md +7 -42
  48. package/docs/soccerdata/overview.md +7 -6
  49. package/docs/soccerdata/usage.md +1 -1
  50. package/docs/sportmonks/api-access.md +18 -6
  51. package/docs/statsbomb/event-types.md +50 -32
  52. package/docs/thesportsdb/api-endpoints.md +8 -3
  53. package/docs/transferroom/api-endpoints.md +16 -5
  54. package/docs/unravelsports/additional-citations.md +60 -0
  55. package/docs/unravelsports/additional-license.md +54 -0
  56. package/docs/unravelsports/american-football-dataset.md +178 -0
  57. package/docs/unravelsports/american-football-graphs.md +193 -0
  58. package/docs/unravelsports/api-american-football.md +18 -0
  59. package/docs/unravelsports/api-classifiers.md +353 -0
  60. package/docs/unravelsports/api-soccer.md +26 -0
  61. package/docs/unravelsports/api-utils.md +24 -0
  62. package/docs/unravelsports/generated-unravel-utils-add-dummy-label-column.md +17 -0
  63. package/docs/unravelsports/generated-unravel-utils-add-graph-id-column.md +15 -0
  64. package/docs/unravelsports/generated-unravel-utils-dummy-graph-ids.md +17 -0
  65. package/docs/unravelsports/generated-unravel-utils-dummy-labels.md +17 -0
  66. package/docs/unravelsports/getting-started-concepts.md +215 -0
  67. package/docs/unravelsports/getting-started-installation.md +79 -0
  68. package/docs/unravelsports/getting-started-quickstart.md +175 -0
  69. package/docs/unravelsports/index.md +134 -0
  70. package/docs/unravelsports/soccer-dataset.md +398 -0
  71. package/docs/unravelsports/soccer-graphs.md +332 -0
  72. package/docs/unravelsports/soccer-models.md +467 -0
  73. package/docs/unravelsports/tutorials-american-football.md +179 -0
  74. package/docs/unravelsports/tutorials-formation-detection.md +212 -0
  75. package/docs/unravelsports/tutorials-pressing-intensity.md +198 -0
  76. package/docs/unravelsports/tutorials-soccer-gnn.md +327 -0
  77. package/docs/unravelsports/utils-features.md +53 -0
  78. package/docs/unravelsports/utils-helpers.md +79 -0
  79. package/docs/unravelsports/utils-objects.md +42 -0
  80. package/docs/wyscout/glossary-events.md +2 -2
  81. package/docs/wyscout/identity-surfaces.md +18 -14
  82. package/package.json +5 -2
  83. package/providers.json +53 -8
  84. package/docs/_reference/skillcorner-crunch-help/getting-started-api-access-dynamic-events.md +0 -134
  85. package/docs/_reference/skillcorner-crunch-help/getting-started-api-access-our-tracking-data.md +0 -160
  86. package/docs/_reference/skillcorner-crunch-help/getting-started-best-practice-analysis-guidance.md +0 -16
  87. package/docs/_reference/skillcorner-crunch-help/getting-started-dynamic-events-check.md +0 -33
  88. package/docs/_reference/skillcorner-crunch-help/getting-started-explore-game-intelligence-data-1.md +0 -37
  89. package/docs/_reference/skillcorner-crunch-help/getting-started-explore-game-intelligence-data.md +0 -29
  90. package/docs/_reference/skillcorner-crunch-help/getting-started-first-requests.md +0 -99
  91. package/docs/_reference/skillcorner-crunch-help/getting-started-generate-visual-reports.md +0 -90
  92. package/docs/_reference/skillcorner-crunch-help/getting-started-make-your-first-queries.md +0 -92
  93. package/docs/_reference/skillcorner-crunch-help/getting-started-off-ball-run-sportscode-xml.md +0 -32
  94. package/docs/_reference/skillcorner-crunch-help/getting-started-on-ball-engagement-video-definitio.md +0 -15
  95. package/docs/_reference/skillcorner-crunch-help/getting-started-python-retrieve-dynamic-events-fil.md +0 -102
  96. package/docs/_reference/skillcorner-crunch-help/getting-started-python-retrieve-game-intelligence-.md +0 -158
  97. package/docs/_reference/skillcorner-crunch-help/getting-started-python-sync-your-database-with-ski.md +0 -192
  98. package/docs/_reference/skillcorner-crunch-help/getting-started-run-detection-and-classification.md +0 -131
  99. package/docs/_reference/skillcorner-crunch-help/getting-started-skill-corner-tracking-data.md +0 -82
  100. package/docs/_reference/skillcorner-crunch-help/getting-started-skillcorner-python-client.md +0 -70
  101. package/docs/_reference/skillcorner-crunch-help/getting-started-using-skillcorner-api.md +0 -146
  102. package/docs/_reference/skillcorner-crunch-help/getting-started.md +0 -43
  103. package/docs/_reference/skillcorner-crunch-help/glossaries-coordinates-distance-speeds-and-directi.md +0 -149
  104. package/docs/_reference/skillcorner-crunch-help/glossaries-dynamic-events-csv-specifications.md +0 -15
  105. package/docs/_reference/skillcorner-crunch-help/glossaries-forward-momentum.md +0 -13
  106. package/docs/_reference/skillcorner-crunch-help/glossaries-game-intelligence-v2-metrics.md +0 -17
  107. package/docs/_reference/skillcorner-crunch-help/glossaries-in-possession-package-content.md +0 -19
  108. package/docs/_reference/skillcorner-crunch-help/glossaries-line-breaking-passes.md +0 -103
  109. package/docs/_reference/skillcorner-crunch-help/glossaries-off-ball-run-dynamic-events.md +0 -197
  110. package/docs/_reference/skillcorner-crunch-help/glossaries-overcoming-pressure.md +0 -105
  111. package/docs/_reference/skillcorner-crunch-help/glossaries-passing-metrics-1.md +0 -144
  112. package/docs/_reference/skillcorner-crunch-help/glossaries-passing-moment-frame-selection.md +0 -19
  113. package/docs/_reference/skillcorner-crunch-help/glossaries-peak-sprint-velocity.md +0 -26
  114. package/docs/_reference/skillcorner-crunch-help/glossaries-phases-of-play-video-definitions.md +0 -15
  115. package/docs/_reference/skillcorner-crunch-help/glossaries-physical-data-glossary.md +0 -127
  116. package/docs/_reference/skillcorner-crunch-help/glossaries-running-off-ball-metrics-1.md +0 -135
  117. package/docs/_reference/skillcorner-crunch-help/glossaries.md +0 -43
  118. package/docs/_reference/skillcorner-crunch-help/index.md +0 -33
  119. package/docs/_reference/skillcorner-crunch-help/models-general-concepts-pass-completion-probabilit.md +0 -15
  120. package/docs/_reference/skillcorner-crunch-help/models-general-concepts-passing-option.md +0 -30
  121. package/docs/_reference/skillcorner-crunch-help/models-general-concepts-physical-load-prediction-m.md +0 -63
  122. package/docs/_reference/skillcorner-crunch-help/models-general-concepts-pressure-detection.md +0 -46
  123. package/docs/_reference/skillcorner-crunch-help/models-general-concepts-pressure-intensity.md +0 -80
  124. package/docs/_reference/skillcorner-crunch-help/models-general-concepts-threat.md +0 -40
  125. package/docs/_reference/skillcorner-crunch-help/models-general-concepts.md +0 -37
  126. package/docs/_reference/skillcorner-crunch-help/product-updates-1-changelog-2025.md +0 -57
  127. package/docs/_reference/skillcorner-crunch-help/product-updates-1-game-intelligence-v2-migration.md +0 -64
  128. package/docs/_reference/skillcorner-crunch-help/product-updates-1-product-updates.md +0 -200
  129. package/docs/_reference/skillcorner-crunch-help/product-updates-1.md +0 -25
  130. package/docs/_reference/skillcorner-crunch-help/tool-box-api-data-version.md +0 -255
  131. package/docs/_reference/skillcorner-crunch-help/tool-box-data-availability.md +0 -55
  132. package/docs/_reference/skillcorner-crunch-help/tool-box-python-event-tracking-synchronization-1.md +0 -442
  133. package/docs/_reference/skillcorner-crunch-help/tool-box-python-event-tracking-synchronization.md +0 -276
  134. package/docs/_reference/skillcorner-crunch-help/tool-box-python-off-ball-runs-radar-plots.md +0 -69
  135. package/docs/_reference/skillcorner-crunch-help/tool-box-rule-based-event-synchronisation.md +0 -44
  136. package/docs/_reference/skillcorner-crunch-help/tool-box.md +0 -35
  137. package/docs/_reference/skillcorner-crunch-help/working-with-the-data-averaging-per-match-per-even.md +0 -179
  138. package/docs/_reference/skillcorner-crunch-help/working-with-the-data-benchmarking-normalisation.md +0 -27
  139. package/docs/_reference/skillcorner-crunch-help/working-with-the-data-data-quality-standards.md +0 -45
  140. package/docs/_reference/skillcorner-crunch-help/working-with-the-data-physical-data-glossary-1-1.md +0 -54
  141. package/docs/_reference/skillcorner-crunch-help/working-with-the-data-physical-data-glossary-1.md +0 -25
  142. package/docs/_reference/skillcorner-crunch-help/working-with-the-data-pitch-modelisation.md +0 -27
  143. package/docs/_reference/skillcorner-crunch-help/working-with-the-data-playing-time-info.md +0 -133
  144. package/docs/_reference/skillcorner-crunch-help/working-with-the-data.md +0 -43
@@ -0,0 +1,341 @@
1
+ /**
2
+ * Validate provider docs against ground truth introspected from the real package.
3
+ *
4
+ * Companion to scripts/gen_python_truth.py, which writes
5
+ * data/provider-truth/<provider>.json from an installed package. This module
6
+ * checks docs/<provider>/*.md against those facts and is run by the test suite,
7
+ * so a doc claiming a symbol or enum member that does not exist fails the build.
8
+ *
9
+ * Three checks, all chosen for precision over coverage:
10
+ *
11
+ * 1. Imports - every `from <package> import X` in a doc must resolve to a real
12
+ * symbol. This is what catches fabricated API surface.
13
+ * 2. Enum members - every SCREAMING_SNAKE token in a code span must belong to
14
+ * one of the package's enums, or be explicitly allowlisted below.
15
+ * 3. Literal arguments - every `param="value"` a doc writes must be a value that
16
+ * parameter's Literal annotation actually accepts. Checks 1 and 2
17
+ * both assume a vocabulary is made of identifiers; fast-forward's
18
+ * is entirely lowercase strings, so without this its docs would
19
+ * pass while naming a coordinate system that does not exist.
20
+ *
21
+ * Regenerate a truth file after a version bump:
22
+ * python3 scripts/gen_python_truth.py kloppy --provider kloppy
23
+ */
24
+ import { readdirSync, readFileSync } from "node:fs";
25
+ import { dirname, resolve } from "node:path";
26
+ import { fileURLToPath } from "node:url";
27
+ const __dirname = dirname(fileURLToPath(import.meta.url));
28
+ const TRUTH_DIR = resolve(__dirname, "..", "data", "provider-truth");
29
+ const DOCS_DIR = resolve(__dirname, "..", "docs");
30
+ /**
31
+ * SCREAMING_SNAKE tokens that legitimately appear in a provider's docs without
32
+ * being members of that package's own enums - other providers' vocabularies,
33
+ * format markers, and column names. Anything not listed here and not in the
34
+ * package is treated as invented.
35
+ */
36
+ const TOKEN_ALLOWLIST = {
37
+ kloppy: ["SPADL", "VAEP"],
38
+ socceraction: ["SPADL", "VAEP"],
39
+ soccerdata: [
40
+ // Environment variables and a log level, read by the package but not symbols in it.
41
+ "SOCCERDATA_DIR",
42
+ "SOCCERDATA_LOGLEVEL",
43
+ "SOCCERDATA_MAXAGE",
44
+ "SOCCERDATA_NOCACHE",
45
+ "SOCCERDATA_NOSTORE",
46
+ "INFO",
47
+ // football-data.co.uk CSV headers, which MatchHistory passes through unrenamed.
48
+ "FTHG",
49
+ "FTAG",
50
+ "HTHG",
51
+ "HTAG",
52
+ "B365H",
53
+ "B365D",
54
+ "B365A",
55
+ ],
56
+ mplsoccer: [],
57
+ floodlight: ["PATH"],
58
+ databallpy: [],
59
+ // HTTP verbs in the endpoint tables.
60
+ skillcorner: ["GET", "POST"],
61
+ // Match-official position codes emitted when include_officials=True. They come
62
+ // from the Rust core rather than a Python enum, so introspection cannot see them.
63
+ "fast-forward": ["REF", "AREF", "VAR", "AVAR"],
64
+ // A torchmetrics metric the training loop tracks, not an unravel symbol.
65
+ unravelsports: ["AUROC"],
66
+ };
67
+ /**
68
+ * Endpoint paths a doc set may cite without the spec defining them - other
69
+ * vendors' endpoints named in comparison prose, and illustrative examples.
70
+ */
71
+ const ENDPOINT_ALLOWLIST = {
72
+ wyscout: [],
73
+ skillcorner: [],
74
+ "fmdb-pro": [],
75
+ };
76
+ /**
77
+ * Compare endpoints on shape, not on parameter naming. Docs and specs often use
78
+ * different placeholder names for the same path segment, and that is a style
79
+ * difference rather than a documentation error.
80
+ */
81
+ export function normalisePath(path, basePaths = []) {
82
+ let p = path.split("?")[0].trim();
83
+ // Docs cite the callable URL, which carries the server base path and often a
84
+ // response-format extension; the spec lists neither.
85
+ for (const base of [...basePaths].sort((a, b) => b.length - a.length)) {
86
+ if (p.startsWith(base)) {
87
+ p = p.slice(base.length);
88
+ break;
89
+ }
90
+ }
91
+ return p
92
+ .replace(/\.(json|xml)$/i, "")
93
+ .replace(/\{[^}]*\}/g, "{}")
94
+ .replace(/\/+$/, "")
95
+ .trim();
96
+ }
97
+ /**
98
+ * Endpoint claims in a doc set, from both notations the corpus uses: inline code
99
+ * spans (`GET /matches/{wyId}/events`) and HTTP request lines inside fenced
100
+ * blocks (```http ... GET /api/players HTTP/1.1).
101
+ */
102
+ export function extractDocumentedEndpoints(text) {
103
+ const out = [];
104
+ const seen = new Set();
105
+ const add = (method, rawPath) => {
106
+ // `GET /metrics/game_intelligence/...` is prose shorthand for a family of
107
+ // endpoints, not a claim that this exact path exists.
108
+ if (rawPath.includes("..."))
109
+ return;
110
+ const key = `${method} ${rawPath}`;
111
+ if (seen.has(key))
112
+ return;
113
+ seen.add(key);
114
+ out.push({ method, path: rawPath });
115
+ };
116
+ for (const match of text.matchAll(/`(GET|POST|PUT|PATCH|DELETE)\s+(\/[^`\s]*)`/g)) {
117
+ add(match[1], match[2]);
118
+ }
119
+ // Request lines are anchored to the start of a line and may carry an HTTP
120
+ // version suffix, which keeps ordinary prose from matching.
121
+ for (const block of text.matchAll(/```[a-z]*\n([\s\S]*?)```/g)) {
122
+ for (const line of block[1].split("\n")) {
123
+ const m = line.match(/^\s*(GET|POST|PUT|PATCH|DELETE)\s+(\/\S*)(?:\s+HTTP\/[\d.]+)?\s*$/);
124
+ if (m)
125
+ add(m[1], m[2]);
126
+ }
127
+ }
128
+ return out;
129
+ }
130
+ /**
131
+ * How many endpoint claims a doc set actually makes.
132
+ *
133
+ * validateOpenApiDocs returns no violations both when every endpoint is correct
134
+ * and when a doc set cites no endpoints at all. Those are very different states,
135
+ * and only one of them means anything, so callers can check coverage separately.
136
+ */
137
+ export function countDocumentedEndpoints(docs) {
138
+ return docs.reduce((n, d) => n + extractDocumentedEndpoints(d.text).length, 0);
139
+ }
140
+ export function loadOpenApiTruth(provider) {
141
+ return JSON.parse(readFileSync(resolve(TRUTH_DIR, `${provider}.openapi.json`), "utf-8"));
142
+ }
143
+ export function listOpenApiProviders() {
144
+ return readdirSync(TRUTH_DIR)
145
+ .filter((f) => f.endsWith(".openapi.json"))
146
+ .map((f) => f.replace(/\.openapi\.json$/, ""))
147
+ .sort();
148
+ }
149
+ /** Check that every endpoint a doc set cites exists in the vendor's own spec. */
150
+ export function validateOpenApiDocs(docs, truth) {
151
+ const violations = [];
152
+ const bases = truth.basePaths ?? [];
153
+ // Spec paths as segment arrays. A placeholder segment matches any concrete
154
+ // value, so a doc showing a worked example (/en/...) still matches a spec
155
+ // written with a variable (/{locale}/...).
156
+ const specPaths = [];
157
+ for (const [path, methods] of Object.entries(truth.paths)) {
158
+ const segments = normalisePath(path, bases).split("/").filter(Boolean);
159
+ const existing = specPaths.find((s) => s.segments.length === segments.length && s.segments.every((seg, i) => seg === segments[i]));
160
+ const target = existing ?? { segments, methods: new Set() };
161
+ for (const m of methods)
162
+ target.methods.add(m);
163
+ if (!existing)
164
+ specPaths.push(target);
165
+ }
166
+ const matchSpec = (docPath) => {
167
+ const segments = normalisePath(docPath, bases).split("/").filter(Boolean);
168
+ const hit = specPaths.find((s) => s.segments.length === segments.length &&
169
+ s.segments.every((seg, i) => seg === "{}" || seg === segments[i]));
170
+ return hit?.methods;
171
+ };
172
+ const allowed = new Set((ENDPOINT_ALLOWLIST[truth.provider] ?? []).map((p) => normalisePath(p, bases)));
173
+ for (const { file, text } of docs) {
174
+ for (const { method, path } of extractDocumentedEndpoints(text)) {
175
+ const shape = normalisePath(path, bases);
176
+ if (allowed.has(shape))
177
+ continue;
178
+ const methods = matchSpec(path);
179
+ if (!methods) {
180
+ violations.push(`${file}: \`${method} ${path}\` - no such path in the ${truth.provider} spec`);
181
+ }
182
+ else if (!methods.has(method)) {
183
+ violations.push(`${file}: \`${method} ${path}\` - spec defines ${[...methods].sort().join(", ")} on this path, not ${method}`);
184
+ }
185
+ }
186
+ }
187
+ return violations;
188
+ }
189
+ export function loadProviderTruth(provider) {
190
+ return JSON.parse(readFileSync(resolve(TRUTH_DIR, `${provider}.json`), "utf-8"));
191
+ }
192
+ export function listTruthProviders() {
193
+ // Package truth is <provider>.json. Other kinds carry a qualifier
194
+ // (<provider>.openapi.json, <provider>.postman.json), so require a bare name.
195
+ return readdirSync(TRUTH_DIR)
196
+ .filter((f) => /^[a-z0-9-]+\.json$/.test(f))
197
+ .map((f) => f.replace(/\.json$/, ""))
198
+ .sort();
199
+ }
200
+ export function loadProviderDocs(provider) {
201
+ const dir = resolve(DOCS_DIR, provider);
202
+ return readdirSync(dir)
203
+ .filter((f) => f.endsWith(".md"))
204
+ .map((file) => ({ file, text: readFileSync(resolve(dir, file), "utf-8") }));
205
+ }
206
+ /** Names imported from the package in `from x import a, b` statements. */
207
+ export function extractImportedSymbols(text, pkg) {
208
+ const out = new Set();
209
+ const re = new RegExp(`from\\s+(${pkg}(?:\\.[\\w.]+)?)\\s+import\\s+([^\\n#]+)`, "g");
210
+ for (const match of text.matchAll(re)) {
211
+ for (const raw of match[2].split(",")) {
212
+ const name = raw.trim().replace(/\s+as\s+\w+$/, "").trim();
213
+ // `import *` says nothing about individual names.
214
+ if (name && name !== "*" && /^[A-Za-z_]\w*$/.test(name))
215
+ out.add(name);
216
+ }
217
+ }
218
+ return [...out];
219
+ }
220
+ /** SCREAMING_SNAKE_CASE tokens inside backtick code spans. */
221
+ export function extractEnumTokens(text) {
222
+ const out = new Set();
223
+ for (const match of text.matchAll(/`([A-Z][A-Z0-9_]{2,})`/g))
224
+ out.add(match[1]);
225
+ return [...out];
226
+ }
227
+ export function validateProviderDocs(docs, truth) {
228
+ const violations = [];
229
+ const pkg = truth.source.package;
230
+ const knownSymbols = new Set([
231
+ ...truth.symbols,
232
+ ...truth.classes,
233
+ ...Object.keys(truth.modules).map((m) => m.split(".").pop()),
234
+ ]);
235
+ // A SCREAMING_SNAKE token is legitimate if it is an enum member, or any real
236
+ // name in the package - module constants and class constants both get
237
+ // documented (soccerdata's TEAMNAME_REPLACEMENTS, floodlight's ECW_ES_CUTOFFS).
238
+ const knownTokens = new Set([
239
+ ...Object.values(truth.enums).flat(),
240
+ ...truth.symbols,
241
+ ...(TOKEN_ALLOWLIST[truth.provider] ?? []),
242
+ ]);
243
+ for (const { file, text } of docs) {
244
+ for (const name of extractImportedSymbols(text, pkg)) {
245
+ if (!knownSymbols.has(name)) {
246
+ violations.push(`${file}: \`from ${pkg}... import ${name}\` - no such symbol in ${pkg} ${truth.source.version}`);
247
+ }
248
+ }
249
+ for (const token of extractEnumTokens(text)) {
250
+ if (!knownTokens.has(token)) {
251
+ violations.push(`${file}: \`${token}\` is not a member of any ${pkg} enum - invented, renamed, or needs an allowlist entry`);
252
+ }
253
+ }
254
+ }
255
+ return violations;
256
+ }
257
+ /**
258
+ * `param="value"` pairs a doc writes, for parameters with a Literal annotation.
259
+ *
260
+ * Also matches the `to_`-prefixed form: fast-forward's transform() takes
261
+ * `to_coordinates` and `to_orientation` typed as plain `Optional[str]`, but the
262
+ * values they accept are the same vocabulary as the `coordinates` and
263
+ * `orientation` load parameters, and that is where a wrong value would be written.
264
+ */
265
+ export function extractLiteralArguments(text, params) {
266
+ if (params.length === 0)
267
+ return [];
268
+ const alternation = params.map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
269
+ const re = new RegExp(`\\b(?:to_)?(${alternation})\\s*=\\s*["']([^"'\\n]+)["']`, "g");
270
+ const out = [];
271
+ for (const match of text.matchAll(re))
272
+ out.push({ param: match[1], value: match[2] });
273
+ return out;
274
+ }
275
+ export function validateLiteralArguments(docs, truth) {
276
+ const violations = [];
277
+ const params = Object.keys(truth.literals);
278
+ for (const { file, text } of docs) {
279
+ for (const { param, value } of extractLiteralArguments(text, params)) {
280
+ if (!truth.literals[param].includes(value)) {
281
+ violations.push(`${file}: \`${param}="${value}"\` - not accepted by any ${truth.source.package} ${truth.source.version} function; valid: ${truth.literals[param].join(", ")}`);
282
+ }
283
+ }
284
+ }
285
+ return violations;
286
+ }
287
+ /**
288
+ * How many literal arguments a doc set actually cites.
289
+ *
290
+ * validateLiteralArguments returns no violations both when every documented value
291
+ * is real and when the docs cite none at all, so the tests assert this separately
292
+ * rather than reading an empty violation list as coverage.
293
+ */
294
+ export function countDocumentedLiteralArguments(docs, truth) {
295
+ const params = Object.keys(truth.literals);
296
+ return docs.reduce((n, d) => n + extractLiteralArguments(d.text, params).length, 0);
297
+ }
298
+ export function loadPostmanTruth(provider) {
299
+ return JSON.parse(readFileSync(resolve(TRUTH_DIR, `${provider}.postman.json`), "utf-8"));
300
+ }
301
+ export function listPostmanProviders() {
302
+ return readdirSync(TRUTH_DIR)
303
+ .filter((f) => f.endsWith(".postman.json"))
304
+ .map((f) => f.replace(/\.postman\.json$/, ""))
305
+ .sort();
306
+ }
307
+ /** Resource selectors a doc set cites, e.g. `req=match_lineups`. */
308
+ export function extractDispatchValues(text, param) {
309
+ const out = new Set();
310
+ const inline = new RegExp(`${param}=([A-Za-z0-9_]+)`, "g");
311
+ for (const m of text.matchAll(inline))
312
+ out.add(m[1]);
313
+ // Reference tables list the value on its own, in a code span.
314
+ for (const m of text.matchAll(/\|\s*`([a-z][a-z0-9_]{2,})`\s*\|/g))
315
+ out.add(m[1]);
316
+ return [...out];
317
+ }
318
+ /**
319
+ * Check a single-endpoint API's docs against the published request vocabulary.
320
+ *
321
+ * With no paths to get wrong, the failure mode moves to the dispatch parameter:
322
+ * an invented or misspelled `req` value is not a routing error and will not
323
+ * necessarily look like one at runtime.
324
+ */
325
+ export function validatePostmanDocs(docs, truth) {
326
+ const violations = [];
327
+ const param = truth.source.dispatch_param;
328
+ if (!param)
329
+ return violations;
330
+ const known = new Set(Object.keys(truth.operations));
331
+ const params = new Set(truth.parameters);
332
+ for (const { file, text } of docs) {
333
+ for (const value of extractDispatchValues(text, param)) {
334
+ // A table cell may hold a parameter name rather than a resource selector.
335
+ if (known.has(value) || params.has(value))
336
+ continue;
337
+ violations.push(`${file}: \`${value}\` is not a published ${truth.provider} ${param} value or parameter`);
338
+ }
339
+ }
340
+ return violations;
341
+ }
@@ -0,0 +1,84 @@
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 Access
9
+
10
+ BeSoccer is a Spanish football data provider. Its client API is documented as a
11
+ public Postman collection rather than an OpenAPI specification.
12
+
13
+ - **Base URL**: `https://apiclient.besoccerapps.com/scripts/api/api.php`
14
+ - **Documentation**: [Postman collection](https://documenter.getpostman.com/view/6414020/2s93JwM1t4)
15
+ - **Style**: single endpoint, resource selected by the `req` query parameter
16
+
17
+ ## Authentication
18
+
19
+ A single API key, passed as the `key` query parameter on every request:
20
+
21
+ ```
22
+ GET https://apiclient.besoccerapps.com/scripts/api/api.php?key={key}&req=competitions&format=json
23
+ ```
24
+
25
+ There is no OAuth flow, no bearer token and no login call. The key is described
26
+ as the "unique key that allows users to connect to the API", and it is a query
27
+ parameter, so it will appear in server logs and browser history — keep it out of
28
+ anything shared or committed.
29
+
30
+ ## Request shape
31
+
32
+ Every call is a `GET` to the same URL. Four parameters are common to all requests:
33
+
34
+ | Parameter | Required | Notes |
35
+ |---|---|---|
36
+ | `key` | yes | API key |
37
+ | `req` | yes | Resource selector — see [api-endpoints.md](api-endpoints.md) |
38
+ | `format` | no | `json`, `xml`, `text` or `js` |
39
+ | `tz` | no | Time zone, e.g. `Europe/Madrid` |
40
+
41
+ Everything else varies per request: `id`, `year`, `league`, `team`, `competitions`,
42
+ `players`, `lang` and others. The full per-request parameter list is in
43
+ [api-endpoints.md](api-endpoints.md).
44
+
45
+ Because the resource is a query parameter, a typo in `req` is not a 404 on a path
46
+ — it is a request to an endpoint that does not exist, and the failure will not
47
+ necessarily look like a routing error. Validate `req` against the published
48
+ vocabulary rather than guessing.
49
+
50
+ ## Access levels
51
+
52
+ Requests are grouped into three levels, which map to access tiers:
53
+
54
+ | Level | Requests | Broad content |
55
+ |---|---|---|
56
+ | Level 1 | 15 | Competitions, seasons, tables, teams, matches by day, live matches |
57
+ | Level 2 | 24 | Match detail and lineups, team detail and squads, transfers, referees, TV listings |
58
+ | Level 3 | 18 | Player detail, player statistics and trajectory, advanced team statistics, historical data |
59
+
60
+ A key not entitled to a level cannot call the requests in it. Which levels a key
61
+ carries is a commercial matter between you and BeSoccer.
62
+
63
+ ## Coverage window
64
+
65
+ BeSoccer states that the API serves **the current season plus the two previous
66
+ years**. Anything older is outside its range — plan historical work around another
67
+ source rather than expecting deep archives here.
68
+
69
+ ## Identifiers
70
+
71
+ BeSoccer uses its own integer IDs for competitions, teams, players and matches.
72
+ They are provider-scoped, with no cross-provider mapping exposed in the API, so
73
+ bridging to another provider means matching on attributes rather than looking up
74
+ an ID.
75
+
76
+ Seasons are selected with `year`, given as the starting calendar year of the
77
+ season.
78
+
79
+ ## Licensing
80
+
81
+ The API is commercial and key-gated. The Postman collection is public
82
+ documentation of the request surface; the data returned is BeSoccer's and subject
83
+ to whatever terms accompany your key. This repository documents the request
84
+ surface only and holds none of BeSoccer's data.
@@ -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` | int | Second within minute |
70
- | `player_id` | int | Player identifier |
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` | int | |
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` | int | Unique |
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.2.
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