Power BI and Strava – play with data around sport activities and your weight
It is known that passion gives us the strongest kick to take an action and boosts our creativity. When it comes to the same passion for work, the effects of this combo can be surprising! Read the latest article by Paweł Mitruś, our Data Architect, and find out what he has created with Power BI and Strava!
Using professional skills to get closer to personal goals
I have been working with data since the beginning of my professional career. I have started from data warehouses and business intelligence solutions, but since cloud got more popular and started offering dedicated data services I am trying to move along this direction. On the other hand, in my spare time I devote myself to one particular sport discipline called triathlon (swim, bike, run). How do all these things come together? The disciplines I mentioned (especially bike) bring tons of interesting data you can analyze! I would like to show you what I have come up with lately.
More barriers — a better solution
I am convinced that all of you have struggled with exploring new tools, libraries, and frameworks without any real use cases behind it. At least for me, it gets annoying. Trying out something with no reason could be fine on a high, “get to know” level, but if you want to go further it is recommended to work on a clearly specified goal. I came up with an idea of exploring data about my sport activities. I thought it would be nice to connect it all together with weight and nutrition stats which I had been collecting over the previous few weeks, because of the targets set in triathlon (I wanted to lose weight, down to 75 kg, to perform better). It was an exciting perspective — to get insights about myself in a very sophisticated way.
How I combined the elements and achieved satisfying results
Every single data project requires defining data sources. In this case there are two:
Strava — athlete’s social network Excel — my personal database and interface to collect information about my daily nutrition and weight Power BI — ETL, modeling, visualizations
I used Power BI to play with my data. At ITMAGINATION we use Power BI to deliver meaningful insights for our clients every day. Based on our wide experience from numerous tickets, no single solution let you wrangle data from different sources and visualize it so efficiently. In my little personal project, Power BI in the end was meant to be the tool that will load, model, and present gathered data.
Strava — is an app where you can share details about your sport activities with other athletes from all around the world. I personally use Garmin devices to collect all my sport data but fortunately they offer synchronization between Garmin and Strava application, so data is loaded into Strava automatically. This is very important because Strava has REST API (free of charge) which you can use to get raw data. Power BI enables users to call a REST API, I used these very well described tutorials https://github.com/Kjonge/PowerBIStravaConnector and https://www.kasperonbi.com/building-the-power-bi-strava-data-connector/ to build my own connector.
Excel — believe me or not but I have tried out many different apps in order to plan and control how much (and what) I eat. Unfortunately, I found these apps to be unhandy. They brought too much overhead of data input and edition for a price of a beautiful graphical interface which I was not really interested in. I decided to gather data on my own via Excel which I use every day and I got used to it. I prepare my daily menu and store information about my weight history there.
Then I wrapped it up and loaded into Power BI ending up with the data model presented below:
This enabled me to build some reports which I find really useful in analyzing my body condition looking for some marginal gains.
Weight report — I can control if I meet the plan or not, neither too fast nor too slow weight loss is recommended. I see if I maintain proper calories balance and I can analyze significant drops and increases. Also, this report enables me to drillthrough and check the nutrition (next report) corresponding to a chosen period.
Nutrition report— I see what products are used in my everyday diet and I can control macronutrients ratio.
Activities report— I can analyze trends of some specific measures for each of the three disciplines and I can also see how much I train every single month. Sport activities reports requires some additional data cleansing (I am not sure if I have ever managed to ride over 200km/h). But it’s one of the next steps.
Enjoy the satisfaction
Honestly, I do not think this data will ever bring me closer to any daunting outcomes, but it gave me tons of fun and satisfaction! I spent a few weeks playing with it, coming with new ideas, learning how to use the M language in Power BI, exploring capabilities of charts in Power BI, and many, many more. The most positive fact is that I carry on with my diet without any thoughts of abandoning the habit. I am not even tempted by regular “cheat meals”. I want this visualization to look nice in the first place, I think my weight is not relevant anymore!
360° IT Check is a weekly publication where we bring you the latest and greatest in the world of tech. We cover topics like emerging technologies & frameworks, news about innovative startups, and other topics which affect the world of tech directly or indirectly.