Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I wrote a blog post for Qlik Branch (the Qlik Developer Community) on how to build your own wellness/activity tracker app using your personal health data from your Apple iPhone, Apple Watch, and various home monitoring devices. Enjoy!
FULL BLOG LINK with helpful images: https://branch-blog.qlik.com/apple-healthkit-a-delicious-qlik-recipe-d61167e7ab89
------------------------------------------
Apple continues to make health and fitness capability improvements to their software and devices. Every year at WWDC — their Worldwide Developers Conference — healthcare gets the spotlight for a moment. Building upon previous health announcements of the release of HealthKit (I wrote about this a few years ago: the Electronic Sickness Record), CareKit, ResearchKit, and Apple Health Records (recently I covered that: An Apple a Day Keeps the Doctor at Bay), they continue to make it easier for people to track their well-being, effortlessly.
Like the saying “the best camera you have is the one that’s with you”, IoT sensors passively collecting your health data will prove invaluable. In the past, this data had to be tracked manually, or through a visit to your doctor to assess occasionally. But it’s not that the data is being always collected and just there for you to review. It’s that it’s being collected seamlessly and combined with context to provide you and your care team with more complete and timely information that can be used to find things before it becomes a problem and you end up at the Emergency Department. This is the promise behind this technology in driving the way to true digital transformation in healthcare.
A little background and why I wanted to build an Apple HealthKit app
Your doctor and the systems they use (the EHRs — Electronic Health Records systems) only know so much about you. Think about it — your doctor usually only sees you once a year for your annual checkup, or when you are sick. The data your health system has therefore isn’t really a reflection of your health, but of your sickness at a few points in time.
Most likely there is a device in pocket that has much more detail about your health. Smart phones and fitness devices can provide you with a much better picture of your health overall, yet few doctors are utilizing this rich data.
My iPhone and Apple Watch are tracking key health measures in the background every minute. It’s recording my steps, blood pressure, weight, exercise, and nutrition. It knows my location, the temperature outside, and the air quality; these are all key factors or metrics important to my health. Unfortunately, the built-in health app is locked down and only shows snapshots of my health trends rather than more robust analysis of my personal health. Apple is making some changes here with iOS 13 and WatchOS 6, but you will be stuck with what they choose to display.
Using Qlik, I can analyze all of this collected data, in any way that I want. Using years of fitness data that is accurate down to the minute will tell stories of my health and activity. I can see how my diet is affecting my weight (did I really need that Grande size cappuccino and a chocolate croissant?), how I need to get better at walking 10,000 steps a day, how travel and weather impacts my exercise regimen (hint: travel means little to no exercise for me, and warmer weather at home means I get more steps in).
Does my doctor see any of this? Nope — not yet. Well, not unless I show her my phone — and then what will she do with data? Maybe we’d have a conversation about it while I’m sitting on the cold table in a funny gown, but she’s certainly not going to track how I’m doing next week or months later when I change my diet or visit the UW Memorial Union terrace for beers with friends more often during the summer.
While EHRs have the ability to bring in personal health data (often called PRO or Patient-Reported Outcomes), many organizations have not turned on this capability or they fail to use it effectively. This is a missed opportunity to see the whole story. Should we go ahead and just call the systems our doctors use Electronic Sickness Records?
How to download your personal health data for analysis
1. Export data from Apple Health app on iPhone. Click your Profile icon in the top-right corner, choose ‘Export Health Data’.
2. Save the ZIP file, load it onto your desktop, and extract the contents.
3. Pass the export.xml file through the Apple Health XML to CSV Converter: http://ericwolter.com/projects/health-export.html. This browser-based tool uses the FileReader API and FileSaver.js library to convert the file into CSVs, which are easier for us to use. Not comfortable with this step? Review the Github repository: https://github.com/eligrey/FileSaver.js
How to bake a nice Apple app with Qlik Sense
Once you’ve converted your Apple Health data into upwards of 40 different CSVs, you now have a fun problem on your hands. How do you bring all of this data together and get insights? I picked the most useful files based on file size and name, but you can grab anything and bring it into Qlik Sense and let the magic of the associative engine wire it all together. You will need to create a File Folder connection as likely some of the files are over the size limit for dragging-and-dropping into the interface.
The Associative Engine chooses the StartDate as the key field to bring everything together, and I renamed this to Date:
Another tool that I used to explore the data model was Catwalk — a great little utility from the Qlik Core team: https://catwalk.core.qlik.com
Catwalk provides a quick way to browse relationships and the data frequencies. I wouldn’t have quickly noticed which apps/devices were storing Apple Health data without it. For instance, I totally forgot that Pokémon Go was collecting and storing some health data for that brief time I wandered my neighborhood in search of creatures. I just use the javascript bookmarklet to quickly explore the data model for any open app as I’m developing. Give it a try!
Once you have the data loaded, you can start the visualization process and create stories about your own health. I used a healthy mix of native Qlik Sense objects and also some extensions from Vizlib and Narrative Science to paint these pictures.
I wanted to keep a familiar look and feel of the Apple Health and Apple Watch activity rings. A darkmode theme for Qlik Sense (build your own with Bitmetric’s SenseTheme Builder) and the Vizlib Activity Gauge object made it come together quickly and beautifully:
What better way to tell a story with your data, then by having your data tell the story directly?! Enter Narrative Science. I asked the extension to analyze my step count and give me some insights:
I didn’t want to stop there. Everybody has up and down days for activity. Did the data tell me anything about how my health is trending for the better (or the worse). I could infer some trends from the line charts, but a great way to measure warranted and unwarranted variation is with statistical control charts, such as this I-Chart from Acumen BI:
This highly configurable but easy-to-use extension helps you to quickly build a control chart. It’s not only showing the average steps, it is also automatically recalculating the average, upper control limit, lower control limit, and outliers based on runs and trend triggers. Looking at the chart above, I must have been on the road in late January as my steps dropped, causing my average to be recalculated lower. Net-net: I was walking less because I was tied up in meetings (and the weather probably wasn’t great either).
Last, and certainly not least, I wanted to figure out how to indicate one of the greatest moments of my life, the birth of my first child. You can clearly see a dip in activity (rightfully so) on the day Jack was born. How did I achieve this? With annotations on the Vizlib Line Chart object. It really helps tell the story of events and how they impacted the data. You’ll be happy to know that the baby and I go on numerous walks each week.
Telling the story of your health with data can be a truly personal and insightful experience. If you’ve been passively tracking your health with your devices, try throwing the data into Qlik to see what you can discover about yourself. Maybe it’ll even push you to get to those 10,000+ steps a day.
Now, get out there and close those rings!
In fact, using similar apps keeps us in shape. Usually people are lazy, forget and so on. And the application can remind you to go in for sports.It's cool!!