Custom activity streams from fit file messages

Custom activity streams now support computing streams from fit file messages (not just record messages) using Javascript. Note that this cannot be used with the simpler “Record Field” streams but the process for creating the stream is the same:

Tick the “Processes fit file messages” box and create a script instead of entering a record field name.

This script just grabs the heart_rate data from the record messages:

{
  for (let m of icu.fit.record) {
    data.setAt(m.timestamp.value, m.heart_rate?.value)
  }
}

Use the data array to record the stream. Note that you do not have to process only record messages. The fit object provides access to all messages in the file relevant to the activity.

You can maximise the window and run the script to see what it produces from the selected activity:

The streams are created when the activity file is processed. You need to reprocess existing activities to see new streams (Action → Reprocess file under the ride timeline chart or use the activity list view to do this in bulk).

8 Likes

I’m trying to pull total_ascent and total_descent from the FIT session. Hopefully this will allow me to make a Fitness graph in week and month chunks that display Ascent and Descent in Hiking and Alpine Skiing activities.

What am I doing wrong? (Clearly, I know zero about scripting.)

Maybe I’m supposed to follow Computed activity fields. :man_shrugging: TBH, I’m having better luck learning にほんご than trying to (understand and) script.

You are creating a custom activity stream and not a custom activity field. But I see you have those fields on your skiing activities so you figured it out?

1 Like

There’s a cross-post

1 Like

Yes, @MedTechCD set me straight. :+1:

1 Like