A comprehensive Shiny Python web application primarily for comparing FIT files from fitness devices. This tool provides statistical analysis, interactive visualizations, and LLM-powered insights for fitness data.
Note: This project is in active development. Features and interfaces may change frequently.
- Interactive Web Interface: Upload and compare multiple FIT files, with partial CSV support
- Statistical Analysis: Bias, accuracy, agreement etc.
- Interactive Visualizations: Dynamic plots with zoom, pan, and selection capabilities
- Python 3.12 or higher
- Conda (recommended) or pip
- Create the environment:
conda env create -f environment.yml- Activate the environment:
conda activate fit-diffFor AI-powered analysis features, create a .env file in the project root:
AI_KNOW_API_KEY=your_ai_know_api_key
AI_KNOW_API_URL=https://ai-know.nus.edu.sg/backend/completions/oai
API_KEY_ID=your_api_key_id
API_KEY_SECRET=your_api_key_secret
LLM_API_URL=your_llm_api_urlAI_KNOW_API_URL + AI_KNOW_API_KEY are now the default LLM path. The legacy LLM_API_URL + Cloudflare access headers remain supported as fallback.
Alternatively, install dependencies with pip:
pip install shiny==1.4.0 shinyswatch==0.9.0 fitparse garmin-fit-sdk==21.171.0
pip install numpy pandas plotly pytest python-dotenv python-duckdb scipy
pip install aiohttp requests faicons==0.2.2 shinywidgets==0.6.2Run the main Shiny application:
python fit_diff.pyThen open your browser to http://localhost:8001.
- Upload FIT Files: Use the file upload widgets to select reference and test FIT files
- Select Metrics: Choose which metrics to compare (heart rate, cadence, speed etc.)
- Configure Analysis: Set start and end times, shifting options etc.
- View Results: Examine interactive plots, statistical summaries, and AI-generated insights
Compare performance between Garmin FIT SDK and fitparse:
python benchmark_fit_parsers.pyThis tool helps determine which parser works best for your specific FIT files and use cases.
Execute the full test suite:
pytest tests/Run specific test modules:
pytest tests/test_data_processing.py
pytest tests/test_statistics.py
pytest tests/test_visualizations.pyfit-diff/
├── src/ # Main application source code
│ ├── app_server.py # Shiny server logic and reactive coordination
│ ├── app_ui.py # User interface definition and layout
│ ├── reactives_*.py # Reactive modules for different features
│ └── utils/ # Utility functions and helpers
│ ├── data_processing.py # FIT file parsing and data transformation
│ ├── statistics.py # Statistical analysis and metrics
│ ├── visualizations.py # Plot generation and styling
│ └── llm_integration.py # AI-powered analysis (optional)
├── tests/ # Test suite
│ ├── fixtures/ # Sample FIT files for testing
│ └── test_*.py # Unit tests for each module
├── sandbox/ # Development experiments and notebooks
├── fit_diff.py # Main application entry point
├── benchmark_fit_parsers.py # Parser performance comparison tool
└── environment.yml # Conda environment specification
- Data Processing: Add new parsers or metrics in
src/utils/data_processing.py - Statistics: Implement new statistical methods in
src/utils/statistics.py - Visualizations: Create new plot types in
src/utils/visualizations.py - UI Components: Add reactive components in the appropriate
src/reactives_*.pymodule, and updatesrc/reactives_ui.pyaccordingly - Server Orchestration: Update
src/app_server.pyto integrate all new additions into the reactive flow of the app