9.3 KiB
Tracks Feature Analysis
Overview
The Tracks feature in Dawarich is a streamlined GPS route tracking system that automatically organizes location data into meaningful journeys. It transforms raw GPS points into structured track records that represent individual trips, walks, drives, or any other movement patterns using a simplified, unified architecture.
Core Concept
A Track represents a continuous journey or route taken by a user. Unlike individual GPS points that are timestamped location coordinates, tracks provide higher-level information about complete journeys including start/end times, total distance, duration, speed statistics, and elevation changes.
Key Components
Track Data Structure
Each track contains:
- Temporal Information: Start and end timestamps marking the journey boundaries
- Spatial Information: Geographic path represented as a LineString containing all route coordinates
- Distance Metrics: Total distance traveled (stored in meters for consistency)
- Speed Analytics: Average speed throughout the journey (stored in km/h)
- Duration Data: Total time spent on the journey (in seconds)
- Elevation Statistics: Gain, loss, maximum, and minimum altitude measurements
- User Association: Links each track to its owner
Simplified Track Generation Process
The system uses a unified, streamlined approach to create tracks:
- Unified Processing: Single service handles both bulk and incremental processing
- Smart Segmentation: Analyzes point sequences to identify natural break points between journeys
- Real-time Creation: Immediately processes new GPS data as it arrives for responsive user experience
- Intelligent Batching: Optimizes processing load while maintaining responsiveness
Segmentation Intelligence
The system uses intelligent algorithms to determine where one track ends and another begins:
- Time-based Segmentation: Identifies gaps in GPS data that exceed configurable time thresholds (default: 60 minutes)
- Distance-based Segmentation: Detects sudden location jumps that indicate teleportation or data gaps (default: 500 meters)
- Configurable Thresholds: Users can adjust sensitivity through distance and time parameters
- Minimum Requirements: Ensures tracks have sufficient data points to be meaningful (minimum 2 points)
Statistics Calculation
For each track, the system calculates comprehensive statistics:
- Distance Calculation: Uses geographical formulas to compute accurate distances between points
- Speed Analysis: Calculates average speed while handling stationary periods appropriately
- Elevation Processing: Analyzes altitude changes to determine climbs and descents
- Duration Computation: Accounts for actual movement time vs. total elapsed time
Processing Modes
Bulk Processing
- Processes all unassigned GPS points for a user at once
- Suitable for initial setup or historical data migration
- Optimized for performance with large datasets
- Triggered via scheduled job or manual execution
Incremental Processing
- Handles new GPS points as they arrive in real-time
- Maintains system responsiveness during continuous tracking
- Uses smart batching to optimize performance
- Provides immediate user feedback
Smart Real-time Processing
- Immediate Processing: Triggers instant track creation for obvious track boundaries (30+ minute gaps, 1+ km jumps)
- Batched Processing: Groups continuous tracking points for efficient processing
- Automatic Optimization: Reduces system load while maintaining user experience
User Experience Features
Interactive Map Visualization
- Track Rendering: Displays tracks as colored paths on interactive maps
- Hover Information: Shows track details when users hover over routes
- Click Interactions: Provides detailed statistics and journey markers
- Start/End Markers: Visual indicators for journey beginning and completion points
Real-time Updates
- WebSocket Integration: Pushes track updates to connected clients immediately
- Live Tracking: Shows new tracks as they're created from incoming GPS data
- Automatic Refresh: Updates map display without requiring page reloads
Filtering and Navigation
- Time-based Filtering: Allows users to view tracks within specific date ranges
- Distance Filtering: Enables filtering by journey length or duration
- Visual Controls: Provides opacity and visibility toggles for track display
Technical Architecture
Simplified Design
- Single Service: Unified
TrackServicehandles all track operations - Single Job:
TrackProcessingJobmanages both bulk and incremental processing - Minimal Dependencies: Eliminated Redis buffering and complex strategy patterns
- Streamlined Architecture: Reduced from 16 files to 4 core components
Core Components
- TrackService: Main service class containing all track processing logic
- TrackProcessingJob: Background job for asynchronous track processing
- Point Model: Simplified with smart track processing triggers
- Track Model: Unchanged, maintains existing functionality and WebSocket broadcasting
Processing Intelligence
- Smart Triggering: Immediate processing for track boundaries, batched for continuous tracking
- Threshold-based Segmentation: Configurable time (60 min) and distance (500m) thresholds
- Automatic Optimization: Reduces database load while maintaining responsiveness
- Error Handling: Comprehensive error management and reporting
Data Management
Storage Architecture
- Efficient Schema: Optimized database structure for track storage and retrieval
- Geographic Indexing: Enables fast spatial queries for map-based operations
- User Isolation: Ensures each user's tracks remain private and separate
Import/Export Capabilities
- GPX Support: Imports tracks from standard GPS Exchange Format files
- Multiple Sources: Handles data from various GPS tracking applications
- Format Conversion: Transforms different input formats into standardized track records
Performance Optimization
- Unified Processing: Single service eliminates complexity and reduces overhead
- Smart Batching: Job deduplication prevents queue overflow during high activity
- Efficient Queries: Optimized database queries for point loading and track creation
- Minimal Memory Usage: Eliminated Redis buffering in favor of direct processing
Integration Points
GPS Data Sources
- OwnTracks Integration: Processes location data from OwnTracks applications
- File Imports: Handles GPX and other standard GPS file formats
- API Endpoints: Accepts GPS data from external applications and services
Real-time Features
- WebSocket Broadcasting: Immediate track updates to connected clients
- Live Tracking: Shows new tracks as they're created from incoming GPS data
- Automatic Refresh: Updates map display without requiring page reloads
Quality Assurance
Data Validation
- Input Validation: Ensures GPS points meet quality standards before processing
- Duplicate Detection: Prevents creation of redundant tracks from the same data
- Error Handling: Gracefully manages corrupted or incomplete GPS data
System Reliability
- Simplified Testing: Reduced complexity enables comprehensive test coverage
- Performance Monitoring: Built-in logging and error reporting
- Graceful Degradation: System continues functioning even with individual point failures
Configuration and Customization
User Settings
- Threshold Configuration: Allows users to adjust segmentation sensitivity
- Display Preferences: Customizes how tracks appear on maps
- Privacy Controls: Manages track visibility and sharing settings
System Configuration
- Performance Tuning: Adjusts processing parameters for optimal performance
- Resource Management: Controls background job execution and resource usage
- Scaling Options: Configures system behavior for different usage patterns
Benefits and Applications
Personal Tracking
- Journey Documentation: Creates permanent records of personal travels and activities
- Activity Analysis: Provides insights into movement patterns and habits
- Historical Records: Maintains searchable archive of past journeys
Real-time Experience
- Immediate Feedback: Tracks appear instantly for obvious journey boundaries
- Responsive Interface: Smart batching maintains UI responsiveness
- Live Updates: Real-time track creation and broadcasting
Data Organization
- Automatic Categorization: Organizes raw GPS data into meaningful journey segments
- Reduced Complexity: Simplifies large datasets into manageable track records
- Enhanced Searchability: Enables efficient searching and filtering of location history
Visualization Enhancement
- Map Clarity: Reduces visual clutter by grouping related GPS points
- Interactive Features: Provides rich interaction capabilities for exploring journey data
- Statistical Insights: Offers comprehensive analytics about travel patterns
The Tracks feature represents a streamlined approach to GPS data management that transforms raw location information into meaningful, organized, and interactive journey records while maintaining high performance and providing real-time user experience through simplified, maintainable architecture.