π΄ββοΈ PACE-VIEW: Explainable Cycling Intelligence Dashboardο
PACE-VIEW turns raw TCX rides into decision-ready insights for athletes and coaches. It combines physics-informed modeling, digital-twin prediction, and explainable AI in one interactive dashboard.
πͺ Why PACE-VIEW?ο
Dashboard-first workflow: Inspect workload, HR zone mix, efficiency trends, and per-session explanations in one place.
Explainability by design: Use counterfactual analysis, rationale generation, and pattern mining to understand why a session felt hard or easy.
Physics + ML pipeline: Quantify wind/terrain/environmental load and compare expected vs observed physiology.
Modular architecture: Run the full web app or use components independently in scripts.
π¦ Installationο
Install PACE-VIEW with pip:
pip install pace_view
To install from source:
git clone https://github.com/firefly-cpp/pace_view.git
cd pace_view
poetry build
python setup.py build
βοΈ Quick Startο
Run the full dashboard:
python examples/full_dashboard.py
Then open an activity to view detailed explanations and decision-support outputs.
Free software: MIT license
Python versions: 3.8.x, 3.9.x, 3.10.x, 3.11.x, 3.12.x
Documentation: https://pace-view.readthedocs.io/en/latest/
Tested OS: Windows, Ubuntu, Fedora, Alpine, Arch, macOS (This does not imply it will not work on others.)
β¨ Implemented Componentsο
Component 1: Data Ingestion & Preprocessingο
Loads raw activity and weather signals, aligns timestamps, and builds clean dataframes for downstream modeling.
Classes/modules:
DataParser(pace_view/data_parsing.py)DataCleaner(pace_view/data_cleaning.py)
Component 2: Environmental Quantificationο
Quantifies external/mechanical load and learns expected physiological behavior from historical rides.
Classes/modules:
PhysicsEngine(pace_view/physics.py)DigitalTwinModel(pace_view/digital_twin.py)
Component 3: Explainable AI (XAI)ο
Explains deviations with counterfactual reasoning, generates human-readable rationales, and mines global patterns.
Classes/modules:
CounterfactualAnalyzer(pace_view/counterfactual.py)RationaleGenerator(pace_view/rationale.py)PatternMiner(pace_view/mining.py)
Component 4: Interactive Dashboard & Decision Supportο
Exposes session-level explanation and inter-session analysis through the web UI and example views.
Classes/modules:
ContextTrainer(pace_view/core.py)Flask/Dash app:
examples/full_dashboard.py
π Examplesο
Run these from the repository root:
Full Dashboard
python examples/full_dashboard.pyRuns the full interactive dashboard with all cards and activity detail routing. End-to-end example combining visualization and contextual explanations.
Activity Detail Page
python examples/activity_detail_page_example.pyServes only the activity detail page for a single example TCX activity.
ContextTrainer (CLI Text Example)
python examples/context_trainer_text_example.pyRuns ContextTrainer without Flask or Dash and prints text-only results to the terminal.
HR Zone Mix Card
python examples/hr_zone_mix_example.pyDemonstrates the zone-distribution visualization in isolation.
Efficiency Over Time Card
python examples/efficiency_over_time_example.pyShows how rolling-window controls affect the efficiency plot.
HR vs Speed x Duration Heatmap
python examples/hr_vs_speed_duration_example.pyDemonstrates the binned relationship between duration, speed, and heart rate.
Repository Structureο
pace_view/- Core pipeline modulesdata/- Sample TCX files for local testingtests/- Pytest unit testsscripts/- Local helpers and experimentsassets/- Images and supporting artifacts
Core Components Overviewο
pace_view/data_parsing.py- Loads TCX files and optional weather contextpace_view/data_cleaning.py- Builds aligned dataframespace_view/physics.py- Computes headwind, gradient, and virtual powerpace_view/digital_twin.py- Predicts expected HR and driftpace_view/counterfactual.py- Counterfactual explanationspace_view/rationale.py- Human-readable rationalespace_view/mining.py- Mines interpretable rules using NiaARM
Data Flow (High Level)ο
Parse TCX β activity arrays + weather
Clean + align β dataframe
Physics features β headwind, gradient, virtual power
Digital twin β predicted HR and drift
Counterfactual + rationale β explanation output
Pattern mining β global rules across rides
Testingο
Run from repository root:
python -m pytest -q
Using a specific interpreter:
<path/to/your/python/>python.exe -m pytest -q
Configuration (Weather API)ο
To enable weather enrichment, provide an API key via environment variables:
WEATHER_API_KEY=<your_key_here>
Examples using ContextTrainer resolve the key centrally via
pace_view.config.get_weather_api_key().
The method checks:
Process environment variables
A project-root
.envfile (if present)
Optional manual loading using python-dotenv:
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv("WEATHER_API_KEY")
π Licenseο
This package is distributed under the MIT License:
Disclaimerο
This framework is provided as-is. There are no guarantees that it fits your purposes or that it is bug-free. Use it at your own risk.
π Further Readingο
Awesome Computational Intelligence in Sports https://github.com/firefly-cpp/awesome-computational-intelligence-in-sports
π Referencesο
Fister Jr, I., Fister, I., Iglesias, A., Galvez, A., Deb, S., & Fister, D. (2021). On deploying the Artificial Sport Trainer into practice. arXiv preprint: https://arxiv.org/abs/2109.13334
Fister Jr, I., Salcedo-Sanz, S., Iglesias, A., Fister, D., GΓ‘lvez, A., & Fister, I. (2021). New Perspectives in the Development of the Artificial Sport Trainer. Applied Sciences, 11(23), 11452.