Read iOS HRV data (captured during breathing session) via shortcuts

I first started using Heart Rate Variability (HRV) to track my recovery from a concussion that I sustained while out mountain biking. HRV is a possibly useful metric to track overall health, stress levels, etc. I have a few years worth of (not entirely consistent) HRV data as a result of using Marco Altini’s fantastic HRV4Training app. If you’re not hip to HRV, here’s a little explainer from Marco’s website:

HRV, in particular rMSSD or a transformation of rMSSD such as HRV4Training’s Recovery Points, are simply a way to capture parasympathetic activity, or in other words, level of physiological stress. As we apply stress to trigger certain adaptations, measuring our body’s response to such stressors, as well as to all other forms of stress we are affected from (e.g. simply life happening, work stress, family, etc.), is very helpful as it can provide objective feedback and help us making meaningful adjustments, the simpler adjustments is probably just being a little more honest with ourselves, and slowing down from time to time, especially when our body is already too stressed.

The difficulty for me has been taking consistent measurements. For HRV data to be useful it ought to be collected at the same time and under similar circumstances each day. For most people, that’s first thing in the morning as they are laying in bed. Unfortunately our domestic situation is such that I do not have the luxury of laying in bed once I am awakened. Additionally there are some added stressors first thing in the AM that make replicating circumstances from one day to the next very difficult. So using HRV has always been hit or miss for me. Stepping way back and looking at long term trends I can always see my HRV going down when I play too many gigs in a given month (and am out late too frequently), but aside from that, there are so many day to day stressors in my life that it is difficult to tease out whether or not the impacts to my HRV are due to workouts or just daily stressors. I’ve had an Apple Watch (v2?) for while now and was hoping that having a measurement device strapped to my wrist might help me get HRV measurements with more consistency — and in turn make better inferences from the data. Unfortunately, Apple doesn’t make getting at the HRV data easy. Marco has written up a great explainer on how to get accurate and useful HRV measurements out of an Apple Watch

Recently, researchers at the University of Zaragoza in Spain, published a paper showing that RR intervals extracted from the Apple Watch while using the Breathe app, are indeed very accurate (Hernando et al., “Validation of the Apple Watch for Heart Rate Variability Measurements during Relax and Mental Stress in Healthy Subjects”). This is great news as it shows that the basic unit of information (RR intervals) can be trusted.

In other words, if you use the Breathe app on the Watch it will record HRV data for the breathing session which captures good beat-to-beat variability data. You can see from the screenshots that the Apple Watch takes a few HRV snapshots throughout each day. The measurements I’m interested in tracking are the first one from each day as I will try to do an Apple Watch breath session each morning (hopefully before the watch takes its first snapshot HRV reading). Enter iOS Shortcuts. If you’re not hip to iOS shortcuts and you own an iPhone, you should be. If you are hip to iOS shortcuts, I’ve written a proof of concept shortcut that:

  • looks to see when you’ve done the breathing app on your watch today
  • grabs the associated HRV reading from the breathing session
  • writes the value of the HRV to a Day One Journal entry

There are a bunch of directions to go with this but basically I just wanted to prove out the case that:

  • it is possible to query the HealthKit database for all of the breathing sessions (Mindful Minute sessions = 1 min)
  • get the time that the breathing session occurred
  • extract the HRV value that is captured in healthkit for that time period

Get the shortcut from iCloud here.
You need to click this link from your iPhone and need to have Day One installed but if you’re this far along you can likely modify the Day One entry to your text file of choice. The shortcut seems to generally work. While it will never have the functionality of HRV4Training it will be curious to see if deriving the HRV value from my watch makes me record the data any more frequently. Also, this is the first shortcut I’ve written and shared so I’m not sure if I create new versions if I need to post a new link or not. If you’re into this kind of thing and use it/modify it, etc. please drop me a note!