FEBRUARY 15, 2023

BY IBTASSAM RASHEED

https://ibtassam1.github.io/page_socials/

<aside> ⚠️ The author recommends that this story is viewed on a computer screen. Some of the interactive Tableau visualizations may become misaligned on mobile.

</aside>

Have you ever wondered if your fitness tracker (or smartwatch) is revealing all the fitness metrics it is recording? This story is 2 years in the making. Join me as I unravel what Fitbit app could not reveal.

Fitness was, more or less, an acquired lifestyle while I was growing up. The schooling culture in Pakistan was different from what is considered pretty standard in Canada.

Despite going to good schools, I did not have P.E. classes, sports or even a school gym. There was hardly any focus on fitness or physical activity. Most kids only got exposure to sports while playing Cricket with their friends in community parks. I vividly remember that I played Football and Table Tennis for the first time when I started my undergraduate studies.

DSC01646.JPG

Bonus: My 2022 table tennis participation as a racing bar visual.

With such a late introduction to fitness, I could never really get into the habit of regular workouts or sports. It was the ‘Year of Covid’ 2020 that sparked a change. My normal weight that used to be 75’ish kg ventured into 85+ kilogram unchartered territory during the pandemic. It may not seem like a lot but I was almost in need of a new wardrobe! It was a tipping point. I started semi-regular workouts towards the start of 2021. This coincides with the time I bought a Fitbit Charge 4 to track my fitness. Fitbit app is limiting in terms of the analytics it provides and there is hardly any cumulative analyses. I have been exceedingly curious to see how I did overall. This story will take you through the fitness journey that my Fitbit recorded in 2021 and 2022.

Spoiler: I did moderately well in 2021 and not so well in 2022.

With all this context, let us dive into the analysis.

Data Source & Introduction

Data for this analysis was sourced from my online Fitbit account. If not exporting data for last 30 days, FitBit does not provided tabular data. As I needed two years’ worth of data, I downloaded most of the data in the form of individual JSON files for each health metric with varying levels of sub-nesting.

Data Transformation & Wrangling

Most of my time for this story was spent in data transformation and cleaning. So much so that, at one point, I wondered if I would be able to do the actual analysis in time.

I wrote Python code to go through more than 3,000 JSON files spanning 2021-22 and convert them to dataframes and ultimately yield merged CSV files. Thereafter, I used pandas library to wrangle the data including but not limited to data cleaning, compensating missing values and aggregating data that was in varying granularities. To keep this story focused on my insights, I talk briefly about the data conversion and wrangling but the detailed process can be accessed using the below link.

Jupyter Notebook file: Data transformation, wrangling & visualization in Python.

After extensive data manipulation, including decoding nested dictionaries and applying RegExp, I obtained data for more than 20 metrics. There are a couple of periods where data is missing in 2022. For example, there was a period where I could not wear my Fitbit due to a broken strap or when the data was not saving online for a couple of months. Although the variables I used are self-explanatory but I have included a data dictionary below.