Data Science and Fitness Workouts

I probably do a lot of sports. I go jogging, swimming and love functional- and Crossfit training. Recently I also attended my first Hyrox competition. I really enjoyed that challenge, and currently I’m preparing for the next season. Hence, I need a way to analyze the performance in my workouts, track my results and keep an eye on my nutrition. Most people would probably use an app for that. In fact, I do too. For my workouts I use Polar Flow and for my nutrition I use FDDB. I like the fact, that the Polar Flow lets me export my data in plain CSV or GPX format. Most of the information from FDDB is freely available anyway. So it’s basically just a matter of copy and pasting the data from the website into an Excel sheet or similar if I wanted to export it.

Many people claim that nowadays Jupyter and Python is the way to go when it comes to data analysis. I was curious how well Wolfram Mathematica would perform. So I put together some code that lets me analyze my workouts and that optimizes my meals in terms of protein and carbohydrates, fat and fiber.

Getting the data into Mathematica was straightforward. There are built-in functions to read CSV, GPX, and Excel sheets. I converted most of them in Datasets. Getting the average heart rate of a workout or the number of calories consumed on a particular day was then usually done with 2 or 3 lines of code. Also, Mathematica provides a huge variety of visualizations and plots to explore the data.

Optimizing food quantities can be formulated as a linear program. Formulae for your total daily energy needs are easily implemented in Mathematica as well. Hence, also that worked really well.

The whole thing is work in progress, but the code is hosted on Gitlab. Feel free to look at it.


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

Mathematician and
Software Engineer

Researcher, Engineer, Tinkerer, Scholar, Philosopher, and Hyrox afficionado