Commit graph

18 commits

Author SHA1 Message Date
Tim Zöller
f4be439002 Add GPX file support for activity imports
This commit adds comprehensive GPX file support alongside existing FIT file support, enabling users to import activities from Strava, Komoot, and other GPS apps.

## Key Features

### Core Components
- **GpxParser**: Full GPX 1.1 parsing with Garmin TrackPointExtension support
- **GpxFileValidator**: Validation for GPX file format and structure
- **ActivityFileService**: Unified service with automatic format detection (FIT/GPX)
- **ParsedActivityData**: Common data structure for both FIT and GPX files

### GPX Parsing Capabilities
- GPS track point extraction (latitude, longitude, elevation, timestamp)
- Garmin extension data (heart rate, cadence, temperature)
- Activity type detection from GPX metadata
- Distance calculation using Haversine formula
- Elevation gain/loss calculation
- Speed calculation from consecutive GPS points
- Speed smoothing to remove GPS artifacts
- Timezone detection from GPS coordinates
- Moving time vs. stopped time analysis

### Database Changes
- Migration V15: Renamed raw_fit_file → raw_activity_file
- Added source_file_format column (FIT/GPX) with constraint
- Index on source_file_format for performance
- Updated Activity entity with new fields

### Controller & UI Updates
- ActivityController: Now handles both FIT and GPX uploads
- Upload form: Updated to accept .fit and .gpx files
- Help text: Clarified both formats are supported

### Testing
- GpxParserIntegrationTest: 9 comprehensive tests with real GPX file
- Tests cover: parsing, validation, heart rate extraction, distance calculation,
  elevation metrics, speed calculation, chronological ordering, smoothing
- Fixed TrainingLoadServiceTest date issue (testDate outside 30-day window)
- All 97 unit tests passing (integration tests require Docker)

### Technical Details
- Supports GPX 1.0 and 1.1 specifications
- Handles multiple track segments
- Processes Garmin TrackPointExtension v1 and v2
- Same track simplification as FIT (Douglas-Peucker algorithm)
- Consistent JSONB storage format for track points
- Compatible with existing analytics, heatmaps, and image generation

## Testing Summary
-  9/9 GpxParserIntegrationTest tests passing
-  4/4 FitParserIntegrationTest tests passing
-  14/14 FitFileServiceTest tests passing
-  97/97 total unit tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-02 13:31:05 +01:00
Tim Zöller
d3dbf8e80a Tests 2025-12-05 20:38:53 +01:00
Tim Zöller
9e428a0499 Nicer sharepics 2025-12-04 22:39:15 +01:00
Tim Zöller
ac04dbf352 Nice things 2025-12-04 13:14:30 +01:00
Tim Zöller
7e4b1d50d7 Nice things 2025-12-04 13:04:08 +01:00
Tim Zöller
67a8aad4f1 Nice things 2025-12-04 12:53:12 +01:00
Tim Zöller
362680f774 Nice things 2025-12-04 12:44:18 +01:00
Tim Zöller
da7d58b548 Nice things 2025-12-04 09:09:12 +01:00
Tim Zöller
facade014a Notification System 2025-12-04 08:59:44 +01:00
Tim Zöller
a399179bf6 More graphs 2025-12-04 08:19:53 +01:00
Tim Zöller
37d0e3132b Follower UI 2025-12-04 08:09:44 +01:00
Tim Zöller
301364b8a7 Moar federation 2025-12-03 22:54:54 +01:00
Tim Zöller
655a43a34c Moar federation 2025-12-03 21:55:33 +01:00
Tim Zöller
ac53f04e0a MVP done 2025-11-29 09:56:55 +01:00
Tim Zöller
c1729a629d More vibin 2025-11-28 21:04:38 +01:00
Tim Zöller
1901daf5ce More ActivityPub 2025-11-28 09:00:07 +01:00
Tim Zöller
fe5bc54e92 Spring Boot Setup, Start of ActivitiPub 2025-11-27 23:31:03 +01:00
Tim Zöller
0bc4fb3118 Fit File Processing and Persistence 2025-11-27 22:59:45 +01:00