Parsing transitions in multi-sport FIT files — best practice?

Hi all,

I'm building the activity ingestion layer for Triscale.eu, a multi-sport coaching platform (triathlon, cycling, running) based in France. We're preparing to receive .FIT files from athletes via the Garmin Connect Activity API once our Developer Program access is approved.

Quick question on multi-sport file structure: when an athlete records a triathlon as a single multi-sport activity (swim → T1 → bike → T2 → run), what's the recommended way to identify the transitions in the FIT file?

From what I've read so far, it looks like multi-sport sessions are exposed as a session per sport with sport_type changes, but I'd like to confirm two points:

- Are transitions (T1/T2) emitted as their own session, or as a gap between sport sessions?
- Is there a recommended message type or flag to differentiate "real" sport segments from transitions for downstream analytics?

If anyone here has built triathlon-aware parsing on FIT files, would value a pointer to your approach.

Thanks,
Sébastien D.
Triscale.eu — multi-sport coaching platform, FR

  • If the user has transitions enabled, then transitions will be denoted in the file as their own Sessions with the sport type transition. About halfway down this page is a diagram of the a multi-sport file with transitions. 
    https://developer.garmin.com/fit/cookbook/decoding-activity-files/ 

    You can slice up the record messages based on the start time and total elapsed time of the sessions. The first_lap_index and num_lap values in the Session message can be used to match Laps to Sessions. 

    An example of triathlon-aware parsing on FIT files would be Garmin Connect.

  • Thanks Ben — very clear, especially the LINQ Where() / Within() pattern combined with First Lap Index / Lap Count for matching Laps to Sessions. The Figure 2 diagram on multi-sport sessions answers our initial question completely.

    One follow-up if you have a moment: in practice we'll see some athletes recording a full triathlon as a single multi-sport file (with the transition sessions you described), while others split swim and bike/run into separate Activity files — they start a new Activity at T1, often on older devices or out of habit. The cookbook mentions Chained FIT files in the HRM-Swim context but not directly for this multi-sport split case. Is there a recommended pattern for stitching multiple standalone Activity files into one continuous multi-sport view, or should we treat them as independent activities and offer manual linking on our side?

    Either way, thanks for the responsive answer.

    Sébastien

  • If the user is creating separate Activity files for each leg of a multi-sport event, the timestamps will be serial and the individual files will not overlap. So the data could be easily combined, appended really, or kept separate. The trick will be autodetecting this vs asking the user to manually link them. Go with what works best for your users and platform.


    The source code that goes with that article can be found here. 
    github.com/.../ActivityDecode