FIT File HRV Data Array Interpretation

I've tried searching thru the documentation found in the FitSDK and did not see any guidance (maybe I didn't know where to look) on what the array represents.

Data 15 hrv time 0.468|0.468|65535|65535|65535 s

This just basically tells me what are the possible meaning:

https://runalyze.com/help/article/hrv#camerahrv

The website : https://developer.garmin.com/fit/file-types/activity/ tells me it's an array but not what each value represents. 

HRV messages are used to record heart rate variability data. The HRV messages contain an array of RR intervals and are interleaved with record and event messages in chronological order. Note that HRV data is not timestamped, and shall be synchronized by checking successive RR intervals as they occur between other timestamped messages.

  • An RR interval is the absolute time between successive heart beats, whereas heart rate is the average number of heart beats per minute. The relationship between the two is: 

    HR = 60 / RR interval in seconds.

    What is stored in the HRV message is an array of RR intervals in seconds. Depending on the current heart rate there may be between 1 and 5 values. The higher the heart rate the more RR intervals there will be. There is room for 5 values because the max heart rate value that can be stored in a Record message is 254 and if your heart rate is that high then you would have 5 RR intervals. The RR value is stored in the file as a UINT16 with a scale of 1000. The invalid value for a UINT16 is 0xFFFF (65535). 

    In your example data (60 / 0.468) = 128BPM, which is more than two beats per second but less than three beats per second which is why there are two RR Intervals and three invalid values.

    Most of the time you can get by with just knowing the RR interval. If you are calculating RMSSD from RR intervals as the precursor to HRV then you do not need the wall clock time that the RR Interval occurred.

    But if you need to know the absolute timestamp for an RR interval, you have to look at the timestamp of the message right before it, which is more than likely a Record message but could be anything. 

    HRV messages are interleaved with Record and Event messages, and would look something like this:

    Data,3,record,timestamp,"983279042",s,heart_rate,"104",bpm,...
    Data,1,hrv,time,"0.577|0.578|65535|65535|65535",s,...
    Data,3,record,timestamp,"983279043",s,heart_rate,"104",bpm,...
    Data,1,hrv,time,"0.576|0.575|65535|65535|65535",s,...

    So the timestamps for the RR intervals would be:

    0.577 @ 983279042

    0.578 @ 983279042.577

    0.576 @ 983279043

    0575 @ 983279043.576

    In the future we may add a recipe to the cookbook section of the documentation, but for now hopefully this helps.

  • Pray thank you very very much. It is both insightful and very helpful. I wound't have guessed the 983279042.577  at all..

  • 983279042.577 is an approximation in case you need sync the HRV and Record messages. 0.577 + 0.578 = 1.164, which is greater than the delta to the timestamp of the next Record message. Eventually there will be an HRV message with one less RR value to account for the drift. You can see in Alan's example he does not use the timestamps from the Record messages, rather he sums the RR intervals to calculate the offset for any given RR interval from the beginning. Look at where he creates the values for the x-axis of the graph, which is correct. You would only look at the timestamp of the a previous Record message if you want to find the closest record message in the file for some reason.

  • Thanks. I am still looking at it and still reading up on the nuances of HRV and the new DFA Alpha1