mirror of
https://github.com/sstent/FitTrack_ReportGenerator.git
synced 2025-12-06 08:01:40 +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.
3.2 KiB
3.2 KiB
Data Model
Entities
User
- Description: Represents a user of the system, primarily for storing personalized settings.
- Fields:
id: Unique identifier (e.g., UUID)ftp_value: Configured Functional Threshold Power (float, nullable, default value if null)
- Relationships: One-to-many with
WorkoutAnalysis(a user can have multiple analyses). - Validation Rules:
ftp_valuemust be a positive number if set.
WorkoutAnalysis
- Description: Represents the result of analyzing a single workout file. This entity links a user to their analyzed workout data.
- Fields:
id: Unique identifier (e.g., UUID)user_id: Foreign key toUser.idfile_name: Original name of the workout file (string)analysis_date: Timestamp of when the analysis was performed (datetime)status: Status of the analysis (e.g., 'completed', 'failed', 'processing')summary_metrics: JSONB field for storing overall workout summary metrics (e.g., total distance, duration, average speed, etc.)report_path: Path to the generated report (string)chart_paths: JSONB field for storing paths to generated charts (e.g.,{'power_curve': '/path/to/chart.png'})
- Relationships: Many-to-one with
User.
WorkoutData (Conceptual/In-Memory Structure)
- Description: Represents the complete raw and processed data for a single workout session. This is primarily an in-memory object during analysis and its key components are persisted in
WorkoutAnalysis. - Fields:
metadata:WorkoutMetadataobjecttime_series_data: Pandas DataFrame containing raw time-series data (e.g., timestamp, power, heart rate, speed, elevation)power_data:PowerDataobjectheart_rate_data:HeartRateDataobjectspeed_data:SpeedDataobject (derived from time-series)elevation_data:ElevationDataobject (derived from time-series)
WorkoutMetadata
- Description: Metadata extracted from the workout file.
- Fields:
start_time: Datetime of workout startduration: Total duration (timedelta or seconds)device: Device used for recording (string)file_type: Original file type (e.g., 'FIT', 'TCX', 'GPX')
PowerData
- Description: Contains all power-related analysis results.
- Fields:
raw_power_stream: List of power valuesaverage_power: Floatnormalized_power: Floatintensity_factor: Floattraining_stress_score: Floatzone_distribution: Dictionary/JSONB of time spent in each power zone
HeartRateData
- Description: Contains all heart-rate-related analysis results.
- Fields:
raw_hr_stream: List of heart rate valuesaverage_hr: Floatmax_hr: Integerzone_distribution: Dictionary/JSONB of time spent in each heart rate zone
ZoneCalculator (Utility)
- Description: A utility class/module for defining and calculating training zones based on user-specific thresholds (like FTP) or default values.
- Fields: (Methods for calculation, not data fields)
calculate_power_zones(ftp, max_power)calculate_heart_rate_zones(max_hr)