Reading RR intervals from EliteHRV with Pandas

Heart Rate Variability (HRV) is a measure of the time interval between each heart beat and is a measure that in contrast to beats per minute can quantify the variation between each heartbeat. This blog post explains how HRV readings done with the mobile application EliteHRV can be read and plotted with Pandas and Python. More information about HRV can be found here (external link).

The EliteHRV application is a popular app for measuring RR peaks and HRV measures, but the app itself is rather limited if one want to investigate the RR peaks in detail. Luckily, the application easily allows the user to export data as .txt files which opens it up for using Python and Pandas to drill down into the data and get further insight into the measurements.

The first step is to export the data containing RR intervals by clicking on the settings menu and choose Export Data. The data will now be e-mailed to you in the form of a link where you can download a zipped file with all your measurements.

The next step is to read the data into a Pandas DataFrame as a Time Series. The exported text files only contain RR intervals without a timestamp for each sample, so the interval values themselves are used to create the time, this is possible as the RR intervals annotate the time between two successive heart beats. To create the timestamps, the start time of the first sample is set to the timestamp given in the file name, then for each sample, the value of the RR interval is appended to the time of the previous sample. The code to do this is found in my GitHub repository for this project and is abstracted as a function named importDriveData in the_ _file.
This function can easily be called upon.

import importhrv as imp
df = imp.importDriveData()

The function first sorts all text files based on their date, so that the oldest one is read first, then it reads the .txt files one by one. By default the functions reads files from “data/eliteHRV/export/”, but the function can also read from other sources and files by specifying these as input parameters.

df = imp.importDriveData(‘data/eliteHRV/export/‘, “*.txt”)

The resulting DataFrame should look something like the picture below, where each sample has a corresponding timestamp.

upload successful
RR peaks from EliteHRV read into a pandas DataFrame

The file_ eliteHRVReader.py_ already has these codes and are ready to run.

The DataFrame can then be plotted and examined by using normal pandas commands.

df.reset_index().plot(x=”time”, y=[‘interval in seconds’])

Time series of RR samplesupload successful