Pipeline_HR is a repository containing a series of MATLAB scripts used to process data from the TimeRun app project.
The repository includes the following files and folders:
pipeline_hr
│ boxplotGroup.m
│ pipeline_hr.m
│ timestep.m
|
├───data
│
├───pop_study
│
└───src
A MATLAB function used to display groups of boxplots.
The main script used to preprocess data series, compute error and statistical metrics, and generate boxplots based on the obtained data series.
A MATLAB function used to determine the most common timestep across all data series, in order to understand the best timestep to retime the data series for computing metrics and making comparisons.
It's a folder where you should copy all the folders and files structures contained in the TimeRun
folder that the application TimeRun
exports in the memory of the smarthphone when the user submits it in the application
For example (considering only user 1 with 2 sessions):
data
└───1
│ user_1.csv
│
├───session1
│ fitbit_1_1.csv
│ garmin_1_1.csv
│ intervals_1_1.csv
│ polar_1_1.csv
│ session_1_1.csv
│
└───session4
applewatch_1_4.csv
intervals_1_4.csv
polar_1_4.csv
session_1_4.csv
withings_1_4.csv
Warning Files related to Apple Watch and Garmin data will not be contained in these folders. To add them, you should follow the procedure reported below in this section.
In the pop_study
folder, you will find a MATLAB script pop_study.m
which calculates characteristics of the study population.
In the src
folder, you will find a series of subfolders containing scripts useful for preprocessing data.
src
├───dataCutter
│ appleSessionCutter.m
│ atmotubeSessionCutter.m
│ garminSessionCutter.m
│
├───errorMetrics
│ cod.m
│ mae.m
│ mard.m
│ rmse.m
│ timeDelay.m
│ xcorrN.m
│
└───retime
retimeHR.m
retimeINT.m
The dataCutter
folder contains a series of MATLAB files used to create individual files for each user and their specific Apple Watch
and Garmin
sessions. This is necessary because these sessions are extracted into files that contain much more data than just the session data itself. The atmotubeSessionCutter.m
file allows for the creation of a file containing the Atmotube
data for a specific session for each user.
The errorMetrics
folder contains a series of MATLAB files used to calculate error metrics between the analyzed device series and the reference Polar
track for each session.
The retime
folder contains a series of MATLAB files used to retime the data series.
Copy in the folder data
all the folders and files structures contained in the TimeRun
folder that the application TimeRun
exports in the memory of the smarthphone when the user submits it in the application
For each user, for each session including an Apple Watch
or Garmin
device, create the respective file using the MATLAB functions appleSessionCutter.m
and garminSessionCutter.m
contained in the src/dataCutter
folder.
Note If you want, for each session, for each user, you can create a file containing the data of
Atmotube
for that specific session, usingatmotubeSessionCutter.m
.
If you want to perform a study of the population, create a file .csv
containing data of the population with the following columns in order:
- id
- sex
- birth_year
- completed (indicating the number of sessions completed by the participant)
and put it in the folder
pop_study
and then use the scriptpop_study.m
to get the results.
Since the data series do not always have the same timestep even within the same series, use the script timestep.m
to calculate the most common timestep among all the series for each device. At this point, select the largest timestep and assign it to the variable timestep
at line 15 of the file pipeline_hr.m
.
Open the script pipeline_hr.m
and join the results.
Thank you @gcappon and @KingLudwig94 for the help 😄