From iPhone to Insight: Crafting a Fitness Dashboard with Python, Google Cloud, and Streamlit

Sujanshahi
3 min readJan 3, 2024

--

Introduction

3.6 million steps 👣 and 1200 hours ⌛,

According to the data collected by iPhone📱, those are the total amount of steps and total hours that I walked in 2023. iPhone does not natively support the feature to show total steps walked in a year which is why I decided to create a dashboard that allows me to visualize the steps count data in an interactive way.

Hello and welcome to my blog post. In this post, I will give a brief overview of the steps involved in creating the steps tracker dashboard to visualize the step count data stored in the iPhone. The dashboard can be found here and the github repository for this project can be found here.

Overall Process of Creating the Dashboard

Exporting Health Data from iPhone

Well, this part was easy as it involved only one step which was to go into the Health App in my iPhone and Click the button that says “Export All Health Data”. The data is exported as a zip file with two .xml files inside to my computer.

Exporting Health Data

ETL with Python

This step involved four sub-steps and they are:

a) Extract : Extracted data pertaining to steps count only.

b) Transform: Transformed the steps data to a dataframe

c) Load: Saved the transformed data into a CSV file for easy accessibility and analysis.

Here is the Google Colab Notebook that includes all the steps mentioned above.

Storing Data in a Google Cloud Bucket

This step involved creating a Google Cloud Bucket on Google Cloud and storing the csv file inside it. Here is the screenshot of the file inside the bucket.

Google Cloud Bucket that shows the file for steps count

Crafting the Fitness Dashboard with Streamlit

Streamlit is a Python library designed to transform data scripts into shareable web applications effortlessly. So I decided to use Streamlit for this project because I wanted to spend more time on analyzing data versus thinking about frontend. To create the dashboard using Streamlit involved two main steps:

a) Accessing the data: I utilized Streamlit’s Google Cloud File Connection Service to access the data stored in my Google Cloud Bucket. You can find the documentation regarding that over here.

b) Displaying the data: Well, Streamlit makes it easy to visualize data where it is as easy as writing “st.write(dataframe)” to write the whole dataframe to the web. For this project, I pretty much utilized Streamlit’s documentation to visualize the data which can be found here.

Conclusion

The journey from exporting health data to crafting a dynamic Streamlit dashboard has been a quite a learning moment for me as it taught me the invaluable wisdom of breaking down a project into its fundamental parts. I have always wanted to do this kind of project which involved real life scenarios and data.

--

--