Skip to main content

ActivityInsights

Comprehensive analytics data for a time window of activities, including aggregated statistics, trends, and visualizations.
windowStart
Date
required
Start of the analysis time window
windowEnd
Date
required
End of the analysis time window
isPartial
Bool
required
Whether the data is incomplete for the window
heatmapDays
[HeatmapDay]
required
Daily activity data for heatmap visualization
heatmapView
HeatmapViewModel
required
View model for rendering heatmap UI
totalActivities
Int
required
Total number of activities in the window
totalMiles
Double
required
Total distance covered in miles
totalMovingHours
Double
required
Total hours spent moving across all activities
totalElevationGainMeters
Double
required
Total elevation gain in meters
totalKudos
Int
required
Total kudos received across all activities
currentStreakDays
Int
required
Current active streak in days
longestStreakDays
Int
required
Longest streak achieved in days
weeklyVolumes
[WeeklyVolume]
required
Weekly training volume breakdown
trainingRhythm
[TrainingRhythmCell]
required
Heatmap of training patterns by weekday and hour
maxRhythmCount
Int
required
Maximum activity count in any training rhythm cell
typeBreakdown
[ActivityTypeBreakdown]
required
Distribution of activities by type
peakDays
[PeakDay]
required
Days with highest metrics
peakActivities
[PeakActivity]
required
Individual activities with standout performance
pacePoints
[PacePoint]
Pace data points for trend analysis (default: [])
effortPoints
[EffortPoint]
Effort/suffer score data points (default: [])
weeklyEffort
[WeeklyEffort]
Weekly effort metrics (default: [])

Example

let insights = ActivityInsights(
    windowStart: startDate,
    windowEnd: endDate,
    isPartial: false,
    heatmapDays: heatmapData,
    heatmapView: viewModel,
    totalActivities: 145,
    totalMiles: 523.4,
    totalMovingHours: 68.5,
    totalElevationGainMeters: 12450.0,
    totalKudos: 892,
    currentStreakDays: 12,
    longestStreakDays: 34,
    weeklyVolumes: volumes,
    trainingRhythm: rhythmData,
    maxRhythmCount: 15,
    typeBreakdown: breakdown,
    peakDays: peaks,
    peakActivities: topActivities,
    pacePoints: paceData,
    effortPoints: effortData,
    weeklyEffort: weeklyEffortData
)

Build docs developers (and LLMs) love