Let me start by saying I’m a visual learner, so I’ve always had an inclination towards UML graphs and charts.
So during one rainy day in London, I decided to aggregate the data from my Garmin Vivosmart HR, Apple Watch 2 and Yunmai Smart Scales in my Apple HealthKit app and come up with interesting aggregation statistics and chart that could provide an interesting insight to the data. It’s something basic, yet I haven’t found a good enough iOS app that does this type of analysis out of the box.
I’ll walk you through the steps you can do to get your data in the right format and then use the Jupyter notebook I’ve already built, so you can generate the same charts for yourself quickly or modify freely as you see fit.
The entire analysis is done in Python using basic libraries, such as pandas, numpy, matplotlib, seaborn in an interactive HTML notebook – Jupyter Notebook, which comes from the languages it originally supported (Julia, Python, R). It imitates a python shell in a browser and is the latest trend for reproducible research.
Collecting the data from your iPhone
The notebook needs very few files:
Once you install the QS Access app, give it access to your HealthKit data and then select 1 Hour and tick all possible columns, I know, you’ll have many of these empty, but the code will clean up the empty columns, so nothing to worry about. Then click Create Table, you don’t have to wait to get the table displayed, as it’s too much data, so click on the export icon at the bottom left and Save the file to your cloud storage provider of choice, or email the file to yourself.
Next, go to your computer and extract the archive contents and open the website – http://ericwolter.com/projects/health-export.html and click on the rectangle and select the exported export.xml.
Jupyter Notebook Setup
(If you are familiar with Git & GitHub, you can git clone respectively.) The default is my data, so you can now copy your 5 files into the folder and overwrite mine. The last step is to rerun the script and recalculate and plot the charts.
Here are some of the charts, you’ll get as an end result:
Distribution histogram of Steps, Kilometers, Flights Climbed, Total Calories, Weight
A Boxplot of daily heart rate
A standard timeseries chart for flights of stairs done