MATH FORMULAS APPLIED TO CONNECTED SPORT

Charles Anssens
Decathlon Digital
Published in
5 min readDec 2, 2021

Introduction

At DECATHLON we design, build and sell connected sport products: GPS/HR watches, fitness trackers, treadmill, indoor-bike, rowing machines and elliptical bikes. We also have digital sport services like the Decathlon Coach app on iOS and Android (GPS and indoor tracking and coaching), and e-club, our coaching video platform for indoor sport (weight training, fitness, cardio, pilates, yoga…).

For all of these products and services we provide a complete experience that requires math formulas applied to sport. Since 2020, we distribute these formulas thanks to an API in order to standardize the calculations on each solution.
In this article, we will share with you our state of the art and what we try to achieve with this initiative.

Why these formulas in the API

With a wide ecosystem of sport devices, sport applications, in the same company we could get some divergences on calculations like kcal, elevation gain/loss… So we decided to build a common sport math formulas catalog to share the implementation for all experiences. As we did it for us, why not provide it to others via an API?
The availability through the API is also a good solution to test and validate that we are convergent on each service: every developer can test his implementation and compare the result to the reference API.

How did we proceed?

We used math formulas applied to sport for many years. Each time you synchronize a sport activity to our ecosystem we apply calculations (heart rate zone analysis, kcal calculations) but these calculations were integrated in our business logic and not available as an atomic service.
The first goal was to provide all our calculations by an atomic service in our REST API.
At this stage we got 11 formulas available through the API. At the end of 2020, we conducted a study with a sport physician and coach of french olympic athletes to complete our catalog. Following this study, we added in 2021 five new formulas on the performance analysis and fatigue.

Our domains of proficiency

We could describe our formulas catalog in three parts: formulas linked to your body, formulas to improve the data about your sport activity, and formulas to predict your performance mostly for the running sport.

Body/Health

  • Bmi_calculator (body mass indicator = weight(kg) / height (m)²)
  • Cardio_calculator Karvonen formula: % HR = (HRcurrent — HRrest) / (HRmax — HRrest)
  • HR_max_calculator (Maximum heart rate according to age and gender)
  • Weight_calculator (Ideal weight with the Lorentz formula depending on the gender)

Activity calculations

  • Distance_speed_calculator (calculate sum of distance, and speed average)
  • Elevation_calculator (calculate ascent and descent with smoothing)
  • HR_kcal_calculator (Formula to calculate kcal consumed depending on HR)
  • Met_kcal_calculator (Formula with MET)
  • On_points_calculator (On points (man) = calorie x 100 / ( 0,0726 x 30 x weight ) On points (woman) = calorie x 100 / ( 0,0626 x 30 x weight ))

Activity performance analysis

  • MAS_demi_cooper_calculator (calculate MAS with Cooper test based on the best performance during 6 minutes)
  • MAS_cooper_calculator (calculate MAS & VO2max with Cooper test based on the best performance during 12 minutes)
  • MAS_distance_time_astrand_calculator (Calculation of the MAS with the Astrand method via distance and time)
  • MAS_vo2_max_astrand_calculator (Calculation of the MAS with the Astrand method via the VO2Max)
  • Vo2_max_mas_calculator (Calculation of the VO2Max with the MAS)
  • Running_record_calculator (calculate time for a running race depending on %MAS per distance
  • Trimps_calculator (TRIMP = ( Duration (s) / 60 ) * Intensity (%) * Weighting factor | Intensity = (HRexercise — HRrest) / (HRmax — HRrest) | Weighting factor (k) = 0,86.e(1,67x) for women ; 0,64.e(1,92x) for men where x=Intensity (%))

As you can see, formulas contribute to get more data about a sport activity and contribute to follow your level of physical condition. All these data are important to analyze your practice, stay motivated and progress to reach your personal goals.

Demonstrations

We are going to apply a Cooper test with the “Running_cooper_calculator” on a GPS path of a running activity and then with the MAS estimated, we are going to get a Running_record_calculator to get estimated time (min/max) for 5km, 10km, half-marathon and marathon.

REQUEST

curl --location --request POST 'https://api.decathlon.net/sportstrackingdata​/v2/formulas/running_cooper_calculator' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{YOUR_API_KEY}}' \
--data-raw '{"locations" : {"0":{"latitude":50.6450017,"longitude":3.1435083,"elevation":30.100586},"5":{"latitude":50.6451,"longitude":3.1435433,"elevation":30.200195}
,...}
}'

RESULT

{
"VO2max": 52,
"MAS": 15014
}

As you can see, with this session of running, the Cooper test gives a MAS of 15km/h.
We are now going to use this MAS value to get a prediction of performance for a race competition.

REQUEST

curl --location --request POST 'https://api.decathlon.net/sportstrackingdata​/v2/formulas/running_record_calculator' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{YOUR_API_KEY}}' \
--data-raw '{"MAS":15014}'

RESULT

{
"5000": {
"min": 1332,
"max": 1410
},
"10000": {
"min": 2820,
"max": 2997
},
"21097": {
"min": 6323,
"max": 6744
},
"42195": {
"min": 13489,
"max": 14453
}
}

As you can see, we get an estimation with a minimum and maximum window. With this MAS of 15km/h you could achieve a 10km between 47 minutes (2820 seconds) and 50 minutes (2997 seconds).
With this information you can be more confident about your training and adapt it to follow your goal.
If you are interested in knowing more about our API and formulas, you can find below some links to discover our sport ecosystem.

Links

Glossary

  • HR: Heart Rate
  • HRrest: Heart Rate at rest
  • HRmax: Maximum Heart Rate
  • MAS: Maximum Anaerobic Speed
  • Cooper test: Running test to estimate your Vo2Max
  • TRIMP: Training Impulse, a formula to quantify the cumulated training load
  • Vo2Max: Maximum of quantity of oxygen consumed per minute per kilogram (unit: ml/min/kg)
  • MET: Metabolic Equivalent of Task (MET) — One MET equals 1 calorie per kilogram of body weight per hour
  • Kcal: The calories consumed

--

--