Computed activity fields

Hi David or others with a bit more Javascript experience,

I am trying to format my pace output as mm:ss or XXmXXs and still let it be a value that can be charted on the fitness page. I now am stuck with the following: I either have a non plottable string(7:30) or a decimal value (7.5).

Am I chasing something that is beyond the possibilities of current custom fields implementation?

1 Like

i think in this case you should revert back to SI units, e.g. seconds for time durations, meters/second for speed, and so on. Most APIs use those internally, I guess Intervals is not much different in this regard.

Internally Intervals.icu uses meters/second as Roland says. So I need some options other than .2f and so on to handle this. It is actually quite tricky to plot pace.

I have nearly finished adding support for pace formatting for custom fields.

One use case I have imagined for a very long time is a power estimate from gradient on climbs (and then a comparison with the real power). I have done some python experimenting and this has some potential.
Once plots are available, this will be really amazing! Good job @david!

I have added support for formatting custom activity fields as “pace”. The field value must be in meters/second:

4 Likes

Perfect, was just looking for this! Is this supported as a fitness page graph?

Yes for the “marker value” display but not yet for the numbers shown on the axis.

1 Like

Awesome David!

1 Like

Is there an easy way to update the custom values for past activities?

Right now after any modification, for example using the added pace feature, I have to select all the activitites which I want to have its value updated the Reprocess them. This takes a couple of minutes and later I have to recalculate my gear usage since it appears that I’ve done all these activities again.

Am I being stupid here or this is the only way to update these fields for old activities (new activities already appear with the correct values)

If the number of activities is small, you can run the script from the setup of the custom field. That will calculate the field for that activity as I found out.
Something needs to trigger the recalculation…
But it’s not logical that gear usage adds up.

That shouldn’t happen. I just re-analysed by last 3 rides and it didn’t change the gear totals.

1 Like

Hi all and apologies for this apparently simple question:
I wanted to add an activity field for “work per distance” and used David’s “distance per stroke” as template.
My simple approach was like this

which doesn’t work. I guess it is a simple script/code/field error.

many thanks in advance
alfred

Is that what you want?

activity.icu_joules/activity.distance

All the available data of an activity is here.

1 Like

yes, thats exactly what I was after, not aware of the list…

many thanks
alfred

You can now map custom activity fields to fields in messages in activity FIT files. This is where summary information about the activity is stored. The field is automatically populated with data from the FIT file if it is present. The default behaviour is to look in the session record for a matching field name or number. However you can prefix the field name/number with the name/number of the record to search in other records.

This is what the session looks like on fitfileviewer.com.

You need to re-process existing activities after adding a field:

You can do this in bulk using the activity list view:

If set the FIT file session field name is also used when the field is written to a FIT file.

Examples of non-session record fields;

  • activity.total_timer_time
  • 140.4 (field number 4 of message number 140, Garmin Venu watch training effect times 10)

The script of the custom field can be used to transform the value once it has been read:

activity.isNew ? activity.TrainingEffect / 10 : activity.TrainingEffect

This expression only does this when the activity is new or its file is reprocessed otherwise it returns it as is.

If the field has multiple values you can use array index notation to extract the one you want:

avg_left_power_phase[2]

To get the 3rd value (first has index 0).

5 Likes

This is mind-blowing. I assume they should be on first level of the fit file. I mean, they are activity fields (like the final HR recovery of garmin or the running dynamics averages), not records fields that we can show per interval (like running dynamics stream), right?

Thank you once again.

Ok, I have to read better…

Mmm… What about fields without name? I mean, there are some hidden gems like recovery HR in the “field 202”, are they recoverable? I have try “202” or “filed202”, but I don’t know if this is possible.

I have added support for fields without names. Justify use the field number e.g. “202” instead of the name. I will deploy this on Monday AM.

3 Likes