mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-01-26 09:01:53 +00:00
1217 lines
75 KiB
Plaintext
1217 lines
75 KiB
Plaintext
================================================================================
|
|
PROJECT MAP:
|
|
================================================================================
|
|
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/activity_parser.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• detect_file_type()
|
|
└─ Detect file format (FIT, XML, or unknown)
|
|
• parse_xml_file()
|
|
└─ Parse XML (TCX) file to extract activity metrics
|
|
• compute_gradient()
|
|
└─ Compute gradient percentage for each point using elevation c
|
|
• distance_between_points()
|
|
└─ Calculate distance between two (lat, lon) points in meters u
|
|
• parse_fit_file()
|
|
└─ Parse FIT file to extract activity metrics and detailed cycl
|
|
• get_activity_metrics()
|
|
└─ Get activity metrics from local file or Garmin API
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/cli.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• list_activities()
|
|
└─ List activities based on specified filters
|
|
• download()
|
|
└─ Download activities based on specified filters
|
|
• daemon_mode()
|
|
└─ Daemon mode operations
|
|
• migrate_activities()
|
|
└─ Migrate database to add new activity fields
|
|
• analyze_activities()
|
|
└─ Analyze activity data for cycling metrics
|
|
• reprocess_activities()
|
|
└─ Reprocess activities to calculate missing metrics
|
|
• generate_report()
|
|
└─ Generate performance reports for cycling activities
|
|
• main()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/config.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• Config
|
|
Methods:
|
|
- validate()
|
|
|
|
FUNCTIONS:
|
|
• load_config()
|
|
└─ Load environment variables from .env file
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/daemon.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• GarminSyncDaemon
|
|
Methods:
|
|
- __init__()
|
|
- start()
|
|
- _enqueue_sync()
|
|
- _enqueue_reprocess()
|
|
- _process_tasks()
|
|
- _execute_in_process_pool()
|
|
- sync_and_download()
|
|
- load_config()
|
|
- update_daemon_status()
|
|
- update_daemon_last_run()
|
|
- start_web_ui()
|
|
- signal_handler()
|
|
- is_sync_in_progress()
|
|
- stop()
|
|
- log_operation()
|
|
- count_missing()
|
|
- reprocess_activities()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/database.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• Activity
|
|
└─ Activity model representing a Garmin activity record.
|
|
Methods:
|
|
- to_dict()
|
|
• DaemonConfig
|
|
└─ Daemon configuration model.
|
|
• SyncLog
|
|
└─ Sync log model for tracking sync operations.
|
|
|
|
FUNCTIONS:
|
|
• get_legacy_session()
|
|
└─ Temporary synchronous session for migration purposes.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/fit_processor/gear_analyzer.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• SinglespeedAnalyzer
|
|
Methods:
|
|
- __init__()
|
|
- analyze_gear_ratio()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/fit_processor/power_estimator.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• PowerEstimator
|
|
Methods:
|
|
- __init__()
|
|
- calculate_power()
|
|
- estimate_peak_power()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/garmin.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• GarminClient
|
|
└─ Garmin API client for interacting with Garmin Connect servic
|
|
Methods:
|
|
- __init__()
|
|
- authenticate()
|
|
- get_activities()
|
|
- download_activity_fit()
|
|
- get_activity_details()
|
|
|
|
FUNCTIONS:
|
|
• test_download()
|
|
└─ Test function to verify download functionality
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/migrate_activities.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• migrate_activities()
|
|
└─ Migrate activities to populate fields from FIT files or Garm
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/parsers/gpx_parser.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• parse_gpx_file()
|
|
└─ Parse GPX file to extract activity metrics.
|
|
• haversine()
|
|
└─ Calculate the great circle distance between two points
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/utils.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• setup_logger()
|
|
└─ Setup logger with consistent formatting
|
|
• format_timestamp()
|
|
└─ Format timestamp string for display
|
|
• safe_filename()
|
|
└─ Make filename safe for filesystem
|
|
• bytes_to_human_readable()
|
|
└─ Convert bytes to human readable format
|
|
• validate_cron_expression()
|
|
└─ Basic validation of cron expression
|
|
• handle_db_error()
|
|
└─ Decorator for database operations with error handling
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/web/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/web/app.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/web/routes.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• ScheduleConfig
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/garminsync/web/test_ui.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• test_ui_endpoints()
|
|
└─ Test that the new UI endpoints are working correctly
|
|
• test_api_endpoints()
|
|
└─ Test that the new API endpoints are working correctly
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/migrations/versions/20240821150000_add_cycling_columns.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• upgrade()
|
|
• downgrade()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/migrations/versions/20240822165438_add_hr_and_calories_columns.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• upgrade()
|
|
• downgrade()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/migrations/versions/20240823000000_add_reprocessed_column.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• upgrade()
|
|
• downgrade()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/migrations/versions/env.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• run_migrations_offline()
|
|
└─ Run migrations in 'offline' mode.
|
|
• run_migrations_online()
|
|
└─ Run migrations in 'online' mode.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/patches/garth_data_weight.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• WeightData
|
|
Methods:
|
|
- to_localized_datetime()
|
|
- get()
|
|
- list()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: GarminSync/tests/test_sync.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• test_sync_database_with_valid_activities()
|
|
└─ Test sync_database with valid API response
|
|
• test_sync_database_with_none_activities()
|
|
└─ Test sync_database with None response from API
|
|
• test_sync_database_with_missing_fields()
|
|
└─ Test sync_database with activities missing required fields
|
|
• test_sync_database_with_existing_activities()
|
|
└─ Test sync_database doesn't duplicate existing activities
|
|
• test_sync_database_with_invalid_activity_data()
|
|
└─ Test sync_database with invalid activity data types
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/alembic/env.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• run_migrations_offline()
|
|
└─ Run migrations in 'offline' mode.
|
|
• run_migrations_online()
|
|
└─ Run migrations in 'online' mode.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/alembic/versions/ed891fdd5174_create_activity_downloads_table.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• upgrade()
|
|
• downgrade()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/analyzers/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/analyzers/workout_analyzer.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• WorkoutAnalyzer
|
|
└─ Analyzer for workout data to calculate metrics and insights.
|
|
Methods:
|
|
- __init__()
|
|
- analyze_workout()
|
|
- _calculate_summary_metrics()
|
|
- _analyze_power()
|
|
- _analyze_heart_rate()
|
|
- _analyze_speed()
|
|
- _analyze_elevation()
|
|
- _detect_intervals()
|
|
- _calculate_zone_distribution()
|
|
- _calculate_efficiency_metrics()
|
|
- _calculate_normalized_power()
|
|
- _detect_power_spikes()
|
|
- _calculate_power_distribution()
|
|
- _calculate_hr_distribution()
|
|
- _calculate_speed_distribution()
|
|
- _calculate_hr_recovery()
|
|
- _calculate_climbing_ratio()
|
|
- _analyze_gear()
|
|
- _analyze_cadence()
|
|
- _estimate_power()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/analyzers/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/analyzers/workout_analyzer.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• WorkoutAnalyzer
|
|
└─ Analyzer for workout data to calculate metrics and insights.
|
|
Methods:
|
|
- __init__()
|
|
- analyze_workout()
|
|
- _calculate_summary_metrics()
|
|
- _analyze_power()
|
|
- _analyze_heart_rate()
|
|
- _analyze_speed()
|
|
- _analyze_elevation()
|
|
- _detect_intervals()
|
|
- _calculate_zone_distribution()
|
|
- _calculate_efficiency_metrics()
|
|
- _calculate_normalized_power()
|
|
- _detect_power_spikes()
|
|
- _calculate_power_distribution()
|
|
- _calculate_hr_distribution()
|
|
- _calculate_speed_distribution()
|
|
- _calculate_hr_recovery()
|
|
- _calculate_climbing_ratio()
|
|
- _analyze_gear()
|
|
- _analyze_cadence()
|
|
- _estimate_power()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/clients/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/clients/garmin_client.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• GarminClient
|
|
└─ Client for interacting with Garmin Connect API.
|
|
Methods:
|
|
- __init__()
|
|
- authenticate()
|
|
- is_authenticated()
|
|
- get_latest_activity()
|
|
- get_activity_by_id()
|
|
- download_activity_file()
|
|
- download_activity_original()
|
|
- get_activity_summary()
|
|
- get_all_cycling_workouts()
|
|
- get_workout_by_id()
|
|
- download_workout_file()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/config/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/config/settings.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• BikeConfig
|
|
└─ Bike configuration constants.
|
|
|
|
FUNCTIONS:
|
|
• get_garmin_credentials()
|
|
└─ Get Garmin Connect credentials from environment variables.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/examples/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/examples/basic_analysis.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• analyze_workout()
|
|
└─ Analyze a single workout file and generate reports.
|
|
• main()
|
|
└─ Main function for command line usage.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/models/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/models/workout.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• WorkoutMetadata
|
|
└─ Metadata for a workout session.
|
|
• PowerData
|
|
└─ Power-related data for a workout.
|
|
• HeartRateData
|
|
└─ Heart rate data for a workout.
|
|
• SpeedData
|
|
└─ Speed and distance data for a workout.
|
|
• ElevationData
|
|
└─ Elevation and gradient data for a workout.
|
|
• GearData
|
|
└─ Gear-related data for a workout.
|
|
• WorkoutData
|
|
└─ Complete workout data structure.
|
|
Methods:
|
|
- has_power_data()
|
|
- duration_minutes()
|
|
- distance_km()
|
|
- get_summary()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/models/zones.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• ZoneDefinition
|
|
└─ Definition of a training zone.
|
|
• ZoneCalculator
|
|
└─ Calculator for various training zones.
|
|
Methods:
|
|
- get_power_zones()
|
|
- get_heart_rate_zones()
|
|
- calculate_zone_distribution()
|
|
- get_zone_for_value()
|
|
- get_cadence_zones()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/parsers/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/parsers/file_parser.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• FileParser
|
|
└─ Parser for workout files in various formats.
|
|
Methods:
|
|
- __init__()
|
|
- parse_file()
|
|
- _parse_fit()
|
|
- _extract_fit_session()
|
|
- _fit_records_to_dataframe()
|
|
- _extract_power_data()
|
|
- _extract_heart_rate_data()
|
|
- _extract_speed_data()
|
|
- _extract_elevation_data()
|
|
- _extract_gear_data()
|
|
- _distance_window_indices()
|
|
- _calculate_gradients()
|
|
- _parse_tcx()
|
|
- _parse_gpx()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/reports/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_analyzer_speed_and_normalized_naming.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• synthetic_workout_data()
|
|
└─ Create a small, synthetic workout dataset for testing.
|
|
• test_analyze_workout_includes_speed_analysis_and_normalized_summary()
|
|
└─ Verify that `analyze_workout` returns 'speed_analysis' and a
|
|
• test_backward_compatibility_aliases_present()
|
|
└─ Verify that `analyze_workout` summary includes backward-comp
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_credentials.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• CredentialsSmokeTest
|
|
Methods:
|
|
- setUp()
|
|
- tearDown()
|
|
- test_case_A_email_and_password()
|
|
- test_case_B_username_fallback_and_one_time_warning()
|
|
- test_case_C_garmin_client_credential_sourcing()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_gear_estimation.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• TestGearEstimation
|
|
Methods:
|
|
- setUp()
|
|
- tearDown()
|
|
- _create_synthetic_df()
|
|
- test_gear_ratio_estimation_basics()
|
|
- test_smoothing_and_hysteresis_mock()
|
|
- test_nan_handling()
|
|
- test_missing_signals_behavior()
|
|
- test_parser_integration()
|
|
- test_analyzer_propagation()
|
|
|
|
FUNCTIONS:
|
|
• mock_estimate_gear_series()
|
|
• mock_compute_gear_summary()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_gradients.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• TestGradientCalculations
|
|
Methods:
|
|
- setUp()
|
|
- tearDown()
|
|
- test_distance_windowing_correctness()
|
|
- test_nan_handling()
|
|
- test_fallback_distance_from_speed()
|
|
- test_clamping_behavior()
|
|
- test_smoothing_effect()
|
|
- test_performance_guard()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_packaging_and_imports.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• run_command()
|
|
└─ Helper to run a command and check for success.
|
|
• wheel_path()
|
|
└─ Builds the wheel and yields its path.
|
|
• test_editable_install_validation()
|
|
└─ Validates that an editable install is successful and the CLI
|
|
• test_wheel_distribution_validation()
|
|
└─ Validates the wheel build and a clean installation.
|
|
• test_unsupported_file_types_raise_not_implemented_error()
|
|
└─ Tests that parsing .tcx and .gpx files raises NotImplemented
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_power_estimate.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• TestPowerEstimation
|
|
Methods:
|
|
- setUp()
|
|
- tearDown()
|
|
- _create_mock_workout()
|
|
- test_outdoor_physics_basics()
|
|
- test_indoor_handling()
|
|
- test_inputs_and_fallbacks()
|
|
- test_nan_safety()
|
|
- test_clamping_and_smoothing()
|
|
- test_integration_via_analyze_workout()
|
|
- test_logging()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_report_minute_by_minute.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• report_generator()
|
|
• _create_synthetic_df()
|
|
• test_aggregate_minute_by_minute_keys()
|
|
• test_speed_and_distance_conversion()
|
|
• test_distance_from_cumulative_column()
|
|
• test_nan_safety_for_optional_metrics()
|
|
• test_all_nan_metrics()
|
|
• test_rounding_precision()
|
|
• test_power_selection_logic()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_summary_report_template.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• MockWorkoutData
|
|
Methods:
|
|
- __init__()
|
|
|
|
FUNCTIONS:
|
|
• report_generator()
|
|
• _get_full_summary()
|
|
• _get_partial_summary()
|
|
└─ Summary missing NP, IF, and TSS.
|
|
• test_summary_report_generation_with_full_data()
|
|
• test_summary_report_gracefully_handles_missing_data()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_template_rendering_normalized_vars.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• analysis_result()
|
|
└─ Get analysis result from synthetic workout data.
|
|
• test_template_rendering_with_normalized_variables()
|
|
└─ Test that HTML and Markdown templates render successfully wi
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/tests/test_workout_templates_minute_section.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• report_generator()
|
|
• _get_base_context()
|
|
└─ Provides a minimal, valid context for rendering.
|
|
• test_workout_report_renders_minute_section_when_present()
|
|
• test_workout_report_omits_minute_section_when_absent()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/utils/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/utils/gear_estimation.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• estimate_gear_series()
|
|
└─ Estimate gear per sample using speed and cadence data.
|
|
• compute_gear_summary()
|
|
└─ Compute summary statistics from gear series.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/visualizers/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/visualizers/chart_generator.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• ChartGenerator
|
|
└─ Generate various charts and visualizations for workout data.
|
|
Methods:
|
|
- __init__()
|
|
- _get_avg_max_values()
|
|
- _get_avg_max_labels()
|
|
- generate_workout_charts()
|
|
- _create_power_time_series()
|
|
- _create_heart_rate_time_series()
|
|
- _create_speed_time_series()
|
|
- _create_elevation_time_series()
|
|
- _create_power_distribution()
|
|
- _create_heart_rate_distribution()
|
|
- _create_speed_distribution()
|
|
- _create_power_zones_chart()
|
|
- _create_heart_rate_zones_chart()
|
|
- _create_power_vs_heart_rate()
|
|
- _create_power_vs_speed()
|
|
- _create_workout_dashboard()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/build/lib/visualizers/report_generator.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• ReportGenerator
|
|
└─ Generate comprehensive workout reports in various formats.
|
|
Methods:
|
|
- __init__()
|
|
- generate_workout_report()
|
|
- _prepare_report_data()
|
|
- _generate_html_report()
|
|
- _generate_pdf_report()
|
|
- _generate_markdown_report()
|
|
- generate_summary_report()
|
|
- _generate_summary_html_report()
|
|
- _aggregate_workout_data()
|
|
- _aggregate_minute_by_minute()
|
|
- _format_duration()
|
|
- _format_distance()
|
|
- _format_speed()
|
|
- _format_power()
|
|
- _format_heart_rate()
|
|
- create_report_templates()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/clients/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/clients/garmin_client.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• GarminClient
|
|
└─ Client for interacting with Garmin Connect API.
|
|
Methods:
|
|
- __init__()
|
|
- authenticate()
|
|
- is_authenticated()
|
|
- get_latest_activity()
|
|
- get_activity_by_id()
|
|
- download_activity_file()
|
|
- download_activity_original()
|
|
- get_activity_summary()
|
|
- get_all_activities()
|
|
- get_all_cycling_workouts()
|
|
- get_workout_by_id()
|
|
- download_workout_file()
|
|
- download_all_workouts()
|
|
- download_latest_workout()
|
|
|
|
FUNCTIONS:
|
|
• calculate_sha256()
|
|
└─ Calculate the SHA256 checksum of a file.
|
|
• upsert_activity_download()
|
|
└─ Upsert an activity download record in the database.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/config/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/config/settings.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• BikeConfig
|
|
└─ Bike configuration constants.
|
|
|
|
FUNCTIONS:
|
|
• get_garmin_credentials()
|
|
└─ Get Garmin Connect credentials from environment variables.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/db/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/db/models.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• ActivityDownload
|
|
Methods:
|
|
- __repr__()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/db/session.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• get_db()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/examples/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/examples/basic_analysis.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• analyze_workout()
|
|
└─ Analyze a single workout file and generate reports.
|
|
• main()
|
|
└─ Main function for command line usage.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/garmin_download_fix.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• download_activity_file()
|
|
└─ Download activity file in specified format.
|
|
• download_activity_original()
|
|
└─ Download original activity file (usually FIT format in a ZIP
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/main.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• GarminAnalyser
|
|
└─ Main application class.
|
|
Methods:
|
|
- __init__()
|
|
- _apply_analysis_overrides()
|
|
- analyze_file()
|
|
- batch_analyze_directory()
|
|
- download_workouts()
|
|
- reanalyze_workouts()
|
|
- show_config()
|
|
- generate_outputs()
|
|
|
|
FUNCTIONS:
|
|
• setup_logging()
|
|
└─ Set up logging configuration.
|
|
• parse_args()
|
|
└─ Parse command line arguments.
|
|
• main()
|
|
└─ Main application entry point.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/models/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/models/workout.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• WorkoutMetadata
|
|
└─ Metadata for a workout session.
|
|
• PowerData
|
|
└─ Power-related data for a workout.
|
|
• HeartRateData
|
|
└─ Heart rate data for a workout.
|
|
• SpeedData
|
|
└─ Speed and distance data for a workout.
|
|
• ElevationData
|
|
└─ Elevation and gradient data for a workout.
|
|
• GearData
|
|
└─ Gear-related data for a workout.
|
|
• WorkoutData
|
|
└─ Complete workout data structure.
|
|
Methods:
|
|
- has_power_data()
|
|
- duration_minutes()
|
|
- distance_km()
|
|
- get_summary()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/models/zones.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• ZoneDefinition
|
|
└─ Definition of a training zone.
|
|
• ZoneCalculator
|
|
└─ Calculator for various training zones.
|
|
Methods:
|
|
- get_power_zones()
|
|
- get_heart_rate_zones()
|
|
- calculate_zone_distribution()
|
|
- get_zone_for_value()
|
|
- get_cadence_zones()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/parsers/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/parsers/file_parser.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• FileParser
|
|
└─ Parser for workout files in various formats.
|
|
Methods:
|
|
- __init__()
|
|
- parse_file()
|
|
- _parse_fit()
|
|
- _extract_fit_session()
|
|
- _fit_records_to_dataframe()
|
|
- _extract_power_data()
|
|
- _extract_heart_rate_data()
|
|
- _extract_speed_data()
|
|
- _extract_elevation_data()
|
|
- _extract_gear_data()
|
|
- _distance_window_indices()
|
|
- _calculate_gradients()
|
|
- _parse_tcx()
|
|
- _parse_gpx()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/reports/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/setup.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/test_installation.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• test_imports()
|
|
└─ Test that all modules can be imported successfully.
|
|
• test_configuration()
|
|
└─ Test configuration loading.
|
|
• test_basic_functionality()
|
|
└─ Test basic functionality with mock data.
|
|
• test_dependencies()
|
|
└─ Test that all required dependencies are available.
|
|
• main()
|
|
└─ Run all tests.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_analyzer_speed_and_normalized_naming.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• synthetic_workout_data()
|
|
└─ Create a small, synthetic workout dataset for testing.
|
|
• test_analyze_workout_includes_speed_analysis_and_normalized_summary()
|
|
└─ Verify that `analyze_workout` returns 'speed_analysis' and a
|
|
• test_backward_compatibility_aliases_present()
|
|
└─ Verify that `analyze_workout` summary includes backward-comp
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_credentials.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• CredentialsSmokeTest
|
|
Methods:
|
|
- setUp()
|
|
- tearDown()
|
|
- test_case_A_email_and_password()
|
|
- test_case_B_username_fallback_and_one_time_warning()
|
|
- test_case_C_garmin_client_credential_sourcing()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_download_missing.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• TestDownloadMissing
|
|
└─ Test missing download functionality with --missing and --dry
|
|
Methods:
|
|
- setup_and_teardown()
|
|
- _clean_database()
|
|
- test_get_downloaded_activity_ids_from_db()
|
|
- test_get_downloaded_activity_ids_empty_db()
|
|
- test_get_downloaded_activity_ids_mixed_status()
|
|
- test_find_missing_activities()
|
|
- test_find_missing_activities_none_missing()
|
|
- test_find_missing_activities_limit()
|
|
- test_download_missing_activities_dry_run()
|
|
- test_download_missing_activities_real_run()
|
|
- test_download_missing_activities_with_limit()
|
|
- test_download_missing_activities_with_force()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_download_tracking.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• TestDownloadTracking
|
|
└─ Test download tracking functionality.
|
|
Methods:
|
|
- setup_and_teardown()
|
|
- test_upsert_activity_download_success()
|
|
- test_upsert_activity_download_failure()
|
|
- test_upsert_activity_download_update_existing()
|
|
- test_calculate_sha256()
|
|
- test_should_skip_download_exists_and_matches()
|
|
- test_should_skip_download_exists_checksum_mismatch()
|
|
- test_should_skip_download_file_missing()
|
|
- test_should_skip_download_no_record()
|
|
- test_download_activity_with_db_integration()
|
|
- test_force_download_override()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_gear_estimation.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• TestGearEstimation
|
|
Methods:
|
|
- setUp()
|
|
- tearDown()
|
|
- _create_synthetic_df()
|
|
- test_gear_ratio_estimation_basics()
|
|
- test_smoothing_and_hysteresis_mock()
|
|
- test_nan_handling()
|
|
- test_missing_signals_behavior()
|
|
- test_parser_integration()
|
|
- test_analyzer_propagation()
|
|
|
|
FUNCTIONS:
|
|
• mock_estimate_gear_series()
|
|
• mock_compute_gear_summary()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_gradients.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• TestGradientCalculations
|
|
Methods:
|
|
- setUp()
|
|
- tearDown()
|
|
- test_distance_windowing_correctness()
|
|
- test_nan_handling()
|
|
- test_fallback_distance_from_speed()
|
|
- test_clamping_behavior()
|
|
- test_smoothing_effect()
|
|
- test_performance_guard()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_packaging_and_imports.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• run_command()
|
|
└─ Helper to run a command and check for success.
|
|
• wheel_path()
|
|
└─ Builds the wheel and yields its path.
|
|
• test_editable_install_validation()
|
|
└─ Validates that an editable install is successful and the CLI
|
|
• test_wheel_distribution_validation()
|
|
└─ Validates the wheel build and a clean installation.
|
|
• test_unsupported_file_types_raise_not_implemented_error()
|
|
└─ Tests that parsing .tcx and .gpx files raises NotImplemented
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_power_estimate.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• TestPowerEstimation
|
|
Methods:
|
|
- setUp()
|
|
- tearDown()
|
|
- _create_mock_workout()
|
|
- test_outdoor_physics_basics()
|
|
- test_indoor_handling()
|
|
- test_inputs_and_fallbacks()
|
|
- test_nan_safety()
|
|
- test_clamping_and_smoothing()
|
|
- test_integration_via_analyze_workout()
|
|
- test_logging()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_report_minute_by_minute.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• report_generator()
|
|
• _create_synthetic_df()
|
|
• test_aggregate_minute_by_minute_keys()
|
|
• test_speed_and_distance_conversion()
|
|
• test_distance_from_cumulative_column()
|
|
• test_nan_safety_for_optional_metrics()
|
|
• test_all_nan_metrics()
|
|
• test_rounding_precision()
|
|
• test_power_selection_logic()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_summary_report_template.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• MockWorkoutData
|
|
Methods:
|
|
- __init__()
|
|
|
|
FUNCTIONS:
|
|
• report_generator()
|
|
• _get_full_summary()
|
|
• _get_partial_summary()
|
|
└─ Summary missing NP, IF, and TSS.
|
|
• test_summary_report_generation_with_full_data()
|
|
• test_summary_report_gracefully_handles_missing_data()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_template_rendering_normalized_vars.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• analysis_result()
|
|
└─ Get analysis result from synthetic workout data.
|
|
• test_template_rendering_with_normalized_variables()
|
|
└─ Test that HTML and Markdown templates render successfully wi
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/tests/test_workout_templates_minute_section.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• report_generator()
|
|
• _get_base_context()
|
|
└─ Provides a minimal, valid context for rendering.
|
|
• test_workout_report_renders_minute_section_when_present()
|
|
• test_workout_report_omits_minute_section_when_absent()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/utils/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/utils/gear_estimation.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• estimate_gear_series()
|
|
└─ Estimate gear per sample using speed and cadence data.
|
|
• compute_gear_summary()
|
|
└─ Compute summary statistics from gear series.
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/visualizers/__init__.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
(No classes or functions found)
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/visualizers/chart_generator.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• ChartGenerator
|
|
└─ Generate various charts and visualizations for workout data.
|
|
Methods:
|
|
- __init__()
|
|
- _get_avg_max_values()
|
|
- _get_avg_max_labels()
|
|
- generate_workout_charts()
|
|
- _create_power_time_series()
|
|
- _create_heart_rate_time_series()
|
|
- _create_speed_time_series()
|
|
- _create_elevation_time_series()
|
|
- _create_power_distribution()
|
|
- _create_heart_rate_distribution()
|
|
- _create_speed_distribution()
|
|
- _create_power_zones_chart()
|
|
- _create_heart_rate_zones_chart()
|
|
- _create_power_vs_heart_rate()
|
|
- _create_power_vs_speed()
|
|
- _create_workout_dashboard()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: Garmin_Analyser/visualizers/report_generator.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
CLASSES:
|
|
• ReportGenerator
|
|
└─ Generate comprehensive workout reports in various formats.
|
|
Methods:
|
|
- __init__()
|
|
- generate_workout_report()
|
|
- _prepare_report_data()
|
|
- _generate_html_report()
|
|
- _generate_pdf_report()
|
|
- _generate_markdown_report()
|
|
- generate_summary_report()
|
|
- _generate_summary_html_report()
|
|
- _aggregate_workout_data()
|
|
- _aggregate_minute_by_minute()
|
|
- _format_duration()
|
|
- _format_distance()
|
|
- _format_speed()
|
|
- _format_power()
|
|
- _format_heart_rate()
|
|
- create_report_templates()
|
|
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
FILE: python_project_mapper.py
|
|
────────────────────────────────────────────────────────────────────────────────
|
|
|
|
FUNCTIONS:
|
|
• get_docstring()
|
|
└─ Extract docstring from a node.
|
|
• analyze_file()
|
|
└─ Analyze a Python file and extract structure.
|
|
• generate_project_map()
|
|
└─ Generate a project map for LLM consumption. |