A HealthKit REST API is long overdue in my opinion. I'd love to be able to visualise the data on the web and maybe even use it to drive more informative health-oriented widgets via the Scriptable app.
A few weeks ago, I decided to find another way in which I could collate this data for my own use. By using Apple's Shortcuts app.
I figured that collecting the data once a day was more than enough, but needed some kind of trigger. Tapping a button doesn't really work for me as it's easy to forget so I decided to go for an automated routine that runs at 00:01 every day.
Easier said than done. Your phone needs to be unlocked for one. If it's not, you get prompted to run the shortcut... well most of the time. It seems to fail quite often and I can do days without seeing the notification that it tried to run.
Shortcuts should have been the fix. Exporting data from the Health app makes no sense because it's all or nothing. With Shortcuts, I can technically build the system I need but sadly it's let me down a lot.
Another problem I've had (and reported to Apple) is that fetching your step count can take seconds, if not minutes, for the data to be returned. It's quite frustrating that something that sounds so simple can take so long. The same is true of asking Siri for the info. My phone isn't new, but I'm sure this type of info was much faster before iOS 13. It's specifically the bit that tries to fetch a list of sources that takes the time but that's a really important step if you want accurate information.
In truth I have had the same trouble with Trello and after a lot of back and forth with their support team, turns out it's Apple's implementation and not theirs. I now have to fetch the right data, in the right order, to get it to a state in which it has what it needs so that it can make the right call.
Anyway, when it works, it's great. And yet even though I started back on the 5th June, almost two months have passed and I only have 23 records to show for it (two of which are empty).
If I had more, I'd start building a UI for it all so that it was something I could chart and share with the world. I've seen reports that iOS 15 has made shortcuts faster and I'm hoping they're faster and more stable. Maybe then I'll try again and see if I can do something more interesting with the data and I'll share my methods for collecting the data.
If you're interested, you can see the data which is comma separated but crudely printed and formatted at https://charanj.it/stats.php.
While I'd thought about it in the past, it was all actually inspired by Craig Carlyle who has an active dashboard with loads of stats of his own.
|More from 1 Thing A Week|
|« Getting it wrong with CSS Grid!||CSS only bubble patterns explained||Getting to grips with Apple CarPlay||The HTTP 203 web series »|
You can find 1 Thing A Week on Twitter, Facebook, Instagram & Reddit