SQmdb
SQmdb is a Python package for estimating player influence, pitch control, pitch value, and space quality from soccer tracking data. It uses Polars tables and implements selected components of the method in Martens, Dick, and Brefeld (2021); it is an approximation of that method, not a complete reproduction of the paper.
Install from PyPI
Install or upgrade to the latest release:
python -m pip install --upgrade sqmdb
For pitch visualizations, install the optional dependencies:
python -m pip install --upgrade "sqmdb[visualization]"
To record the installed release in an analysis environment:
python -c "from importlib.metadata import version; print(version('sqmdb'))"
For reproducible analyses, record that version with the analysis and pin it
when recreating the environment, for example
python -m pip install "sqmdb==0.1.0".
Starting with Parquet
SQmdb accepts Polars DataFrame and LazyFrame objects. Your input adapter
should provide the canonical columns below, with coordinates in metres,
centered on (0, 0), and attacking play oriented toward positive x (left-to-right). The
example pipeline assumes you have stored your tracking data as Parquet files in a directory called queried-data. Valid frames during live play are saved to tracking-live.parquet and the pass-horizon data is saved to passes.parquet.
import polars as pl
from sqmdb import SQConfig, fit_player_movement_model, iter_player_influence
tracking = pl.scan_parquet("path/to/queried-data/tracking-live.parquet")
config = SQConfig(frame_rate=25.0, grid_resolution_m=2.0, frame_stride=25)
movement = fit_player_movement_model(tracking, config, sample_stride=5)
for batch in iter_player_influence(tracking, movement, config):
print(batch.head())
The API manual defines every public argument, return value, unit, default, and important assumption.
Tracking input columns
One row represents one player's position at one frame.
| Column | Required | Meaning |
|---|---|---|
frame_id |
Yes | Integer frame index within a match |
player_id |
Yes | Stable player identifier |
team_id |
Yes | Player's team identifier |
x, y |
Yes | Player position in metres |
match_id |
No | Match identifier; omitted means one match |
ball_x, ball_y |
For pitch value and pass horizons | Ball position, consistent across a frame |
possession_team_id |
For pitch-value training | Team in possession, consistent across a frame |
is_goalkeeper |
No | Boolean; goalkeepers are excluded from labels when supplied |
Pass-horizon fitting also needs completed-pass data with
pass_distance_m (metres) and pass_duration_seconds (seconds). Tracking
rows must be unique by match, frame, and player. For iterator-based
calculations, group rows by match and order them by frame. See the API manual
for additional input and modeling requirements.
Visualize results
add_plot_velocities adds velocity columns to tracking data.
plot_pitch_surfaces can then draw pitch-control, pitch-value, and
space-quality surfaces with player and ball overlays. Both functions require
the optional visualization dependencies; the pipeline guide includes a usage
example.
Keep your data private
SQmdb operates on data you provide locally; it does not connect to your tracking provider or database. Keep raw tracking and pass Parquet files, row-level data, credentials, connection strings, private queries, and generated result directories out of public repositories and package artifacts. The example accepts local paths and writes results to a directory you choose; use synthetic data for public automated tests.
Reference
Martens, F., Dick, U., & Brefeld, U. (2021). Space and Control in Soccer. Frontiers in Sports and Active Living, 3, 676179. https://doi.org/10.3389/fspor.2021.676179
Metadata
Release files for sqmdb 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqmdb-0.1.0.tar.gz | 38.8 kB | With provenance | Details for sqmdb-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqmdb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sqmdb-0.1.0-py3-none-any.whl |
Total release size: 64.9 kB
Release files / sqmdb-0.1.0.tar.gz
| Download URL | sqmdb-0.1.0.tar.gz |
|---|---|
| Size | 38.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c39714b6295b4ea68871ca601431b5cd2e0d106e50eefc995c515162ba25565e
|
|
BLAKE2b-256 checksum How to use checksums |
57858de519ed284b994d968d2b79b05a3fca7b7ea65a816e5c0979edd52afba6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logRelease files / sqmdb-0.1.0-py3-none-any.whl
| Download URL | sqmdb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a21c66d0fe217bd220ed0486608488f5b0e926969af8b3e97a88b529e3368910
|
|
BLAKE2b-256 checksum How to use checksums |
e833fb7dea18cd890348597946b75471296c0d52d8d7937ec60cce897d99328a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logSecurity for sqmdb 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sqmdb-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.