A comprehensive soccer match analytics dashboard built with Streamlit, powered by SkillCorner tracking data and the Kloppy library.
FootMetricX is an interactive analytics platform designed for coaches, analysts, and soccer enthusiasts to explore detailed match data. The dashboard combines:
- Team Statistics: Comprehensive team-level metrics at a basic level including shots, passes, defensive actions, and possession analysis
- Player Profiling: Individual player performance metrics with radar charts, heatmaps, and pass maps
- Pitch Control Analysis: Advanced visualization of team dominance and space control across the pitch
- Defensive Shape: Tactical analysis of defensive formations and pressing engagement
- Performance Comparison: Side-by-side player comparison with key performance indicators
- Data loading from SkillCorner's open data using Kloppy
- Interactive match selection and player filtering
- Statistical aggregation from tracking and event data
- Radar charts for multidimensional player profiling
- Heatmaps and pass maps for spatial analysis
- Pitch control visualization with frame-by-frame analysis
- Error handling and graceful data loading with user feedback
- Automated test suite with startup validation
- Frontend: Streamlit 1.28.1+ - Interactive web framework
- Data Processing: Pandas, NumPy - Data manipulation and analysis
- Sports Analytics:
- Kloppy 0.9.0+ - SkillCorner data loader and event processor
- mplsoccer - Pitch visualization
- Visualization: Plotly, Matplotlib, mplsoccer
- API Integration: Requests, BeautifulSoup - GitHub and Wikipedia data retrieval
- Testing: Pytest 7.0.0+ - Unit and integration testing
- Removed ~370 lines of unused team-level stat functions from
preset.py - Consolidated analytics functions to eliminate code duplication
- Improved code organization for better maintainability
- Fixed KeyError in player tracking data validation (covered_distance function)
- Fixed ValueError in heatmap contour level plotting for players with few passes
- Added defensive checks for empty DataFrames when accessing player team_id
- Improved error handling and data validation throughout
- Team logos now display with consistent square aspect ratio (equal width/height)
- Enhanced CSS styling with
object-fit: containfor better logo presentation - Improved visual consistency across dashboard tabs
- Python >=3.10.
- pip package manager
- Virtual environment (recommended)
-
Clone the repository:
git clone https://github.com/stephTchembeu/analytics_cup_analyst.git cd analytics_cup_analyst -
Create a virtual environment (optional but recommended):
# On macOS/Linux python -m venv venv source venv/bin/activate # On Windows python -m venv venv venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
From the project root directory, run:
streamlit run src/main.pyOr directly from the /src folder run
streamlit run main.pyThe application will start and automatically open in your default web browser at http://localhost:8501
# Run with specific port
streamlit run src/main.py --server.port 8502
# Run in headless mode (no browser launch)
streamlit run src/main.py --logger.level=debug- Test Validation: The app automatically runs the test suite to validate core functions
- Import Verification: Checks that all required packages are installed
- Data Loading: Loads available matches from SkillCorner's using Kloppy
- UI Initialization: Sets up dashboard tabs and sidebar controls
analytics_cup_analyst/
├── src/
│ ├── main.py # Streamlit app entry point (5 tabs)
│ ├── images/ # Team logos & assets
│ └── utils/
│ ├── preset.py # Core analytics & visualization functions (~1000 lines)
│ ├── logo_loader.py # Team logo management via Wikipedia API
│ ├── player_profiling.py # Player radar charts and heatmaps
│ ├── player_performance.py # Player comparison metrics
│ └── team_stats.py # Team-level statistics
├── tests/
│ ├── runner.py # Test runner
│ ├── conftest.py # Pytest fixtures
│ └── test_preset.py # Unit tests
├── requirements.txt # Dependencies
├── LICENSE # MIT License
└── README.md
- Team Stats: High-level team metrics including shots, passes, possession, and defensive actions
- Player Profiling: Individual player performance with radar charts, heatmaps, and spatial pass maps
- Player Performance Comparison: Side-by-side comparison of multiple players with key performance indicators
- Open the dashboard in your browser at
http://localhost:8501 - Use the sidebar dropdown to select an available match
- The app automatically loads:
- Match metadata from SkillCorner via Kloppy
- Event data from GitHub raw content
- Tracking data for space control and heatmap analysis
- Explore different tabs to analyze team and player performance
- Heatmaps: Visualize player positioning density across the pitch
- Pass Maps: Display all passes from a player with successful/unsuccessful pass indicators
- Covered Distance: Track total distance covered during the match
- Radar Charts: Compare multiple performance metrics in a single view
- Performance Metrics: Goals, assists, pass accuracy, pressures, and more
The application leverages SkillCorner's open-source released data:
- Match Metadata & Tracking Data: Via
kloppy.skillcorner.load_open_data() - Tracking Coordinates: SkillCorner format with automatic coordinate system handling
- Player Positions: Frame-by-frame tracking data for heatmaps and pitch control analysis
Event data is loaded from GitHub's raw content repository:
https://raw.githubusercontent.com/SkillCorner/opendata/master/data/matches/{game_id}/{game_id}_dynamic_events.csv
Data includes: passes, shots, fouls, clearances, pressures, and other game events.
Team logos are fetched from Wikipedia API with fallback to local assets:
- Primary: Wikipedia search for official team logos
- Fallback: Local image files in
src/images/ - Graceful degradation if logo unavailable
Match IDs are configured in src/utils/preset.py:
AVAILABLE_MATCHES_IDS: List of match IDs pre-loaded at startup- Graceful error handling if a match fails to load
- Dashboard continues with all successfully loaded matches
- User can select from dropdown to switch between matches
This project is licensed under the MIT License - see the LICENSE file for details.
- SkillCorner: For providing open-source tracking data.
- PySport/Kloppy: For sports data loading and processing library.
- PySport/KloppyXSkillCorner: For the launched Hackathon.
- Streamlit: For the interactive web framework.
- mplsoccer: For football pitch visualization.