football-docs 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -9
- package/data/docs.db +0 -0
- package/dist/crawl.d.ts +7 -0
- package/dist/crawl.js +48 -1
- package/dist/discover.d.ts +8 -0
- package/dist/discover.js +12 -1
- package/dist/http.d.ts +8 -1
- package/dist/http.js +23 -1
- package/dist/ingest.js +3 -1
- package/dist/provider-truth.d.ts +44 -1
- package/dist/provider-truth.js +25 -1
- package/dist/tools.d.ts +7 -0
- package/dist/tools.js +14 -1
- package/docs/_reference/skillcorner-crunch-help/getting-started-api-access-dynamic-events.md +134 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-api-access-our-tracking-data.md +160 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-best-practice-analysis-guidance.md +16 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-dynamic-events-check.md +33 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-explore-game-intelligence-data-1.md +37 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-explore-game-intelligence-data.md +29 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-first-requests.md +99 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-generate-visual-reports.md +90 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-make-your-first-queries.md +92 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-off-ball-run-sportscode-xml.md +32 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-on-ball-engagement-video-definitio.md +15 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-python-retrieve-dynamic-events-fil.md +102 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-python-retrieve-game-intelligence-.md +158 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-python-sync-your-database-with-ski.md +192 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-run-detection-and-classification.md +131 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-skill-corner-tracking-data.md +82 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-skillcorner-python-client.md +70 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started-using-skillcorner-api.md +146 -0
- package/docs/_reference/skillcorner-crunch-help/getting-started.md +43 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-coordinates-distance-speeds-and-directi.md +149 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-dynamic-events-csv-specifications.md +15 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-forward-momentum.md +13 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-game-intelligence-v2-metrics.md +17 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-in-possession-package-content.md +19 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-line-breaking-passes.md +103 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-off-ball-run-dynamic-events.md +197 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-overcoming-pressure.md +105 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-passing-metrics-1.md +144 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-passing-moment-frame-selection.md +19 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-peak-sprint-velocity.md +26 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-phases-of-play-video-definitions.md +15 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-physical-data-glossary.md +127 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries-running-off-ball-metrics-1.md +135 -0
- package/docs/_reference/skillcorner-crunch-help/glossaries.md +43 -0
- package/docs/_reference/skillcorner-crunch-help/index.md +33 -0
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-pass-completion-probabilit.md +15 -0
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-passing-option.md +30 -0
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-physical-load-prediction-m.md +63 -0
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-pressure-detection.md +46 -0
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-pressure-intensity.md +80 -0
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-threat.md +40 -0
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts.md +37 -0
- package/docs/_reference/skillcorner-crunch-help/product-updates-1-changelog-2025.md +57 -0
- package/docs/_reference/skillcorner-crunch-help/product-updates-1-game-intelligence-v2-migration.md +64 -0
- package/docs/_reference/skillcorner-crunch-help/product-updates-1-product-updates.md +200 -0
- package/docs/_reference/skillcorner-crunch-help/product-updates-1.md +25 -0
- package/docs/_reference/skillcorner-crunch-help/tool-box-api-data-version.md +255 -0
- package/docs/_reference/skillcorner-crunch-help/tool-box-data-availability.md +55 -0
- package/docs/_reference/skillcorner-crunch-help/tool-box-python-event-tracking-synchronization-1.md +442 -0
- package/docs/_reference/skillcorner-crunch-help/tool-box-python-event-tracking-synchronization.md +276 -0
- package/docs/_reference/skillcorner-crunch-help/tool-box-python-off-ball-runs-radar-plots.md +69 -0
- package/docs/_reference/skillcorner-crunch-help/tool-box-rule-based-event-synchronisation.md +44 -0
- package/docs/_reference/skillcorner-crunch-help/tool-box.md +35 -0
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-averaging-per-match-per-even.md +179 -0
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-benchmarking-normalisation.md +27 -0
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-data-quality-standards.md +45 -0
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-physical-data-glossary-1-1.md +54 -0
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-physical-data-glossary-1.md +25 -0
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-pitch-modelisation.md +27 -0
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-playing-time-info.md +133 -0
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data.md +43 -0
- package/docs/databallpy/data-model.md +5 -2
- package/docs/databallpy/overview.md +5 -3
- package/docs/driblab/api-access.md +134 -0
- package/docs/driblab/api-endpoints.md +169 -0
- package/docs/driblab/data-model.md +218 -0
- package/docs/fast-forward/api.md +6 -6
- package/docs/fast-forward/benchmarks.md +2 -2
- package/docs/fast-forward/concepts-coordinate-systems.md +2 -2
- package/docs/fast-forward/concepts-dataset.md +2 -2
- package/docs/fast-forward/concepts-distributed-compute.md +2 -2
- package/docs/fast-forward/concepts-filelike.md +2 -2
- package/docs/fast-forward/concepts-layouts.md +2 -2
- package/docs/fast-forward/concepts-orientations.md +2 -2
- package/docs/fast-forward/concepts-transformations.md +2 -2
- package/docs/fast-forward/getting-started.md +2 -2
- package/docs/fast-forward/index.md +2 -2
- package/docs/fast-forward/providers-cdf.md +2 -2
- package/docs/fast-forward/providers-gradientsports.md +2 -2
- package/docs/fast-forward/providers-hawkeye.md +2 -2
- package/docs/fast-forward/providers-optavision.md +2 -2
- package/docs/fast-forward/providers-respovision.md +2 -2
- package/docs/fast-forward/providers-scisports.md +2 -2
- package/docs/fast-forward/providers-secondspectrum.md +2 -2
- package/docs/fast-forward/providers-signality.md +2 -2
- package/docs/fast-forward/providers-skillcorner.md +4 -8
- package/docs/fast-forward/providers-sportec.md +3 -3
- package/docs/fast-forward/providers-statsperform.md +2 -2
- package/docs/fast-forward/providers-tracab.md +2 -2
- package/docs/fast-forward/providers.md +2 -2
- package/docs/fast-forward/reporting-issues.md +2 -2
- package/docs/fmdb-pro/api-access.md +10 -1
- package/docs/fmdb-pro/data-model.md +6 -2
- package/docs/free-sources/overview.md +1 -1
- package/docs/mplsoccer/overview.md +5 -1
- package/docs/mplsoccer/visualizations.md +27 -0
- package/docs/skillcorner/api-access.md +7 -4
- package/docs/skillcorner/api-endpoints.md +3 -3
- package/docs/skillcorner/concepts.md +3 -3
- package/docs/skillcorner/coordinate-system.md +3 -3
- package/docs/skillcorner/data-model.md +17 -4
- package/docs/skillcorner/identity-surfaces.md +3 -3
- package/docs/skillcorner/physical-data.md +3 -3
- package/docs/sportmonks/api-changes.md +267 -0
- package/docs/sportmonks/authentication.md +61 -0
- package/docs/sportmonks/best-practices.md +416 -0
- package/docs/sportmonks/changelog-beta.md +156 -0
- package/docs/sportmonks/changelog.md +907 -0
- package/docs/sportmonks/code-libraries.md +28 -0
- package/docs/sportmonks/data-corrections.md +33 -0
- package/docs/sportmonks/demo-response-files.md +131 -0
- package/docs/sportmonks/differences-between-api-2-and-api-3.md +29 -0
- package/docs/sportmonks/endpoints.md +427 -0
- package/docs/sportmonks/error-codes.md +897 -0
- package/docs/sportmonks/filtering-and-complexity-exceptions.md +15 -0
- package/docs/sportmonks/filtering.md +35 -0
- package/docs/sportmonks/fixtures.md +36 -0
- package/docs/sportmonks/get-all-fixtures.md +271 -0
- package/docs/sportmonks/get-all-leagues-by-team-id.md +260 -0
- package/docs/sportmonks/get-all-leagues.md +260 -0
- package/docs/sportmonks/get-all-livescores.md +270 -0
- package/docs/sportmonks/get-all-seasons.md +261 -0
- package/docs/sportmonks/get-all-states.md +307 -0
- package/docs/sportmonks/get-all-types.md +252 -0
- package/docs/sportmonks/get-brackets-by-season-id.md +897 -0
- package/docs/sportmonks/get-current-leagues-by-team-id.md +235 -0
- package/docs/sportmonks/get-fixture-by-id.md +267 -0
- package/docs/sportmonks/get-fixtures-by-date-range-for-team.md +287 -0
- package/docs/sportmonks/get-fixtures-by-date-range.md +298 -0
- package/docs/sportmonks/get-fixtures-by-date.md +300 -0
- package/docs/sportmonks/get-fixtures-by-head-to-head.md +288 -0
- package/docs/sportmonks/get-fixtures-by-multiple-ids.md +288 -0
- package/docs/sportmonks/get-fixtures-by-search-by-name.md +270 -0
- package/docs/sportmonks/get-inplay-livescores.md +270 -0
- package/docs/sportmonks/get-latest-updated-fixtures.md +327 -0
- package/docs/sportmonks/get-latest-updated-livescores.md +335 -0
- package/docs/sportmonks/get-league-by-id.md +241 -0
- package/docs/sportmonks/get-leagues-by-country-id.md +256 -0
- package/docs/sportmonks/get-leagues-by-fixture-date.md +260 -0
- package/docs/sportmonks/get-leagues-by-live.md +241 -0
- package/docs/sportmonks/get-leagues-search-by-name.md +260 -0
- package/docs/sportmonks/get-past-fixtures-by-tv-station-id.md +293 -0
- package/docs/sportmonks/get-seasons-by-id.md +242 -0
- package/docs/sportmonks/get-seasons-by-search-by-name.md +261 -0
- package/docs/sportmonks/get-seasons-by-team-id.md +256 -0
- package/docs/sportmonks/get-state-by-id.md +241 -0
- package/docs/sportmonks/get-type-by-entity.md +221 -0
- package/docs/sportmonks/get-type-by-id.md +237 -0
- package/docs/sportmonks/get-upcoming-fixtures-by-market-id.md +293 -0
- package/docs/sportmonks/get-upcoming-fixtures-by-tv-station-id.md +294 -0
- package/docs/sportmonks/getting-started.md +357 -0
- package/docs/sportmonks/include-exceptions.md +16 -0
- package/docs/sportmonks/includes.md +107 -0
- package/docs/sportmonks/leagues.md +931 -0
- package/docs/sportmonks/livescores.md +29 -0
- package/docs/sportmonks/making-your-first-request.md +840 -0
- package/docs/sportmonks/meta-description.md +61 -0
- package/docs/sportmonks/nested-includes.md +248 -0
- package/docs/sportmonks/new-endpoints-and-data-features.md +70 -0
- package/docs/sportmonks/ordering-and-sorting.md +114 -0
- package/docs/sportmonks/other-exceptions.md +16 -0
- package/docs/sportmonks/overview.md +17 -0
- package/docs/sportmonks/rate-limit.md +1078 -0
- package/docs/sportmonks/request-options.md +29 -0
- package/docs/sportmonks/seasons.md +35 -0
- package/docs/sportmonks/selecting-and-filtering.md +169 -0
- package/docs/sportmonks/selecting-fields.md +275 -0
- package/docs/sportmonks/states.md +30 -0
- package/docs/sportmonks/statistics.md +26 -0
- package/docs/sportmonks/syntax-and-filters.md +425 -0
- package/docs/sportmonks/syntax.md +63 -0
- package/docs/sportmonks/translations-beta.md +133 -0
- package/docs/sportmonks/types.md +25 -0
- package/docs/sportmonks/what-can-you-do-with-sportmonks-data.md +175 -0
- package/docs/sportradar/data-model.md +16 -1
- package/docs/statsbomb/api-access.md +12 -7
- package/docs/statsbomb/api-endpoints.md +2 -2
- package/docs/statsbomb/identity-surfaces.md +1 -1
- package/docs/statsbomb/iq-metrics-glossary.md +1 -1
- package/docs/statsbomb/player-mapping.md +1 -1
- package/docs/statsbomb/player-match-stats.md +1 -1
- package/docs/statsbomb/player-season-stats.md +1 -1
- package/docs/statsbomb/team-match-stats.md +1 -1
- package/docs/statsbomb/team-season-stats.md +1 -1
- package/docs/transferroom/api-access.md +27 -10
- package/docs/transferroom/api-endpoints.md +56 -41
- package/docs/transferroom/data-model.md +2 -2
- package/docs/transferroom/identity-surfaces.md +2 -2
- package/docs/wyscout/api-access.md +10 -3
- package/docs/wyscout/api-endpoints.md +2 -2
- package/docs/wyscout/coordinate-system.md +2 -2
- package/docs/wyscout/data-model.md +32 -2
- package/docs/wyscout/event-types.md +2 -2
- package/package.json +3 -2
- package/providers.json +56 -11
package/README.md
CHANGED
|
@@ -108,31 +108,32 @@ Provider filters use the indexed provider keys shown by `list_providers`, but co
|
|
|
108
108
|
|
|
109
109
|
| Provider | Chunks | Categories |
|
|
110
110
|
|----------|--------|------------|
|
|
111
|
-
| fast-forward |
|
|
111
|
+
| fast-forward | 250 | overview, getting-started, data-model, coordinate-system, orientations, layouts, transformations, distributed-compute, api-reference, 12 provider format pages |
|
|
112
112
|
| StatsBomb | 235 | event-types, data-model, coordinate-system, api-access, api-endpoints, charting-lineups, xg-model, iq-metrics, player/team stats, player-mapping, identity-surfaces |
|
|
113
113
|
| unravelsports | 202 | overview, installation, quickstart, concepts, graph converters, pressing intensity, formation detection, models, utils, american-football |
|
|
114
|
-
| Wyscout |
|
|
114
|
+
| Wyscout | 163 | event-types, data-model, coordinate-system, api-access, api-endpoints, charting-analysis-metrics, glossary, identity-surfaces |
|
|
115
115
|
| kloppy | 126 | data-model, usage, provider-mapping, tracking-rendering, event-derived-metrics |
|
|
116
116
|
| floodlight | 144 | core data objects, io parsers (Tracab, DFL, Kinexon, Opta, SkillCorner, StatsBomb, StatsPerform, Second Spectrum), transforms, metrics, models, visualisation, guides |
|
|
117
|
-
| SportMonks |
|
|
117
|
+
| SportMonks | 565 | full v3 endpoint reference (fixtures, livescores, leagues, seasons, states, types, statistics, brackets), syntax and includes, filtering, rate limits, error codes, changelog, plus curated event-types, data-model, api-access, charting-season-stories, identity-surfaces |
|
|
118
118
|
| databallpy | 63 | data-model, overview, usage |
|
|
119
|
-
| mplsoccer |
|
|
119
|
+
| mplsoccer | 65 | overview, pitch-types, visualizations |
|
|
120
120
|
| Impect | 77 | overview, data-model, event-types, coordinate-system, concepts, kpi-definitions, identity-surfaces |
|
|
121
|
-
| SkillCorner |
|
|
121
|
+
| SkillCorner | 49 | api-access, api-endpoints, data-model, physical-data, coordinate-system, concepts, identity-surfaces |
|
|
122
122
|
| Free sources | 62 | overview, fbref, understat, contextual-story-joins, xg-timelines |
|
|
123
123
|
| soccerdata | 40 | overview, data-sources, usage |
|
|
124
124
|
| TransferRoom | 43 | api-access, api-endpoints, charting-availability, data-model, identity-surfaces |
|
|
125
125
|
| Opta | 71 | event-types, qualifiers, coordinate-system, api-access, charting-game-state, charting-lineups, charting-passmaps, charting-set-pieces, charting-shot-placement, identity-surfaces |
|
|
126
126
|
| FMDB Pro | 35 | api-access, api-endpoints, data-model, identity-surfaces |
|
|
127
|
-
| Sportradar |
|
|
127
|
+
| Sportradar | 30 | api-access, api-endpoints, data-model, charting-and-stories, integration-notes |
|
|
128
128
|
| socceraction | 34 | SPADL format, VAEP, Expected Threat |
|
|
129
129
|
| BeSoccer | 14 | api-access, api-endpoints |
|
|
130
|
+
| Driblab | 27 | api-access, api-endpoints, data-model |
|
|
130
131
|
| TheSportsDB | 18 | api-access, api-endpoints, livescore, identity-surfaces |
|
|
131
132
|
| FotMob | 3 | identity-surfaces |
|
|
132
133
|
| Soccerdonna | 3 | identity-surfaces |
|
|
133
134
|
| Transfermarkt | 3 | identity-surfaces |
|
|
134
135
|
|
|
135
|
-
**
|
|
136
|
+
**2,322 searchable chunks** across 24 providers and tools.
|
|
136
137
|
|
|
137
138
|
> **Impect** documentation is built solely from the public
|
|
138
139
|
> [ImpectAPI/open-data](https://github.com/ImpectAPI/open-data) repository — a
|
|
@@ -155,6 +156,7 @@ trusting them.
|
|
|
155
156
|
| kloppy, socceraction, soccerdata, mplsoccer, floodlight, databallpy, skillcorner, fast-forward, unravelsports | The installed package itself — enum members, importable symbols, class constants, `Literal` parameter vocabularies | `src/__tests__/provider-truth.test.ts` |
|
|
156
157
|
| Wyscout, SkillCorner, FMDB Pro, Sportradar | The vendor's own publicly published OpenAPI spec — endpoint paths and methods | `src/__tests__/provider-truth.test.ts` |
|
|
157
158
|
| BeSoccer | The vendor's published Postman collection — request vocabulary and parameters | `src/__tests__/provider-truth.test.ts` |
|
|
159
|
+
| Driblab | The vendor's published API guide — endpoint paths, methods, parameter and field names | `src/__tests__/provider-truth.test.ts` |
|
|
158
160
|
| Impect | The public [open-data](https://github.com/ImpectAPI/open-data) repository | `src/__tests__/impect-open-data-validation.test.ts` |
|
|
159
161
|
|
|
160
162
|
Truth files live in `data/provider-truth/` and are generated, not hand-written:
|
|
@@ -166,8 +168,10 @@ pnpm openapi:truth # rebuild every spec-derived truth file
|
|
|
166
168
|
|
|
167
169
|
The specs those derive from are snapshots of **publicly published, unauthenticated**
|
|
168
170
|
vendor documentation. Source URLs, fetch dates and refresh instructions are in
|
|
169
|
-
[`specs/README.md`](specs/README.md). Wyscout's
|
|
170
|
-
truth file, because its docs
|
|
171
|
+
[`specs/README.md`](specs/README.md). Wyscout's v3 and v4 specifications merge into
|
|
172
|
+
one truth file, because its docs span both. The v2 legacy specification is no
|
|
173
|
+
longer mirrored: the docs describe v3 and v4, and no documented fact derives from
|
|
174
|
+
the legacy surface.
|
|
171
175
|
|
|
172
176
|
Each package gets its own pinned venv — co-installing them makes pip silently
|
|
173
177
|
downgrade conflicting versions, which would produce truth that disagrees with the
|
package/data/docs.db
CHANGED
|
Binary file
|
package/dist/crawl.d.ts
CHANGED
|
@@ -25,6 +25,13 @@ interface CrawledDoc {
|
|
|
25
25
|
* to isolate the main content, then Turndown to convert to markdown.
|
|
26
26
|
*/
|
|
27
27
|
export declare function htmlToMarkdown(html: string, url: string): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Drop the categories a provider's registry entry excludes. Kept separate from
|
|
30
|
+
* the crawl loop so the rule is testable without going near the network.
|
|
31
|
+
*/
|
|
32
|
+
export declare function applyCategoryExclusions<T extends {
|
|
33
|
+
category: string;
|
|
34
|
+
}>(docs: T[], excluded: string[] | undefined): T[];
|
|
28
35
|
/**
|
|
29
36
|
* Crawl an llms.txt or llms-full.txt file.
|
|
30
37
|
* Already structured for LLM consumption — chunk by top-level heading.
|
package/dist/crawl.js
CHANGED
|
@@ -248,6 +248,24 @@ export function htmlToMarkdown(html, url) {
|
|
|
248
248
|
return turndown.turndown(article.content);
|
|
249
249
|
}
|
|
250
250
|
// ── Crawl strategies ─────────────────────────────────────────────────
|
|
251
|
+
/**
|
|
252
|
+
* A large llms-full.txt concatenates whole documentation pages under `#`
|
|
253
|
+
* headings. Splitting those on `##` as well shreds each page into fragments
|
|
254
|
+
* that lose the context they need to answer anything — a lone "Wrong: no token"
|
|
255
|
+
* error case, say. Once a file carries at least this many `#` headings, they are
|
|
256
|
+
* document boundaries on their own and `##` is left alone.
|
|
257
|
+
*/
|
|
258
|
+
const LLMS_H1_ONLY_THRESHOLD = 10;
|
|
259
|
+
/**
|
|
260
|
+
* Drop the categories a provider's registry entry excludes. Kept separate from
|
|
261
|
+
* the crawl loop so the rule is testable without going near the network.
|
|
262
|
+
*/
|
|
263
|
+
export function applyCategoryExclusions(docs, excluded) {
|
|
264
|
+
if (!excluded?.length)
|
|
265
|
+
return docs;
|
|
266
|
+
const skip = new Set(excluded);
|
|
267
|
+
return docs.filter((doc) => !skip.has(doc.category));
|
|
268
|
+
}
|
|
251
269
|
/**
|
|
252
270
|
* Crawl an llms.txt or llms-full.txt file.
|
|
253
271
|
* Already structured for LLM consumption — chunk by top-level heading.
|
|
@@ -255,10 +273,33 @@ export function htmlToMarkdown(html, url) {
|
|
|
255
273
|
export function crawlLlmsTxt(content, sourceUrl) {
|
|
256
274
|
const sections = [];
|
|
257
275
|
const lines = content.split("\n");
|
|
276
|
+
// Headings inside a fenced code block are sample code or comments, not
|
|
277
|
+
// structure: splitting on one cuts the fence in half and leaves both pieces
|
|
278
|
+
// malformed. Track the fences so those lines are skipped.
|
|
279
|
+
const isFence = (line) => /^ {0,3}(`{3,}|~{3,})/.test(line);
|
|
280
|
+
const headingAt = (line) => line.match(/^(#{1,2})\s+(.+)/);
|
|
281
|
+
let fenced = false;
|
|
282
|
+
let h1Count = 0;
|
|
283
|
+
for (const line of lines) {
|
|
284
|
+
if (isFence(line)) {
|
|
285
|
+
fenced = !fenced;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (!fenced && headingAt(line)?.[1] === "#")
|
|
289
|
+
h1Count += 1;
|
|
290
|
+
}
|
|
291
|
+
const maxHeadingLevel = h1Count >= LLMS_H1_ONLY_THRESHOLD ? 1 : 2;
|
|
258
292
|
let currentTitle = "overview";
|
|
259
293
|
let currentLines = [];
|
|
294
|
+
fenced = false;
|
|
260
295
|
for (const line of lines) {
|
|
261
|
-
|
|
296
|
+
if (isFence(line))
|
|
297
|
+
fenced = !fenced;
|
|
298
|
+
const headingMatch = fenced ? null : headingAt(line);
|
|
299
|
+
if (headingMatch && headingMatch[1].length > maxHeadingLevel) {
|
|
300
|
+
currentLines.push(line);
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
262
303
|
if (headingMatch && currentLines.length > 0) {
|
|
263
304
|
const body = currentLines.join("\n").trim();
|
|
264
305
|
if (body.length > 50) {
|
|
@@ -621,6 +662,12 @@ async function main() {
|
|
|
621
662
|
console.log(` → no content extracted`);
|
|
622
663
|
continue;
|
|
623
664
|
}
|
|
665
|
+
const kept = applyCategoryExclusions(docs, config.exclude_categories);
|
|
666
|
+
const skipped = docs.length - kept.length;
|
|
667
|
+
if (skipped > 0) {
|
|
668
|
+
console.log(` skipped ${skipped} excluded categor${skipped === 1 ? "y" : "ies"}`);
|
|
669
|
+
}
|
|
670
|
+
docs = kept;
|
|
624
671
|
for (const doc of docs) {
|
|
625
672
|
writeCrawledDoc(name, doc, config.version);
|
|
626
673
|
console.log(` wrote ${name}/${doc.category}.md (${doc.content.length} chars) [${doc.source_type}]`);
|
package/dist/discover.d.ts
CHANGED
|
@@ -34,6 +34,14 @@ export interface ProbeResult {
|
|
|
34
34
|
isReadTheDocs: boolean;
|
|
35
35
|
isReachable: boolean;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* A site whose router answers every unknown path with its own shell returns the
|
|
39
|
+
* documentation page's HTML for /llms-full.txt, with a 200 and no redirect.
|
|
40
|
+
* TheSportsDB and FMDB Pro both do this. Crawling that as llms.txt writes a doc
|
|
41
|
+
* that is markup rather than documentation, so reject anything that opens like
|
|
42
|
+
* an HTML document.
|
|
43
|
+
*/
|
|
44
|
+
export declare function looksLikeHtml(content: string): boolean;
|
|
37
45
|
/**
|
|
38
46
|
* Choose the best source to crawl from probe results.
|
|
39
47
|
*
|
package/dist/discover.js
CHANGED
|
@@ -9,6 +9,17 @@
|
|
|
9
9
|
* const result = await discoverBestSource(provider);
|
|
10
10
|
*/
|
|
11
11
|
import { fetchText, urlExists } from "./http.js";
|
|
12
|
+
/**
|
|
13
|
+
* A site whose router answers every unknown path with its own shell returns the
|
|
14
|
+
* documentation page's HTML for /llms-full.txt, with a 200 and no redirect.
|
|
15
|
+
* TheSportsDB and FMDB Pro both do this. Crawling that as llms.txt writes a doc
|
|
16
|
+
* that is markup rather than documentation, so reject anything that opens like
|
|
17
|
+
* an HTML document.
|
|
18
|
+
*/
|
|
19
|
+
export function looksLikeHtml(content) {
|
|
20
|
+
const head = content.trimStart().slice(0, 512).toLowerCase();
|
|
21
|
+
return head.startsWith("<!doctype") || head.startsWith("<html") || head.includes("<head");
|
|
22
|
+
}
|
|
12
23
|
/**
|
|
13
24
|
* Probe a base URL for llms.txt variants.
|
|
14
25
|
* Returns the URL and content of the best llms.txt found, or null.
|
|
@@ -18,7 +29,7 @@ async function probeLlmsTxt(baseUrl) {
|
|
|
18
29
|
for (const filename of ["llms-full.txt", "llms.txt"]) {
|
|
19
30
|
const url = `${root}/${filename}`;
|
|
20
31
|
const content = await fetchText(url);
|
|
21
|
-
if (content && content.length > 100) {
|
|
32
|
+
if (content && content.length > 100 && !looksLikeHtml(content)) {
|
|
22
33
|
return { url, content };
|
|
23
34
|
}
|
|
24
35
|
}
|
package/dist/http.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/** Shared HTTP utilities for crawling and discovery. */
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Check if a URL returns a successful response.
|
|
4
|
+
*
|
|
5
|
+
* HEAD first, because it is cheap, then a one-byte ranged GET when HEAD fails.
|
|
6
|
+
* Some hosts serve a document happily on GET and answer HEAD with a 404 -
|
|
7
|
+
* api.fmdb.pro does exactly that for its OpenAPI document - and reporting those
|
|
8
|
+
* as missing sends a maintainer chasing a source that was never gone.
|
|
9
|
+
*/
|
|
3
10
|
export declare function urlExists(url: string): Promise<{
|
|
4
11
|
ok: boolean;
|
|
5
12
|
contentType?: string;
|
package/dist/http.js
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
/** Shared HTTP utilities for crawling and discovery. */
|
|
2
2
|
const MAX_RESPONSE_BYTES = 10 * 1024 * 1024; // 10 MB
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Check if a URL returns a successful response.
|
|
5
|
+
*
|
|
6
|
+
* HEAD first, because it is cheap, then a one-byte ranged GET when HEAD fails.
|
|
7
|
+
* Some hosts serve a document happily on GET and answer HEAD with a 404 -
|
|
8
|
+
* api.fmdb.pro does exactly that for its OpenAPI document - and reporting those
|
|
9
|
+
* as missing sends a maintainer chasing a source that was never gone.
|
|
10
|
+
*/
|
|
4
11
|
export async function urlExists(url) {
|
|
5
12
|
try {
|
|
6
13
|
const response = await fetch(url, {
|
|
7
14
|
method: "HEAD",
|
|
8
15
|
signal: AbortSignal.timeout(5000),
|
|
9
16
|
});
|
|
17
|
+
if (response.ok) {
|
|
18
|
+
return {
|
|
19
|
+
ok: true,
|
|
20
|
+
contentType: response.headers.get("content-type") ?? undefined,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// Fall through to the GET probe below.
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetch(url, {
|
|
29
|
+
headers: { Range: "bytes=0-0" },
|
|
30
|
+
signal: AbortSignal.timeout(10000),
|
|
31
|
+
});
|
|
10
32
|
return {
|
|
11
33
|
ok: response.ok,
|
|
12
34
|
contentType: response.headers.get("content-type") ?? undefined,
|
package/dist/ingest.js
CHANGED
|
@@ -51,7 +51,9 @@ export function parseFrontmatter(text) {
|
|
|
51
51
|
const [, key, value] = match;
|
|
52
52
|
const cleaned = value.replace(/^["']|["']$/g, "").trim();
|
|
53
53
|
if (key in fm) {
|
|
54
|
-
|
|
54
|
+
// `crawled_at: null` is YAML for absent, not for the four-letter string.
|
|
55
|
+
// Storing it verbatim puts "null" in front of readers in search results.
|
|
56
|
+
fm[key] = cleaned && cleaned !== "null" ? cleaned : null;
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
}
|
package/dist/provider-truth.d.ts
CHANGED
|
@@ -64,6 +64,12 @@ export interface OpenApiTruth {
|
|
|
64
64
|
fields: string[];
|
|
65
65
|
enums: Record<string, string[]>;
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* The endpoint check needs only a provider name and a path->methods map, so it
|
|
69
|
+
* works for any truth kind that carries one - an OpenAPI spec, or a vendor guide
|
|
70
|
+
* the endpoints were derived from.
|
|
71
|
+
*/
|
|
72
|
+
export type EndpointTruth = Pick<OpenApiTruth, "provider" | "paths"> & Partial<Pick<OpenApiTruth, "basePaths">>;
|
|
67
73
|
/**
|
|
68
74
|
* Compare endpoints on shape, not on parameter naming. Docs and specs often use
|
|
69
75
|
* different placeholder names for the same path segment, and that is a style
|
|
@@ -90,7 +96,37 @@ export declare function countDocumentedEndpoints(docs: DocFile[]): number;
|
|
|
90
96
|
export declare function loadOpenApiTruth(provider: string): OpenApiTruth;
|
|
91
97
|
export declare function listOpenApiProviders(): string[];
|
|
92
98
|
/** Check that every endpoint a doc set cites exists in the vendor's own spec. */
|
|
93
|
-
export declare function validateOpenApiDocs(docs: DocFile[], truth:
|
|
99
|
+
export declare function validateOpenApiDocs(docs: DocFile[], truth: EndpointTruth): string[];
|
|
100
|
+
/**
|
|
101
|
+
* Some vendors publish their API contract as a Notion page rather than as a
|
|
102
|
+
* specification. scripts/gen_notion_truth.py derives the same facts the endpoint
|
|
103
|
+
* check needs - paths, methods, parameter and field names - without mirroring the
|
|
104
|
+
* page, whose response samples carry the vendor's own match data.
|
|
105
|
+
*/
|
|
106
|
+
export interface NotionTruth {
|
|
107
|
+
provider: string;
|
|
108
|
+
kind: string;
|
|
109
|
+
source: {
|
|
110
|
+
page: string;
|
|
111
|
+
page_id: string;
|
|
112
|
+
title: string;
|
|
113
|
+
generated_at: string;
|
|
114
|
+
};
|
|
115
|
+
basePaths: string[];
|
|
116
|
+
paths: Record<string, string[]>;
|
|
117
|
+
parameters: string[];
|
|
118
|
+
fields: string[];
|
|
119
|
+
operations: Record<string, {
|
|
120
|
+
name: string;
|
|
121
|
+
group: string;
|
|
122
|
+
description: string;
|
|
123
|
+
paginated: boolean;
|
|
124
|
+
parameters: string[];
|
|
125
|
+
fields: string[];
|
|
126
|
+
}>;
|
|
127
|
+
}
|
|
128
|
+
export declare function loadNotionTruth(provider: string): NotionTruth;
|
|
129
|
+
export declare function listNotionProviders(): string[];
|
|
94
130
|
export declare function loadProviderTruth(provider: string): PythonPackageTruth;
|
|
95
131
|
export declare function listTruthProviders(): string[];
|
|
96
132
|
export declare function loadProviderDocs(provider: string): DocFile[];
|
|
@@ -98,6 +134,13 @@ export declare function loadProviderDocs(provider: string): DocFile[];
|
|
|
98
134
|
export declare function extractImportedSymbols(text: string, pkg: string): string[];
|
|
99
135
|
/** SCREAMING_SNAKE_CASE tokens inside backtick code spans. */
|
|
100
136
|
export declare function extractEnumTokens(text: string): string[];
|
|
137
|
+
/**
|
|
138
|
+
* A provider can have both a package truth and a spec truth - SkillCorner ships
|
|
139
|
+
* a pip client and publishes an OpenAPI document. A doc citing a value the spec
|
|
140
|
+
* enumerates (`U23`, say) is grounded, even though the pip package never names
|
|
141
|
+
* it, so the spec's enum members count as known tokens here too.
|
|
142
|
+
*/
|
|
143
|
+
export declare function specEnumTokens(provider: string): string[];
|
|
101
144
|
export declare function validateProviderDocs(docs: DocFile[], truth: PythonPackageTruth): string[];
|
|
102
145
|
/**
|
|
103
146
|
* `param="value"` pairs a doc writes, for parameters with a Literal annotation.
|
package/dist/provider-truth.js
CHANGED
|
@@ -60,7 +60,9 @@ const TOKEN_ALLOWLIST = {
|
|
|
60
60
|
skillcorner: ["GET", "POST"],
|
|
61
61
|
// Match-official position codes emitted when include_officials=True. They come
|
|
62
62
|
// from the Rust core rather than a Python enum, so introspection cannot see them.
|
|
63
|
-
|
|
63
|
+
// FOURTH is the fourth official: the Rust core emits "4TH" and 0.3.0 relabels it
|
|
64
|
+
// via _OFFICIAL_POSITION_RELABEL in fastforward._dataset.
|
|
65
|
+
"fast-forward": ["REF", "AREF", "VAR", "AVAR", "FOURTH"],
|
|
64
66
|
// A torchmetrics metric the training loop tracks, not an unravel symbol.
|
|
65
67
|
unravelsports: ["AUROC"],
|
|
66
68
|
};
|
|
@@ -72,6 +74,7 @@ const ENDPOINT_ALLOWLIST = {
|
|
|
72
74
|
wyscout: [],
|
|
73
75
|
skillcorner: [],
|
|
74
76
|
"fmdb-pro": [],
|
|
77
|
+
driblab: [],
|
|
75
78
|
};
|
|
76
79
|
/**
|
|
77
80
|
* Compare endpoints on shape, not on parameter naming. Docs and specs often use
|
|
@@ -186,6 +189,15 @@ export function validateOpenApiDocs(docs, truth) {
|
|
|
186
189
|
}
|
|
187
190
|
return violations;
|
|
188
191
|
}
|
|
192
|
+
export function loadNotionTruth(provider) {
|
|
193
|
+
return JSON.parse(readFileSync(resolve(TRUTH_DIR, `${provider}.notion.json`), "utf-8"));
|
|
194
|
+
}
|
|
195
|
+
export function listNotionProviders() {
|
|
196
|
+
return readdirSync(TRUTH_DIR)
|
|
197
|
+
.filter((f) => f.endsWith(".notion.json"))
|
|
198
|
+
.map((f) => f.replace(/\.notion\.json$/, ""))
|
|
199
|
+
.sort();
|
|
200
|
+
}
|
|
189
201
|
export function loadProviderTruth(provider) {
|
|
190
202
|
return JSON.parse(readFileSync(resolve(TRUTH_DIR, `${provider}.json`), "utf-8"));
|
|
191
203
|
}
|
|
@@ -224,6 +236,17 @@ export function extractEnumTokens(text) {
|
|
|
224
236
|
out.add(match[1]);
|
|
225
237
|
return [...out];
|
|
226
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* A provider can have both a package truth and a spec truth - SkillCorner ships
|
|
241
|
+
* a pip client and publishes an OpenAPI document. A doc citing a value the spec
|
|
242
|
+
* enumerates (`U23`, say) is grounded, even though the pip package never names
|
|
243
|
+
* it, so the spec's enum members count as known tokens here too.
|
|
244
|
+
*/
|
|
245
|
+
export function specEnumTokens(provider) {
|
|
246
|
+
if (!listOpenApiProviders().includes(provider))
|
|
247
|
+
return [];
|
|
248
|
+
return Object.values(loadOpenApiTruth(provider).enums).flat();
|
|
249
|
+
}
|
|
227
250
|
export function validateProviderDocs(docs, truth) {
|
|
228
251
|
const violations = [];
|
|
229
252
|
const pkg = truth.source.package;
|
|
@@ -238,6 +261,7 @@ export function validateProviderDocs(docs, truth) {
|
|
|
238
261
|
const knownTokens = new Set([
|
|
239
262
|
...Object.values(truth.enums).flat(),
|
|
240
263
|
...truth.symbols,
|
|
264
|
+
...specEnumTokens(truth.provider),
|
|
241
265
|
...(TOKEN_ALLOWLIST[truth.provider] ?? []),
|
|
242
266
|
]);
|
|
243
267
|
for (const { file, text } of docs) {
|
package/dist/tools.d.ts
CHANGED
|
@@ -47,6 +47,13 @@ export type ResolveEntityArgs = {
|
|
|
47
47
|
* like "Opta qualifier 76" to match docs that contain those tokens separately.
|
|
48
48
|
*/
|
|
49
49
|
export declare function sanitiseFtsQuery(query: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Upstream versions are whatever the provider calls its own release: a bare
|
|
52
|
+
* number ("0.3.0"), a version already carrying its prefix ("v3"), or a phrase
|
|
53
|
+
* ("Soccer v4 / Soccer Extended v4"). Only prefix the bare numbers, so a reader
|
|
54
|
+
* never sees "vv3" or "vSoccer v4".
|
|
55
|
+
*/
|
|
56
|
+
export declare function versionLabel(version: string | null): string;
|
|
50
57
|
export declare function resolveProviderId(db: Database.Database, args: ResolveProviderIdArgs): ToolResponse;
|
|
51
58
|
export declare function getProviderDocs(db: Database.Database, args: GetProviderDocsArgs): ToolResponse;
|
|
52
59
|
export declare function searchDocs(db: Database.Database, args: SearchDocsArgs): ToolResponse;
|
package/dist/tools.js
CHANGED
|
@@ -208,12 +208,25 @@ function compareRowsForProvider(db, matchQuery, provider, limit) {
|
|
|
208
208
|
LIMIT ?`)
|
|
209
209
|
.all(matchQuery, normaliseProvider(provider), limit);
|
|
210
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Upstream versions are whatever the provider calls its own release: a bare
|
|
213
|
+
* number ("0.3.0"), a version already carrying its prefix ("v3"), or a phrase
|
|
214
|
+
* ("Soccer v4 / Soccer Extended v4"). Only prefix the bare numbers, so a reader
|
|
215
|
+
* never sees "vv3" or "vSoccer v4".
|
|
216
|
+
*/
|
|
217
|
+
export function versionLabel(version) {
|
|
218
|
+
const trimmed = version?.trim();
|
|
219
|
+
if (!trimmed)
|
|
220
|
+
return "";
|
|
221
|
+
return /^\d/.test(trimmed) ? `v${trimmed}` : trimmed;
|
|
222
|
+
}
|
|
211
223
|
function sourceLabel(row) {
|
|
212
224
|
const crawledAt = row.crawled_at ? ` | crawled ${row.crawled_at}` : "";
|
|
213
225
|
if (row.source_type === "curated") {
|
|
214
226
|
return `**Source:** curated by football-docs contributors${crawledAt}`;
|
|
215
227
|
}
|
|
216
|
-
|
|
228
|
+
const version = versionLabel(row.upstream_version);
|
|
229
|
+
return `**Source:** ${row.source_type}${row.source_url ? ` (${row.source_url})` : ""}${version ? ` | ${version}` : ""}${crawledAt}`;
|
|
217
230
|
}
|
|
218
231
|
function providerMetadata(provider) {
|
|
219
232
|
return PROVIDER_REGISTRY.providers[provider];
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
source_url: https://skillcorner.crunch.help/en/getting-started/api-access-dynamic-events
|
|
3
|
+
source_type: crunch_help_kb
|
|
4
|
+
upstream_version:
|
|
5
|
+
crawled_at: 2026-07-13T14:06:38.861Z
|
|
6
|
+
---
|
|
7
|
+
The aim of this page is to guide you when accessing SkillCorner Dynamic Events via SkillCorner API.
|
|
8
|
+
|
|
9
|
+
The last part of the article provides a code snippet for Python users.
|
|
10
|
+
|
|
11
|
+
If you have not already, you can start by reading
|
|
12
|
+
|
|
13
|
+
- The glossary section dedicated to [Dynamic Events](https://skillcorner.crunch.help/en/glossaries#dynamic-events).
|
|
14
|
+
- [Our article](https://skillcorner.crunch.help/en/getting-started/first-requests) about the global overview of the SkillCorner API.
|
|
15
|
+
|
|
16
|
+
## Dynamic Events CSV and Sportscode XML
|
|
17
|
+
|
|
18
|
+
SkillCorner delivers two data formats.
|
|
19
|
+
|
|
20
|
+
- CSV files that contains either one type of Dynamic Events or all Dynamic Events that occurs during a match. You can access the specifications [here](https://skillcorner.crunch.help/en/glossaries/off-ball-runs-csv-specifications).
|
|
21
|
+
- Video Analysis XML (Sportscode XML format) files that can be used to track visualise Dynamic Events in video clips in combination with Sportscode, SBG Focus or SBG MatchTracker.
|
|
22
|
+
|
|
23
|
+
## Using the API
|
|
24
|
+
|
|
25
|
+
Dynamic events are available through SkillCorner API.
|
|
26
|
+
|
|
27
|
+
The API documentation is available [here](https://skillcorner.com/api/docs/#/match/match_dynamic_events_off_ball_runs_list). You can use this page to test the API.
|
|
28
|
+
|
|
29
|
+
The endpoint are
|
|
30
|
+
|
|
31
|
+
- https://skillcorner.com/api/match/{match\_id}/dynamic\_events
|
|
32
|
+
- https://skillcorner.com/api/match/{match\_id}/dynamic\_events/player\_possessions
|
|
33
|
+
- https://skillcorner.com/api/match/{match\_id}/dynamic\_events/passing\_options
|
|
34
|
+
- https://skillcorner.com/api/match/{match\_id}/dynamic\_events/off\_ball\_runs
|
|
35
|
+
|
|
36
|
+
Where {match\_id} should be replaced with the id of the match you want to access events for.
|
|
37
|
+
|
|
38
|
+
Example: _https://skillcorner.com/api/match/911858/dynamic\_events_
|
|
39
|
+
|
|
40
|
+
By default the endpoint returns a CSV file containing the Dynamic Events associated with the match\_id you specified assuming
|
|
41
|
+
|
|
42
|
+
- The match was processed
|
|
43
|
+
|
|
44
|
+
- The Dynamic Events Check is passed (see more [here](https://skillcorner.crunch.help/en/getting-started/dynamic-events-check))
|
|
45
|
+
|
|
46
|
+
- There was no error during the generation of the dynamic events.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
In order to access the Video Analysis XML, you need to specify the query parameter file\_format with the value “sportscode-xml”.
|
|
50
|
+
|
|
51
|
+
Example: _https://skillcorner.com/api/match/911858/dynamic\_events/off\_ball\_runs?file\_format=sportscode-xml_
|
|
52
|
+
|
|
53
|
+
The file should be available within a couple of seconds.
|
|
54
|
+
|
|
55
|
+
## Manage updates of the Dynamic Events
|
|
56
|
+
|
|
57
|
+
Via the data\_collection endpoint, you can determine when the dynamic events were last generated.
|
|
58
|
+
|
|
59
|
+
1. Send a call to the data\_collection endpoint https://skillcorner.com/api/match/{march\_id}/data\_collection where {match\_id} should be replaced with the id of the match you want to access events for.
|
|
60
|
+
2. Look for dynamic\_events\_last\_modified in the response.
|
|
61
|
+
3. The date corresponds to the last time we generated the dynamic events for the specific match ID.
|
|
62
|
+
|
|
63
|
+
## Using Python
|
|
64
|
+
|
|
65
|
+
You can use the SkillCorner Python client to access csv and xml files.
|
|
66
|
+
|
|
67
|
+
- If you have not installed the package yet go [here](https://skillcorner.crunch.help/en/getting-started/skillcorner-python-client).
|
|
68
|
+
- Otherwise make sure you upgrade it using the following command
|
|
69
|
+
`pip install -U skillcorner`
|
|
70
|
+
|
|
71
|
+
The Python Client documentation is available [here](https://skillcorner.readthedocs.io/en/latest/getting_started.html).
|
|
72
|
+
|
|
73
|
+
### Saving a file
|
|
74
|
+
|
|
75
|
+
Here is a snippet you can use to save the data for a given match ID
|
|
76
|
+
|
|
77
|
+
- Replace "your\_username", "your\_password", and "your\_match\_id".
|
|
78
|
+
- \[optional\] Modify the filepath within the save\_dynamic\_events method if you want to save the files elsewhere
|
|
79
|
+
- \[optional\] Change the format of the file to "sportscode-xml" and the filepath accordingly to retrieve the xml rather than the csv file.
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
from skillcorner.client import SkillcornerClient
|
|
83
|
+
|
|
84
|
+
# Instantiate the client
|
|
85
|
+
username = "your_username"
|
|
86
|
+
password = "your_password"
|
|
87
|
+
client = SkillcornerClient(username=username, password=password)
|
|
88
|
+
|
|
89
|
+
# Retrieve the data for a given match ID
|
|
90
|
+
match_id = your_match_id
|
|
91
|
+
|
|
92
|
+
data_collection = client.get_match_data_collection(match_id)
|
|
93
|
+
|
|
94
|
+
# The data is available if the "dynamic_events_check" value is True
|
|
95
|
+
if data_collection['dynamic_events_check']:
|
|
96
|
+
filepath = f"{match_id}.csv"
|
|
97
|
+
client.save_dynamic_events(match_id, params=
|
|
98
|
+
{
|
|
99
|
+
'file_format': 'csv'
|
|
100
|
+
},
|
|
101
|
+
filepath=filepath)
|
|
102
|
+
else:
|
|
103
|
+
print(f"Match {match_id} does not have Dynamic Events data available")
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Opening the CSV**
|
|
108
|
+
|
|
109
|
+
Here is a snippet you can use to open a csv for a given match ID
|
|
110
|
+
|
|
111
|
+
- Replace "your\_username", "your\_password", and "your\_match\_id".
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
from skillcorner.client import SkillcornerClient
|
|
115
|
+
import pandas as pd
|
|
116
|
+
|
|
117
|
+
# Instantiate the client
|
|
118
|
+
username = "your_username"
|
|
119
|
+
password = "your_password"
|
|
120
|
+
client = SkillcornerClient(username=username, password=password)
|
|
121
|
+
|
|
122
|
+
# Retrieve the data for a given match ID
|
|
123
|
+
match_id = your_match_id
|
|
124
|
+
|
|
125
|
+
data_collection = client.get_match_data_collection(match_id)
|
|
126
|
+
|
|
127
|
+
# The data is available if the "dynamic_events_check" value is True
|
|
128
|
+
if data_collection['dynamic_events_check']:
|
|
129
|
+
file = client.get_dynamic_events(match_id)
|
|
130
|
+
dynamic_events_df = pd.read_csv(file)
|
|
131
|
+
else:
|
|
132
|
+
print(f"Match {match_id} does not have Dynamic Events data available")
|
|
133
|
+
|
|
134
|
+
```
|