mirror of
https://github.com/sstent/FitTrack_ReportGenerator.git
synced 2026-01-27 09:32:12 +00:00
This commit introduces the initial version of the FitTrack Report Generator, a FastAPI application for analyzing workout files. Key features include: - Parsing of FIT, TCX, and GPX workout files. - Analysis of power, heart rate, speed, and elevation data. - Generation of summary reports and charts. - REST API for single and batch workout analysis. The project structure has been set up with a `src` directory for core logic, an `api` directory for the FastAPI application, and a `tests` directory for unit, integration, and contract tests. The development workflow is configured to use Docker and modern Python tooling.
2.3 KiB
2.3 KiB
GarminSync Workflows
Migration Workflow
Purpose
Add new columns to database and populate with activity metrics
Trigger
python cli.py migrate
Steps
- Add required columns to activities table:
- activity_type (TEXT)
- duration (INTEGER)
- distance (REAL)
- max_heart_rate (INTEGER)
- avg_power (REAL)
- calories (INTEGER)
- For each activity:
- Parse metrics from local FIT/XML files
- Fetch from Garmin API if local files missing
- Update database fields
- Commit changes
- Report migration status
Error Handling
- Logs errors per activity
- Marks unprocessable activities as "Unknown"
- Continues processing other activities on error
Sync Workflow
Purpose
Keep local database synchronized with Garmin Connect
Triggers
- CLI commands (
list,download) - Scheduled daemon (every 6 hours by default)
- Web UI requests
Core Components
sync_database(): Syncs activity metadatadownload(): Fetches missing FIT files- Daemon: Background scheduler and web UI
Process Flow
- Authenticate with Garmin API
- Fetch latest activities
- For each activity:
- Parse metrics from FIT/XML files
- Fetch from Garmin API if local files missing
- Update database fields
- Download missing activity files
- Update sync timestamps
- Log operations
Database Schema
erDiagram
activities {
integer activity_id PK
string start_time
string activity_type
integer duration
float distance
integer max_heart_rate
integer avg_heart_rate
float avg_power
integer calories
string filename
boolean downloaded
string created_at
string last_sync
}
daemon_config {
integer id PK
boolean enabled
string schedule_cron
string last_run
string next_run
string status
}
sync_logs {
integer id PK
string timestamp
string operation
string status
string message
integer activities_processed
integer activities_downloaded
}
Key Notes
- Data directory:
data/(configurable via DATA_DIR) - Web UI port: 8080 (default)
- Downloaded files:
activity_{id}_{timestamp}.fit - Metrics include: heart rate, power, calories, distance