HRV Measures - Direct import from EliteHRV CSV files

Test file contributed by Martin Wifling
This commit is contained in:
Alejandro Martinez
2017-10-02 22:08:40 -03:00
parent f2099f9be6
commit 7d9aab2e41
2 changed files with 31 additions and 7 deletions

View File

@@ -76,8 +76,8 @@ HrvMeasuresCsvImport::getHrvMeasures(QString &error, QDateTime from, QDateTime t
}
foreach(QString h, headers) {
if (h == "timestamp_measurement") tsExists = true;
if (h == "rMSSD" || h == "rMSSD_lying") rmssdExists = true;
if (h == "timestamp_measurement" || h == "Datetime") tsExists = true;
if (h == "rMSSD" || h == "rMSSD_lying" || h == "Rmssd") rmssdExists = true;
}
if (!tsExists) {
error = tr("Column 'timestamp_measurement' is missing.");
@@ -109,7 +109,7 @@ HrvMeasuresCsvImport::getHrvMeasures(QString &error, QDateTime from, QDateTime t
if (i.isEmpty() || i == "-") {
continue; // skip empty values
}
if (h == "timestamp_measurement") {
if (h == "timestamp_measurement" || h == "Datetime") {
// parse date ISO 8601
m.when = QDateTime::fromString(i, Qt::ISODate);
if (m.when.isValid()) {
@@ -122,7 +122,7 @@ HrvMeasuresCsvImport::getHrvMeasures(QString &error, QDateTime from, QDateTime t
error = tr("Invalid 'date' - Date/Time not ISO 8601 format - in line %1").arg(lineNo) + ": " + i;
goto error;
}
} else if (h == "rMSSD" || h == "rMSSD_lying") {
} else if (h == "rMSSD" || h == "rMSSD_lying" || h == "Rmssd") {
m.rmssd = i.toDouble(&ok);
if (!ok) {
error = tr("Invalid 'rMSSD' - in line %1").arg(lineNo);
@@ -140,13 +140,13 @@ HrvMeasuresCsvImport::getHrvMeasures(QString &error, QDateTime from, QDateTime t
error = tr("Invalid 'AVNN' - in line %1").arg(lineNo);
goto error;
}
} else if (h == "SDNN" || h == "SDNN_lying") {
} else if (h == "SDNN" || h == "SDNN_lying" || h == "Sdnn") {
m.sdnn = i.toDouble(&ok);
if (!ok) {
error = tr("Invalid 'SDNN' - in line %1").arg(j);
goto error;
}
} else if (h == "pNN50" || h == "pNN50_lying") {
} else if (h == "pNN50" || h == "pNN50_lying" || h == "Pnn50") {
m.pnn50 = i.toDouble(&ok);
if (!ok) {
error = tr("Invalid 'pNN50' - in line %1").arg(lineNo);
@@ -164,7 +164,7 @@ HrvMeasuresCsvImport::getHrvMeasures(QString &error, QDateTime from, QDateTime t
error = tr("Invalid 'HF' - in line %1").arg(lineNo);
goto error;
}
} else if (h == "HRV4T_Recovery_Points") {
} else if (h == "HRV4T_Recovery_Points" || h == "lnRmssd") {
m.recovery_points = i.toDouble(&ok);
if (!ok) {
error = tr("Invalid 'HRV4T_Recovery_Points' - in line %1").arg(lineNo);

View File

@@ -0,0 +1,24 @@
Member,Date,Datetime,Type,HRV,lnRmssd,Rmssd,Nn50,Pnn50,Sdnn,Score,Indication,Balance,Rolling Avg HRV,HRV CV,HR,Rolling Avg HR
Martin,2017-09-06,2017-09-06 06:23:22,readiness,57,3.7105172775593513,40.87,32,21.33,61.9,,,,57,0,50.46,50.46
Martin,2017-09-07,2017-09-07 06:29:04,readiness,51,3.333128405614548,28.03,8,5.37,48.2,6,Y,S,54,0,53.84,52.15
Martin,2017-09-08,2017-09-08 06:17:03,readiness,52,3.391256012088342,29.7,14,9.33,47.11,8,G,S,54,5.8,52.94,52.41
Martin,2017-09-09,2017-09-09 08:24:29,readiness,59,3.808360722959998,45.08,38,25.5,69.22,7,G,PS,55,6.6,51.58,52.21
Martin,2017-09-11,2017-09-11 06:07:42,readiness,55,3.5966107260277114,36.47,18,12.08,62.2,10,G,PS,55,5.7,54.07,52.58
Martin,2017-09-12,2017-09-12 05:57:15,readiness,53,3.4429949862480416,31.28,13,8.72,63.13,8,G,S,55,5.3,52.97,52.64
Martin,2017-09-13,2017-09-13 06:03:37,readiness,56,3.669400373733572,39.23,30,20.13,65.16,9,G,PS,54,5.2,52.96,53.06
Martin,2017-09-14,2017-09-14 06:01:24,readiness,53,3.476692304821696,32.35,18,12.08,54.67,8,G,S,55,4.4,52.87,52.9
Martin,2017-09-15,2017-09-15 06:05:19,readiness,53,3.4650649888285834,31.98,16,10.74,53.14,8,G,S,55,4,51.31,52.63
Martin,2017-09-16,2017-09-16 08:13:14,readiness,53,3.4652643874220748,31.98,9,6.08,51.53,8,G,S,54,2.6,53.82,53
Martin,2017-09-18,2017-09-18 05:43:27,readiness,54,3.5333898421479883,34.24,19,12.75,60.49,9,G,S,54,2.4,53.25,52.86
Martin,2017-09-19,2017-09-19 05:56:15,readiness,53,3.465440047104913,31.99,14,9.33,60.28,8,G,S,54,2.3,50.78,52.5
Martin,2017-09-20,2017-09-20 06:35:20,readiness,55,3.5493151067907434,34.79,21,14,60.6,10,G,PS,54,1.1,52.36,52.4
Martin,2017-09-21,2017-09-21 05:58:01,readiness,54,3.528073157981648,34.06,14,9.52,79.27,10,G,PS,54,1.1,54.17,52.62
Martin,2017-09-23,2017-09-23 08:01:01,readiness,55,3.577251634148898,35.78,23,15.44,65.32,6,Y,PS,54,1.2,52.68,52.65
Martin,2017-09-24,2017-09-24 08:32:11,readiness,53,3.472473544185976,32.22,17,11.41,53.13,7,G,S,54,1.2,56.43,53.28
Martin,2017-09-25,2017-09-25 06:00:08,readiness,58,3.7480670059518784,42.44,26,21.85,70.96,2,R,PS,55,2.9,54.28,53.45
Martin,2017-09-26,2017-09-26 06:03:30,readiness,57,3.7103746045923582,40.87,16,13.45,66.59,7,G,PS,55,3,53.6,53.92
Martin,2017-09-27,2017-09-27 08:21:55,readiness,62,4.02862,56.18,29,25,75.76,2,R,PS,57,5.5,66.76,56.32
Martin,2017-09-28,2017-09-28 06:03:53,readiness,57,3.71691,41.14,20,17,75.66,10,G,PS,57,5.1,57.44,56.86
Martin,2017-09-29,2017-09-29 06:04:12,readiness,56,3.62504,37.53,17,14,62.85,9,G,S,57,4.7,53.37,56.37
Martin,2017-09-30,2017-09-30 08:33:23,readiness,59,3.84604,46.81,22,18,78.39,8,G,PS,58,4.6,53.16,56.43
Martin,2017-10-02,2017-10-02 05:57:19,readiness,65,4.21404,67.63,32,27,87.82,3,R,PS,59,5.8,54.14,56.41
1 Member Date Datetime Type HRV lnRmssd Rmssd Nn50 Pnn50 Sdnn Score Indication Balance Rolling Avg HRV HRV CV HR Rolling Avg HR
2 Martin 2017-09-06 2017-09-06 06:23:22 readiness 57 3.7105172775593513 40.87 32 21.33 61.9 57 0 50.46 50.46
3 Martin 2017-09-07 2017-09-07 06:29:04 readiness 51 3.333128405614548 28.03 8 5.37 48.2 6 Y S 54 0 53.84 52.15
4 Martin 2017-09-08 2017-09-08 06:17:03 readiness 52 3.391256012088342 29.7 14 9.33 47.11 8 G S 54 5.8 52.94 52.41
5 Martin 2017-09-09 2017-09-09 08:24:29 readiness 59 3.808360722959998 45.08 38 25.5 69.22 7 G PS 55 6.6 51.58 52.21
6 Martin 2017-09-11 2017-09-11 06:07:42 readiness 55 3.5966107260277114 36.47 18 12.08 62.2 10 G PS 55 5.7 54.07 52.58
7 Martin 2017-09-12 2017-09-12 05:57:15 readiness 53 3.4429949862480416 31.28 13 8.72 63.13 8 G S 55 5.3 52.97 52.64
8 Martin 2017-09-13 2017-09-13 06:03:37 readiness 56 3.669400373733572 39.23 30 20.13 65.16 9 G PS 54 5.2 52.96 53.06
9 Martin 2017-09-14 2017-09-14 06:01:24 readiness 53 3.476692304821696 32.35 18 12.08 54.67 8 G S 55 4.4 52.87 52.9
10 Martin 2017-09-15 2017-09-15 06:05:19 readiness 53 3.4650649888285834 31.98 16 10.74 53.14 8 G S 55 4 51.31 52.63
11 Martin 2017-09-16 2017-09-16 08:13:14 readiness 53 3.4652643874220748 31.98 9 6.08 51.53 8 G S 54 2.6 53.82 53
12 Martin 2017-09-18 2017-09-18 05:43:27 readiness 54 3.5333898421479883 34.24 19 12.75 60.49 9 G S 54 2.4 53.25 52.86
13 Martin 2017-09-19 2017-09-19 05:56:15 readiness 53 3.465440047104913 31.99 14 9.33 60.28 8 G S 54 2.3 50.78 52.5
14 Martin 2017-09-20 2017-09-20 06:35:20 readiness 55 3.5493151067907434 34.79 21 14 60.6 10 G PS 54 1.1 52.36 52.4
15 Martin 2017-09-21 2017-09-21 05:58:01 readiness 54 3.528073157981648 34.06 14 9.52 79.27 10 G PS 54 1.1 54.17 52.62
16 Martin 2017-09-23 2017-09-23 08:01:01 readiness 55 3.577251634148898 35.78 23 15.44 65.32 6 Y PS 54 1.2 52.68 52.65
17 Martin 2017-09-24 2017-09-24 08:32:11 readiness 53 3.472473544185976 32.22 17 11.41 53.13 7 G S 54 1.2 56.43 53.28
18 Martin 2017-09-25 2017-09-25 06:00:08 readiness 58 3.7480670059518784 42.44 26 21.85 70.96 2 R PS 55 2.9 54.28 53.45
19 Martin 2017-09-26 2017-09-26 06:03:30 readiness 57 3.7103746045923582 40.87 16 13.45 66.59 7 G PS 55 3 53.6 53.92
20 Martin 2017-09-27 2017-09-27 08:21:55 readiness 62 4.02862 56.18 29 25 75.76 2 R PS 57 5.5 66.76 56.32
21 Martin 2017-09-28 2017-09-28 06:03:53 readiness 57 3.71691 41.14 20 17 75.66 10 G PS 57 5.1 57.44 56.86
22 Martin 2017-09-29 2017-09-29 06:04:12 readiness 56 3.62504 37.53 17 14 62.85 9 G S 57 4.7 53.37 56.37
23 Martin 2017-09-30 2017-09-30 08:33:23 readiness 59 3.84604 46.81 22 18 78.39 8 G PS 58 4.6 53.16 56.43
24 Martin 2017-10-02 2017-10-02 05:57:19 readiness 65 4.21404 67.63 32 27 87.82 3 R PS 59 5.8 54.14 56.41