The world’s leading publication for data science, AI, and ML professionals.

Data analysis best practices through iPhone health activity data

Analyzing your own data can make you a good data analyst!

Photo by Youssef Sarhan on Unsplash
Photo by Youssef Sarhan on Unsplash

Your mobile phone is like a big data collector. It collects lots of data related to your physical activities. Applying data analysis and data science techniques to the data can help understand and improve health.

In order to write this blog, I extracted the physical activity data stored on my iPhone and used some basic data analysis techniques. I was surprised to see the powerful insights one can get. Such insights are not possible through the standard iPhone Health App. It has also helped me to better understand myself and get inspiration for additional physical activity!

So I have summarized the work in some of the Best Practices related to data analysis.

Understanding raw data first!

Let me first explain how iPhone stores the physical activity data. I had looked into Apple’s technical specifications to understand the data format. This helped to have a better grasp on what I am dealing with.

If you have an iPhone with you, every physical step you take will create a data record. This data record has a type indicating a step count identifier. It has a date, the start time of your activity, the end time, and the value, which indicates the number of steps taken. These steps could correspond to any movement – walking or running.

iPhone activity data format (image by author)
iPhone activity data format (image by author)

Analyzing complete data can bring a whole new perspective

I have had my iPhone for three years now, and the question comes to mind, is that how many total steps have I taken in three years? So I started making analyses on data stored in my iPhone health app.

This bar graph shows me the total of steps for all three years for record type step count.

Total number of steps in 3 years (image by author)
Total number of steps in 3 years (image by author)

4.2 million steps – is what this analysis shows me. Amazing! I was surprised to see this analysis, as I was seeing this for the first time and the standard iPhone health app does not give such an analysis.

Aggregation makes you lose information

Another interesting analysis you can do is to get a full-year view. iPhone gives a year-level analysis, but it is aggregated on a monthly basis.

iPhone Yearly analysis (image by author)
iPhone Yearly analysis (image by author)

When you aggregate, you lose a lot of information. So here is a yearly analysis for this year 2022 in a non-aggregated way.

The year 2022 analysis (image by author)
The year 2022 analysis (image by author)

In this visual, you have the actual dates of the year and the total step count for that day. I can observe that some days (marked with black triangles), I had not done much activity. That is not too great and now motivates me to do more physical activity.

Such motivational inspirations are lost when you aggregate the data. So this non-aggregated yearly view is much more informative and inspirational than the standard iPhone analysis.

Link visual analysis to actual actions

Let us move to another motivational analysis the heatmap analysis, which is one of my favorites.

Activity heat-map (image by author)
Activity heat-map (image by author)

Here you see the weekdays Y-axis and the hours on X-axis. Darker red color indicates high activity. You can observe that in general around 8h and 14h are times of high activity. The redder the heatmap becomes, the higher your level of physical activity.

This analysis can visually motivate to do more physical activity by trying to make it redder.

Visual - Action loop
Visual – Action loop

Such a "visual—action loop" is what Data Analysis is about. Data analysis is not just about making pretty pictures, but linking them to actions and seeing the pretty pictures improve!

Focus on the shape of the data

You can also analyze your physical activity in more detail. This analysis shows the number of steps that I had taken on the day of 9th June 2022. You can see a peak of 2783 steps around 10 in the morning. This corresponds to high-intensity running exercise.

Peak analysis (image by author)
Peak analysis (image by author)

It is very useful to see such a peak and its value, as it gives you a target to reach. So I can attempt now to break my own record of 2783 steps during my next high-intensity running exercise.

Conclusion

Analyzing your own data can make you a good data analyst! The reason is obvious. You can better connect to your own data, make improvements, and see the impact on data!

In addition, I hope I have been motivated to analyze your health data and go for extra physical activity. Thank you for reading!

Additional resources

No-code platform to learn data science

You can visit my platform to learn Data Science in a very easy way as well as apply some of the techniques described in this article without coding. https://experiencedatascience.com

Youtube channel on data science demo

Here is a link to my YouTube channel, where I show various demos on data science, machine learning, and AI. https://www.youtube.com/c/DataScienceDemonstrated

Please subscribe in order to stay informed whenever I release a new story.

Get an email whenever Pranay Dave publishes.

You can also join Medium with my referral link

Join Medium with my referral link – Pranay Dave


Related Articles