# Custom interval fields

**URL:** <https://forum.intervals.icu/t/custom-interval-fields/25942>\
**Category:** Uncategorized\
**Created:** [27 December 2022 09:54 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942 "2022-12-27T09:54:04Z")\
**Posts on this page:** 1\
**Showing post:** 46

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [22 March 2024 12:03 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/46 "2024-03-22T12:03:54Z")

</div>

Here’s one that calculates Running Efficiency per Interval

> if ((activity.type == “Run” || activity.type == “VirtualRun”) && !activity.icu\_ignore\_hr)  
> {  
> gaStr = streams.get(“ga\_velocity”).data  
> xgap = 0  
> gaSmooth = 0  
> smoothBy = 30 //seconds  
> count = interval.end\_index - interval.start\_index  
> for (let i=0; i\<count; i++)  
> {  
> gaSmooth = gaSmooth + gaStr[interval.start\_index + i]  
> if(i%smoothBy == 0 || i+1 == count)  
> {  
> xgap = xgap + ((gaSmooth/smoothBy ) \*\* 4)  
> gaSmooth = 0  
> }  
> }  
> //calculates normalized average  
> xgap = (xgap / Math.ceil(count/smoothBy))\*\*(1/4)  
> eff = (xgap \* 60) / (activity.average\_heartrate)  
> eff = +eff.toFixed(2)  
> }

---

_[View the full topic](https://forum.intervals.icu/t/custom-interval-fields/25942)._
