A package for validating common data format files
Project description
⚽ Common Data Format Schema Validator
JSON and JSONLines Schema Validition for the Soccer Common Data Format.
Anzer, G., Arnsmeyer, K., Bauer, P., Bekkers, J., Brefeld, U., Davis, J., Evans, N., Kempe, M., Robertson, S. J., Smith, J. W., & Van Haaren, J. (2025). Common Data Format (CDF)—a Standardized Format for Match-Data in Football (Soccer). [Unpublished manuscript / Preprint].
Changelog
See CHANGELOG.md
How To
1. Install package
pip install common-data-format-validator
2. Create your own schema
Create your data schema according to the Common Data Format specificiations for any of:
- Offical Match Data
- Meta Data
- Event Data
- Tracking Data
- Skeletal Tracking Data
3. Test your schema
Once you have created your schema, you can check it's validity using the available SchemaValidators for each of the above mentioned data types.
import cdf
# # Example valid tracking data
validator = cdf.TrackingSchemaValidator()
validator.validate_schema(sample=f"cdf/files/v{cdf.VERSION}/sample/tracking.jsonl", limit=1)
# Example valid meta data
validator = cdf.MetaSchemaValidator()
validator.validate_schema(sample=f"cdf/files/v{cdf.VERSION}/sample/meta.json")
# Example valid event data
validator = cdf.EventSchemaValidator()
validator.validate_schema(sample=f"cdf/files/v{cdf.VERSION}/sample/event.jsonl", limit=1)
# Example valid match data
validator = cdf.MatchSchemaValidator()
validator.validate_schema(sample=f"cdf/files/v{cdf.VERSION}/sample/match.json")
# Example valid skeletal data
validator = cdf.SkeletalSchemaValidator()
validator.validate_schema(sample=f"cdf/files/v{cdf.VERSION}/sample/skeletal.jsonl", limit=1)
# Example valid video data
validator = cdf.VideoSchemaValidator()
validator.validate_schema(sample=f"cdf/files/v{cdf.VERSION}/sample/video.json")
Note
The validator checks:
- All mandatory fields are provided
- Snake case is adhered for each key and for values (except for player names, city names, venue names etc.)
- Data types are correct (e.g. boolean, integer etc.)
- Value entries for specific fields are correct (e.g. period type can only be one of 5 values)
- Position groups and positions follow naming conventions
- Color codes are hex (e.g. #FFC107)
- Position labels fit within the formation specifications
- Correct pitch dimensions (Simply checks if they are "x" between -65.0 and 65.0 and "y" between -42.5 and +42.5)
- Correct JSONLines line separator ('\n')
- Check multiple lines by setting
limit. Only works for JSONL files.limit=Nonechecks the whole file.
The validator (currently) does not check:
- Correct UTF-8 encoding
- British spelling (currently only for "color" / "colour" keys)
- If player_ids (or other ids) in meta are in tracking, event etc. or vice versa
Current Version of Common Data Format
This validator currently relies on CDF "alpha" version 2, but includes all logical changes not yet reflected in the text of this version, as discussed in the Changelog
Software by Joris Bekkers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file common_data_format_validator-0.0.14.tar.gz.
File metadata
- Download URL: common_data_format_validator-0.0.14.tar.gz
- Upload date:
- Size: 64.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cb00d8c999a5446add74c32e68db879600b4d1daae24b11cc15829601cd0134
|
|
| MD5 |
104b793d177a12c679ed1e26883530ff
|
|
| BLAKE2b-256 |
48a9a9929781bcf5f75223fda80cfd211463171c5ebf4c9f8be7b024dfbceb70
|
File details
Details for the file common_data_format_validator-0.0.14-py3-none-any.whl.
File metadata
- Download URL: common_data_format_validator-0.0.14-py3-none-any.whl
- Upload date:
- Size: 95.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83e46b1877a4dd5a01f4d4c84c7a0259aa074a4a190cf6986ab22a03b25d5f74
|
|
| MD5 |
2c7a9d6d66c74ea2a4f415c1b8e1e74f
|
|
| BLAKE2b-256 |
a6cfa26c0621d259c45267f4fd10262361cbb22c6c72241a517c1ae98de8e582
|