@sports-alliance/sports-lib 7.0.13 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/check-metrics.js +30 -0
- package/find-values.js +33 -0
- package/inspect-devices.js +21 -0
- package/inspect-session.js +27 -0
- package/lib/cjs/activities/devices/device.d.ts +1 -0
- package/lib/cjs/activities/devices/device.interface.d.ts +1 -0
- package/lib/cjs/activities/devices/device.js +1 -0
- package/lib/cjs/activities/devices/device.json.interface.d.ts +1 -0
- package/lib/cjs/data/data.age.d.ts +6 -0
- package/lib/cjs/data/data.age.js +12 -0
- package/lib/cjs/data/data.avg-flow.d.ts +5 -0
- package/lib/cjs/data/data.avg-flow.js +9 -0
- package/lib/cjs/data/data.avg-grit.d.ts +5 -0
- package/lib/cjs/data/data.avg-grit.js +9 -0
- package/lib/cjs/data/data.avg-respiration-rate.d.ts +5 -0
- package/lib/cjs/data/data.avg-respiration-rate.js +9 -0
- package/lib/cjs/data/data.avg-vam.d.ts +5 -0
- package/lib/cjs/data/data.avg-vam.js +9 -0
- package/lib/cjs/data/data.est-sweat-loss.d.ts +6 -0
- package/lib/cjs/data/data.est-sweat-loss.js +12 -0
- package/lib/cjs/data/data.flow.d.ts +5 -0
- package/lib/cjs/data/data.flow.js +9 -0
- package/lib/cjs/data/data.gender.d.ts +4 -0
- package/lib/cjs/data/data.gender.js +8 -0
- package/lib/cjs/data/data.grit.d.ts +5 -0
- package/lib/cjs/data/data.grit.js +9 -0
- package/lib/cjs/data/data.height.d.ts +6 -0
- package/lib/cjs/data/data.height.js +12 -0
- package/lib/cjs/data/data.jump-count.d.ts +6 -0
- package/lib/cjs/data/data.jump-count.js +12 -0
- package/lib/cjs/data/data.jump-event.d.ts +12 -0
- package/lib/cjs/data/data.jump-event.js +16 -0
- package/lib/cjs/data/data.left-pedal-smoothness.d.ts +6 -0
- package/lib/cjs/data/data.left-pedal-smoothness.js +12 -0
- package/lib/cjs/data/data.left-torque-effectiveness.d.ts +6 -0
- package/lib/cjs/data/data.left-torque-effectiveness.js +12 -0
- package/lib/cjs/data/data.max-respiration-rate.d.ts +5 -0
- package/lib/cjs/data/data.max-respiration-rate.js +9 -0
- package/lib/cjs/data/data.min-respiration-rate.d.ts +5 -0
- package/lib/cjs/data/data.min-respiration-rate.js +9 -0
- package/lib/cjs/data/data.primary-benefit.d.ts +6 -0
- package/lib/cjs/data/data.primary-benefit.js +12 -0
- package/lib/cjs/data/data.resting-calories.d.ts +5 -0
- package/lib/cjs/data/data.resting-calories.js +9 -0
- package/lib/cjs/data/data.right-pedal-smoothness.d.ts +6 -0
- package/lib/cjs/data/data.right-pedal-smoothness.js +12 -0
- package/lib/cjs/data/data.right-torque-effectiveness.d.ts +6 -0
- package/lib/cjs/data/data.right-torque-effectiveness.js +12 -0
- package/lib/cjs/data/data.store.js +54 -2
- package/lib/cjs/data/data.total-flow.d.ts +5 -0
- package/lib/cjs/data/data.total-flow.js +9 -0
- package/lib/cjs/data/data.total-grit.d.ts +5 -0
- package/lib/cjs/data/data.total-grit.js +9 -0
- package/lib/cjs/data/data.training-load-peak.d.ts +5 -0
- package/lib/cjs/data/data.training-load-peak.js +9 -0
- package/lib/cjs/data/data.weight.d.ts +6 -0
- package/lib/cjs/data/data.weight.js +12 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.d.ts +3 -1
- package/lib/cjs/events/adapters/importers/fit/importer.fit.js +211 -6
- package/lib/cjs/events/adapters/importers/fit/importer.fit.mapper.js +42 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.mtb.spec.d.ts +1 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.mtb.spec.js +217 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.road.spec.d.ts +1 -0
- package/lib/cjs/events/adapters/importers/fit/importer.fit.road.spec.js +103 -0
- package/lib/cjs/index.d.ts +4 -0
- package/lib/cjs/index.js +4 -0
- package/lib/esm/activities/devices/device.d.ts +1 -0
- package/lib/esm/activities/devices/device.interface.d.ts +1 -0
- package/lib/esm/activities/devices/device.json.interface.d.ts +1 -0
- package/lib/esm/data/data.age.d.ts +6 -0
- package/lib/esm/data/data.avg-flow.d.ts +5 -0
- package/lib/esm/data/data.avg-grit.d.ts +5 -0
- package/lib/esm/data/data.avg-respiration-rate.d.ts +5 -0
- package/lib/esm/data/data.avg-vam.d.ts +5 -0
- package/lib/esm/data/data.est-sweat-loss.d.ts +6 -0
- package/lib/esm/data/data.flow.d.ts +5 -0
- package/lib/esm/data/data.gender.d.ts +4 -0
- package/lib/esm/data/data.grit.d.ts +5 -0
- package/lib/esm/data/data.height.d.ts +6 -0
- package/lib/esm/data/data.jump-count.d.ts +6 -0
- package/lib/esm/data/data.jump-event.d.ts +12 -0
- package/lib/esm/data/data.left-pedal-smoothness.d.ts +6 -0
- package/lib/esm/data/data.left-torque-effectiveness.d.ts +6 -0
- package/lib/esm/data/data.max-respiration-rate.d.ts +5 -0
- package/lib/esm/data/data.min-respiration-rate.d.ts +5 -0
- package/lib/esm/data/data.primary-benefit.d.ts +6 -0
- package/lib/esm/data/data.resting-calories.d.ts +5 -0
- package/lib/esm/data/data.right-pedal-smoothness.d.ts +6 -0
- package/lib/esm/data/data.right-torque-effectiveness.d.ts +6 -0
- package/lib/esm/data/data.total-flow.d.ts +5 -0
- package/lib/esm/data/data.total-grit.d.ts +5 -0
- package/lib/esm/data/data.training-load-peak.d.ts +5 -0
- package/lib/esm/data/data.weight.d.ts +6 -0
- package/lib/esm/events/adapters/importers/fit/importer.fit.d.ts +3 -1
- package/lib/esm/events/adapters/importers/fit/importer.fit.mtb.spec.d.ts +1 -0
- package/lib/esm/events/adapters/importers/fit/importer.fit.road.spec.d.ts +1 -0
- package/lib/esm/index.d.ts +4 -0
- package/lib/esm/index.js +522 -4
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataTotalFlow = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataTotalFlow extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataTotalFlow = DataTotalFlow;
|
|
8
|
+
DataTotalFlow.type = 'Total Flow';
|
|
9
|
+
DataTotalFlow.unit = '';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataTotalGrit = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataTotalGrit extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataTotalGrit = DataTotalGrit;
|
|
8
|
+
DataTotalGrit.type = 'Total Grit';
|
|
9
|
+
DataTotalGrit.unit = '';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataTrainingLoadPeak = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataTrainingLoadPeak extends data_number_1.DataNumber {
|
|
6
|
+
}
|
|
7
|
+
exports.DataTrainingLoadPeak = DataTrainingLoadPeak;
|
|
8
|
+
DataTrainingLoadPeak.type = 'Training Load Peak';
|
|
9
|
+
DataTrainingLoadPeak.unit = '';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataWeight = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataWeight extends data_number_1.DataNumber {
|
|
6
|
+
getDisplayValue() {
|
|
7
|
+
return this.getValue().toFixed(1);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.DataWeight = DataWeight;
|
|
11
|
+
DataWeight.type = 'Weight';
|
|
12
|
+
DataWeight.unit = 'kg';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EventInterface } from '../../../event.interface';
|
|
2
2
|
import { CreatorInterface } from '../../../../creators/creator.interface';
|
|
3
|
+
import { ActivityInterface } from '../../../../activities/activity.interface';
|
|
4
|
+
import { DataInterface } from '../../../../data/data.interface';
|
|
3
5
|
import { ActivityParsingOptions } from '../../../../activities/activity-parsing-options';
|
|
4
6
|
import { Buffer } from 'buffer';
|
|
5
7
|
export declare class EventImporterFIT {
|
|
@@ -27,7 +29,7 @@ export declare class EventImporterFIT {
|
|
|
27
29
|
*/
|
|
28
30
|
private static swapTimesIfRequired;
|
|
29
31
|
private static getActivityTypeFromSessionObject;
|
|
30
|
-
|
|
32
|
+
static getStatsFromObject(object: any, activity: ActivityInterface, isLap: boolean): DataInterface[];
|
|
31
33
|
static getCreatorFromFitDataObject(fitDataObject: any): CreatorInterface;
|
|
32
34
|
}
|
|
33
35
|
export interface FITFileActivityEvent {
|
|
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.EventImporterFIT = void 0;
|
|
16
13
|
const event_1 = require("../../../event");
|
|
@@ -107,6 +104,20 @@ const data_anaerobic_training_effect_1 = require("../../../../data/data-anaerobi
|
|
|
107
104
|
const importer_fit_wahoo_device_names_1 = require("./importer.fit.wahoo.device.names");
|
|
108
105
|
const importer_fit_coros_device_names_1 = require("./importer.fit.coros.device.names");
|
|
109
106
|
const importer_fit_srm_device_names_1 = require("./importer.fit.srm.device.names");
|
|
107
|
+
const data_avg_respiration_rate_1 = require("../../../../data/data.avg-respiration-rate");
|
|
108
|
+
const data_max_respiration_rate_1 = require("../../../../data/data.max-respiration-rate");
|
|
109
|
+
const data_min_respiration_rate_1 = require("../../../../data/data.min-respiration-rate");
|
|
110
|
+
const data_jump_count_1 = require("../../../../data/data.jump-count");
|
|
111
|
+
const data_total_grit_1 = require("../../../../data/data.total-grit");
|
|
112
|
+
const data_avg_flow_1 = require("../../../../data/data.avg-flow");
|
|
113
|
+
const data_est_sweat_loss_1 = require("../../../../data/data.est-sweat-loss");
|
|
114
|
+
const data_primary_benefit_1 = require("../../../../data/data.primary-benefit");
|
|
115
|
+
const data_sport_profile_name_1 = require("../../../../data/data.sport-profile-name");
|
|
116
|
+
const data_resting_calories_1 = require("../../../../data/data.resting-calories");
|
|
117
|
+
const data_training_load_peak_1 = require("../../../../data/data.training-load-peak");
|
|
118
|
+
const data_avg_vam_1 = require("../../../../data/data.avg-vam");
|
|
119
|
+
const data_end_position_1 = require("../../../../data/data.end-position");
|
|
120
|
+
const data_start_position_1 = require("../../../../data/data.start-position");
|
|
110
121
|
const activity_parsing_options_1 = require("../../../../activities/activity-parsing-options");
|
|
111
122
|
const importer_fit_hammerhead_device_names_1 = require("./importer.fit.hammerhead.device.names");
|
|
112
123
|
const importer_fit_lezyne_device_names_1 = require("./importer.fit.lezyne.device.names");
|
|
@@ -116,16 +127,22 @@ const parsing_event_lib_error_1 = require("../../../../errors/parsing-event-lib.
|
|
|
116
127
|
const data_power_down_1 = require("../../../../data/data.power-down");
|
|
117
128
|
const data_power_up_1 = require("../../../../data/data.power-up");
|
|
118
129
|
const importer_fit_development_device_names_1 = require("./importer.fit.development.device.names");
|
|
130
|
+
const data_weight_1 = require("../../../../data/data.weight");
|
|
131
|
+
const data_height_1 = require("../../../../data/data.height");
|
|
132
|
+
const data_age_1 = require("../../../../data/data.age");
|
|
133
|
+
const data_gender_1 = require("../../../../data/data.gender");
|
|
134
|
+
const data_avg_grit_1 = require("../../../../data/data.avg-grit");
|
|
135
|
+
const data_jump_event_1 = require("../../../../data/data.jump-event");
|
|
119
136
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
120
137
|
// @ts-ignore
|
|
121
|
-
const
|
|
138
|
+
const FitFileParser = require('fit-file-parser').default;
|
|
122
139
|
// Threshold to detect that session.timestamp are not trustable (when exceeding 15% of session.total_elapsed_time)
|
|
123
140
|
const INVALID_DATES_ELAPSED_TIME_RATIO_THRESHOLD = 1.15;
|
|
124
141
|
class EventImporterFIT {
|
|
125
142
|
static getFromArrayBuffer(arrayBuffer_1) {
|
|
126
143
|
return __awaiter(this, arguments, void 0, function* (arrayBuffer, options = activity_parsing_options_1.ActivityParsingOptions.DEFAULT, name = 'New Event') {
|
|
127
144
|
return new Promise((resolve, reject) => {
|
|
128
|
-
const fitFileParser = new
|
|
145
|
+
const fitFileParser = new FitFileParser({
|
|
129
146
|
force: true,
|
|
130
147
|
speedUnit: 'm/s',
|
|
131
148
|
lengthUnit: 'm',
|
|
@@ -288,6 +305,23 @@ class EventImporterFIT {
|
|
|
288
305
|
}
|
|
289
306
|
}
|
|
290
307
|
});
|
|
308
|
+
// Add jumps
|
|
309
|
+
if (fitDataObject.jumps && fitDataObject.jumps.length) {
|
|
310
|
+
fitDataObject.jumps
|
|
311
|
+
.filter((jump) => {
|
|
312
|
+
const timestamp = new Date(jump.timestamp);
|
|
313
|
+
// Relaxed check for jumps as they might be recorded slightly outside session stats or have timezone offsets
|
|
314
|
+
const margin = 24 * 60 * 60 * 1000; // 24 hours
|
|
315
|
+
return timestamp.getTime() >= activity.startDate.getTime() - margin && timestamp.getTime() <= activity.endDate.getTime() + margin;
|
|
316
|
+
})
|
|
317
|
+
.forEach((jump) => {
|
|
318
|
+
activity.addEvent(new data_jump_event_1.DataJumpEvent(activity.getDateIndex(jump.timestamp), {
|
|
319
|
+
distance: jump.distance,
|
|
320
|
+
height: jump.height,
|
|
321
|
+
score: jump.score
|
|
322
|
+
}));
|
|
323
|
+
});
|
|
324
|
+
}
|
|
291
325
|
// Get the samples..
|
|
292
326
|
// Test if activity is lengths based
|
|
293
327
|
// Indeed when based on lengths, an activity do not provides samples under records object (e.g. Pool swimming activities)
|
|
@@ -442,6 +476,9 @@ class EventImporterFIT {
|
|
|
442
476
|
device.antTransmissionType = deviceInfo.ant_transmission_type;
|
|
443
477
|
device.antNetwork = deviceInfo.ant_network;
|
|
444
478
|
device.sourceType = deviceInfo.source_type;
|
|
479
|
+
if (deviceInfo.ant_id) {
|
|
480
|
+
device.antId = deviceInfo.ant_id;
|
|
481
|
+
}
|
|
445
482
|
device.cumOperatingTime = deviceInfo.cum_operating_time;
|
|
446
483
|
return device;
|
|
447
484
|
});
|
|
@@ -556,6 +593,100 @@ class EventImporterFIT {
|
|
|
556
593
|
const activity = new activity_1.Activity(startDate, endDate, this.getActivityTypeFromSessionObject(sessionObject), this.getCreatorFromFitDataObject(fitDataObject), options);
|
|
557
594
|
// Set the activity stats
|
|
558
595
|
this.getStatsFromObject(sessionObject, activity, false).forEach(stat => activity.addStat(stat));
|
|
596
|
+
// Check for VO2 Max in jumps
|
|
597
|
+
if (fitDataObject.jumps && fitDataObject.jumps.length) {
|
|
598
|
+
const jumpWithMets = fitDataObject.jumps.find((j) => j.enhanced_mets);
|
|
599
|
+
if (jumpWithMets) {
|
|
600
|
+
activity.addStat(new data_vo2_max_1.DataVO2Max(jumpWithMets.enhanced_mets * 3.5));
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
// Check for User Profile
|
|
604
|
+
if (fitDataObject.user_profile) {
|
|
605
|
+
const userProfile = fitDataObject.user_profile;
|
|
606
|
+
if ((0, helpers_1.isNumberOrString)(userProfile.weight)) {
|
|
607
|
+
activity.addStat(new data_weight_1.DataWeight(userProfile.weight));
|
|
608
|
+
}
|
|
609
|
+
if ((0, helpers_1.isNumberOrString)(userProfile.height)) {
|
|
610
|
+
activity.addStat(new data_height_1.DataHeight(userProfile.height));
|
|
611
|
+
}
|
|
612
|
+
if ((0, helpers_1.isNumberOrString)(userProfile.age)) {
|
|
613
|
+
activity.addStat(new data_age_1.DataAge(userProfile.age));
|
|
614
|
+
}
|
|
615
|
+
if (userProfile.gender) {
|
|
616
|
+
activity.addStat(new data_gender_1.DataGender(userProfile.gender));
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
// Check for HR zone durations from time_in_zone messages
|
|
620
|
+
// This is an alternative source when sessionObject.time_in_hr_zone is not available
|
|
621
|
+
if (fitDataObject.time_in_zone && fitDataObject.time_in_zone.length) {
|
|
622
|
+
// Find session-level time_in_zone message (reference_mesg = 18 for session, reference_index = 0 for first session)
|
|
623
|
+
const sessionTimeInZone = fitDataObject.time_in_zone.find((z) => z.reference_mesg === 18 && (z.reference_index === 0 || z.reference_index === undefined));
|
|
624
|
+
if (sessionTimeInZone && sessionTimeInZone.time_in_hr_zone && Array.isArray(sessionTimeInZone.time_in_hr_zone)) {
|
|
625
|
+
const hrZones = sessionTimeInZone.time_in_hr_zone;
|
|
626
|
+
const hrZoneBoundaries = sessionTimeInZone.hr_zone_high_boundary;
|
|
627
|
+
// Only add zone duration stats if not already set from sessionObject.time_in_hr_zone
|
|
628
|
+
if (!activity.getStat(data_heart_rate_zone_one_duration_1.DataHeartRateZoneOneDuration.type)) {
|
|
629
|
+
if (hrZones[0] !== undefined && hrZones[0] !== null) {
|
|
630
|
+
activity.addStat(new data_heart_rate_zone_one_duration_1.DataHeartRateZoneOneDuration(hrZones[0]));
|
|
631
|
+
}
|
|
632
|
+
if (hrZones[1] !== undefined && hrZones[1] !== null) {
|
|
633
|
+
activity.addStat(new data_heart_rate_zone_two_duration_1.DataHeartRateZoneTwoDuration(hrZones[1]));
|
|
634
|
+
}
|
|
635
|
+
if (hrZones[2] !== undefined && hrZones[2] !== null) {
|
|
636
|
+
activity.addStat(new data_heart_rate_zone_three_duration_1.DataHeartRateZoneThreeDuration(hrZones[2]));
|
|
637
|
+
}
|
|
638
|
+
if (hrZones[3] !== undefined && hrZones[3] !== null) {
|
|
639
|
+
activity.addStat(new data_heart_rate_zone_four_duration_1.DataHeartRateZoneFourDuration(hrZones[3]));
|
|
640
|
+
}
|
|
641
|
+
if (hrZones[4] !== undefined && hrZones[4] !== null) {
|
|
642
|
+
activity.addStat(new data_heart_rate_zone_five_duration_1.DataHeartRateZoneFiveDuration(hrZones[4]));
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
// Check if IntensityZones for HR is already set, if not create one with boundaries
|
|
646
|
+
const existingHrZones = activity.intensityZones.find(iz => iz.type === data_heart_rate_1.DataHeartRate.type);
|
|
647
|
+
if (!existingHrZones && Array.isArray(hrZoneBoundaries) && hrZoneBoundaries.length > 0) {
|
|
648
|
+
// Create IntensityZones with boundaries
|
|
649
|
+
const hrIntensityZones = new intensity_zones_1.IntensityZones(data_heart_rate_1.DataHeartRate.type);
|
|
650
|
+
hrIntensityZones.zone1Duration = hrZones[0] || 0;
|
|
651
|
+
hrIntensityZones.zone2Duration = hrZones[1] || 0;
|
|
652
|
+
hrIntensityZones.zone3Duration = hrZones[2] || 0;
|
|
653
|
+
hrIntensityZones.zone4Duration = hrZones[3] || 0;
|
|
654
|
+
hrIntensityZones.zone5Duration = hrZones[4] || 0;
|
|
655
|
+
// hr_zone_high_boundary[n] is the upper limit of zone n+1
|
|
656
|
+
// Zone 2 lower limit = Zone 1 high boundary = hrZoneBoundaries[0]
|
|
657
|
+
// Zone 3 lower limit = Zone 2 high boundary = hrZoneBoundaries[1]
|
|
658
|
+
// etc.
|
|
659
|
+
if ((0, helpers_1.isNumber)(hrZoneBoundaries[0]) && hrZoneBoundaries[0] !== 255) {
|
|
660
|
+
hrIntensityZones.zone2LowerLimit = hrZoneBoundaries[0];
|
|
661
|
+
}
|
|
662
|
+
if ((0, helpers_1.isNumber)(hrZoneBoundaries[1]) && hrZoneBoundaries[1] !== 255) {
|
|
663
|
+
hrIntensityZones.zone3LowerLimit = hrZoneBoundaries[1];
|
|
664
|
+
}
|
|
665
|
+
if ((0, helpers_1.isNumber)(hrZoneBoundaries[2]) && hrZoneBoundaries[2] !== 255) {
|
|
666
|
+
hrIntensityZones.zone4LowerLimit = hrZoneBoundaries[2];
|
|
667
|
+
}
|
|
668
|
+
if ((0, helpers_1.isNumber)(hrZoneBoundaries[3]) && hrZoneBoundaries[3] !== 255) {
|
|
669
|
+
hrIntensityZones.zone5LowerLimit = hrZoneBoundaries[3];
|
|
670
|
+
}
|
|
671
|
+
activity.intensityZones.push(hrIntensityZones);
|
|
672
|
+
}
|
|
673
|
+
else if (existingHrZones && Array.isArray(hrZoneBoundaries) && hrZoneBoundaries.length > 0) {
|
|
674
|
+
// Update existing IntensityZones with boundary data if not set
|
|
675
|
+
if (!existingHrZones.zone2LowerLimit && (0, helpers_1.isNumber)(hrZoneBoundaries[0]) && hrZoneBoundaries[0] !== 255) {
|
|
676
|
+
existingHrZones.zone2LowerLimit = hrZoneBoundaries[0];
|
|
677
|
+
}
|
|
678
|
+
if (!existingHrZones.zone3LowerLimit && (0, helpers_1.isNumber)(hrZoneBoundaries[1]) && hrZoneBoundaries[1] !== 255) {
|
|
679
|
+
existingHrZones.zone3LowerLimit = hrZoneBoundaries[1];
|
|
680
|
+
}
|
|
681
|
+
if (!existingHrZones.zone4LowerLimit && (0, helpers_1.isNumber)(hrZoneBoundaries[2]) && hrZoneBoundaries[2] !== 255) {
|
|
682
|
+
existingHrZones.zone4LowerLimit = hrZoneBoundaries[2];
|
|
683
|
+
}
|
|
684
|
+
if (!existingHrZones.zone5LowerLimit && (0, helpers_1.isNumber)(hrZoneBoundaries[3]) && hrZoneBoundaries[3] !== 255) {
|
|
685
|
+
existingHrZones.zone5LowerLimit = hrZoneBoundaries[3];
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
559
690
|
return activity;
|
|
560
691
|
}
|
|
561
692
|
}
|
|
@@ -686,6 +817,9 @@ class EventImporterFIT {
|
|
|
686
817
|
stats.push(new data_heart_rate_max_1.DataHeartRateMax(object.max_heart_rate));
|
|
687
818
|
}
|
|
688
819
|
// Cadence
|
|
820
|
+
if (object.vo2_max_cycling && object.vo2_max_cycling > 10) {
|
|
821
|
+
stats.push(new data_vo2_max_1.DataVO2Max(object.vo2_max_cycling));
|
|
822
|
+
}
|
|
689
823
|
if ((0, helpers_1.isNumberOrString)(object.avg_cadence)) {
|
|
690
824
|
stats.push(new data_cadence_avg_1.DataCadenceAvg(object.avg_cadence));
|
|
691
825
|
}
|
|
@@ -699,6 +833,15 @@ class EventImporterFIT {
|
|
|
699
833
|
if ((0, helpers_1.isNumberOrString)(object.avg_power)) {
|
|
700
834
|
stats.push(new data_power_avg_1.DataPowerAvg(object.avg_power));
|
|
701
835
|
}
|
|
836
|
+
// Grit & Flow
|
|
837
|
+
if ((0, helpers_1.isNumberOrString)(object.total_flow)) {
|
|
838
|
+
}
|
|
839
|
+
if ((0, helpers_1.isNumberOrString)(object.avg_grit)) {
|
|
840
|
+
stats.push(new data_avg_grit_1.DataAvgGrit(object.avg_grit));
|
|
841
|
+
}
|
|
842
|
+
if ((0, helpers_1.isNumberOrString)(object.avg_flow)) {
|
|
843
|
+
stats.push(new data_avg_flow_1.DataAvgFlow(object.avg_flow));
|
|
844
|
+
}
|
|
702
845
|
if ((0, helpers_1.isNumberOrString)(object.min_power)) {
|
|
703
846
|
stats.push(new data_power_min_1.DataPowerMin(object.min_power));
|
|
704
847
|
}
|
|
@@ -770,7 +913,10 @@ class EventImporterFIT {
|
|
|
770
913
|
stats.push(new data_aerobic_training_effect_1.DataAerobicTrainingEffect(object.total_training_effect));
|
|
771
914
|
}
|
|
772
915
|
// Total training anaerobic effect
|
|
773
|
-
if ((0, helpers_1.isNumberOrString)(object.
|
|
916
|
+
if ((0, helpers_1.isNumberOrString)(object.total_anaerobic_training_effect)) {
|
|
917
|
+
stats.push(new data_anaerobic_training_effect_1.DataAnaerobicTrainingEffect(object.total_anaerobic_training_effect));
|
|
918
|
+
}
|
|
919
|
+
else if ((0, helpers_1.isNumberOrString)(object.total_anaerobic_effect)) {
|
|
774
920
|
stats.push(new data_anaerobic_training_effect_1.DataAnaerobicTrainingEffect(object.total_anaerobic_effect));
|
|
775
921
|
}
|
|
776
922
|
// Vo2Max
|
|
@@ -843,6 +989,65 @@ class EventImporterFIT {
|
|
|
843
989
|
const avgStrideLengthMeters = object.avg_step_length / 1000;
|
|
844
990
|
stats.push(new data_avg_stride_length_1.DataAvgStrideLength(Math.round(avgStrideLengthMeters * 100) / 100));
|
|
845
991
|
}
|
|
992
|
+
// Respiration Rate
|
|
993
|
+
if ((0, helpers_1.isNumberOrString)(object.avg_respiration_rate) || (0, helpers_1.isNumberOrString)(object.enhanced_avg_respiration_rate)) {
|
|
994
|
+
stats.push(new data_avg_respiration_rate_1.DataAvgRespirationRate(object.enhanced_avg_respiration_rate || object.avg_respiration_rate));
|
|
995
|
+
}
|
|
996
|
+
if ((0, helpers_1.isNumberOrString)(object.max_respiration_rate) || (0, helpers_1.isNumberOrString)(object.enhanced_max_respiration_rate)) {
|
|
997
|
+
stats.push(new data_max_respiration_rate_1.DataMaxRespirationRate(object.enhanced_max_respiration_rate || object.max_respiration_rate));
|
|
998
|
+
}
|
|
999
|
+
if ((0, helpers_1.isNumberOrString)(object.min_respiration_rate) || (0, helpers_1.isNumberOrString)(object.enhanced_min_respiration_rate)) {
|
|
1000
|
+
stats.push(new data_min_respiration_rate_1.DataMinRespirationRate(object.enhanced_min_respiration_rate || object.min_respiration_rate));
|
|
1001
|
+
}
|
|
1002
|
+
// Total Grit
|
|
1003
|
+
if ((0, helpers_1.isNumberOrString)(object.total_grit)) {
|
|
1004
|
+
stats.push(new data_total_grit_1.DataTotalGrit(object.total_grit));
|
|
1005
|
+
}
|
|
1006
|
+
// Avg Flow
|
|
1007
|
+
if ((0, helpers_1.isNumberOrString)(object.avg_flow)) {
|
|
1008
|
+
stats.push(new data_avg_flow_1.DataAvgFlow(object.avg_flow));
|
|
1009
|
+
}
|
|
1010
|
+
// Est Sweat Loss
|
|
1011
|
+
if ((0, helpers_1.isNumberOrString)(object.est_sweat_loss)) {
|
|
1012
|
+
stats.push(new data_est_sweat_loss_1.DataEstSweatLoss(object.est_sweat_loss));
|
|
1013
|
+
}
|
|
1014
|
+
// Primary Benefit
|
|
1015
|
+
if ((0, helpers_1.isNumberOrString)(object.primary_benefit)) {
|
|
1016
|
+
stats.push(new data_primary_benefit_1.DataPrimaryBenefit(object.primary_benefit));
|
|
1017
|
+
}
|
|
1018
|
+
// Sport Profile Name
|
|
1019
|
+
if (object.sport_profile_name) {
|
|
1020
|
+
stats.push(new data_sport_profile_name_1.DataSportProfileName(object.sport_profile_name));
|
|
1021
|
+
}
|
|
1022
|
+
// Jump Count
|
|
1023
|
+
if ((0, helpers_1.isNumberOrString)(object.jump_count)) {
|
|
1024
|
+
stats.push(new data_jump_count_1.DataJumpCount(object.jump_count));
|
|
1025
|
+
}
|
|
1026
|
+
// Training Load Peak
|
|
1027
|
+
if ((0, helpers_1.isNumberOrString)(object.training_load_peak)) {
|
|
1028
|
+
stats.push(new data_training_load_peak_1.DataTrainingLoadPeak(object.training_load_peak));
|
|
1029
|
+
}
|
|
1030
|
+
// Positions
|
|
1031
|
+
if ((0, helpers_1.isNumber)(object.start_position_lat) && (0, helpers_1.isNumber)(object.start_position_long)) {
|
|
1032
|
+
stats.push(new data_start_position_1.DataStartPosition({
|
|
1033
|
+
latitudeDegrees: object.start_position_lat,
|
|
1034
|
+
longitudeDegrees: object.start_position_long,
|
|
1035
|
+
}));
|
|
1036
|
+
}
|
|
1037
|
+
if ((0, helpers_1.isNumber)(object.end_position_lat) && (0, helpers_1.isNumber)(object.end_position_long)) {
|
|
1038
|
+
stats.push(new data_end_position_1.DataEndPosition({
|
|
1039
|
+
latitudeDegrees: object.end_position_lat,
|
|
1040
|
+
longitudeDegrees: object.end_position_long,
|
|
1041
|
+
}));
|
|
1042
|
+
}
|
|
1043
|
+
// Resting Calories
|
|
1044
|
+
if ((0, helpers_1.isNumberOrString)(object.resting_calories)) {
|
|
1045
|
+
stats.push(new data_resting_calories_1.DataRestingCalories(object.resting_calories));
|
|
1046
|
+
}
|
|
1047
|
+
// Avg VAM
|
|
1048
|
+
if ((0, helpers_1.isNumberOrString)(object.avg_vam)) {
|
|
1049
|
+
stats.push(new data_avg_vam_1.DataAvgVAM(object.avg_vam));
|
|
1050
|
+
}
|
|
846
1051
|
return stats;
|
|
847
1052
|
}
|
|
848
1053
|
static getCreatorFromFitDataObject(fitDataObject) {
|
|
@@ -27,6 +27,12 @@ const data_step_length_1 = require("../../../../data/data.step-length");
|
|
|
27
27
|
const data_vertical_ratio_1 = require("../../../../data/data.vertical-ratio");
|
|
28
28
|
const data_ground_time_1 = require("../../../../data/data.ground-time");
|
|
29
29
|
const data_air_power_1 = require("../../../../data/data.air-power");
|
|
30
|
+
const data_grit_1 = require("../../../../data/data.grit");
|
|
31
|
+
const data_flow_1 = require("../../../../data/data.flow");
|
|
32
|
+
const data_left_torque_effectiveness_1 = require("../../../../data/data.left-torque-effectiveness");
|
|
33
|
+
const data_right_torque_effectiveness_1 = require("../../../../data/data.right-torque-effectiveness");
|
|
34
|
+
const data_left_pedal_smoothness_1 = require("../../../../data/data.left-pedal-smoothness");
|
|
35
|
+
const data_right_pedal_smoothness_1 = require("../../../../data/data.right-pedal-smoothness");
|
|
30
36
|
const constants_1 = require("../../../../constants/constants");
|
|
31
37
|
exports.FITSampleMapper = [
|
|
32
38
|
{
|
|
@@ -230,5 +236,41 @@ exports.FITSampleMapper = [
|
|
|
230
236
|
getSampleValue: (sample) => {
|
|
231
237
|
return sample.vertical_ratio;
|
|
232
238
|
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
dataType: data_grit_1.DataGrit.type,
|
|
242
|
+
getSampleValue: (sample) => {
|
|
243
|
+
return sample.grit;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
dataType: data_flow_1.DataFlow.type,
|
|
248
|
+
getSampleValue: (sample) => {
|
|
249
|
+
return sample.flow;
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
dataType: data_left_torque_effectiveness_1.DataLeftTorqueEffectiveness.type,
|
|
254
|
+
getSampleValue: (sample) => {
|
|
255
|
+
return sample.left_torque_effectiveness;
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
dataType: data_right_torque_effectiveness_1.DataRightTorqueEffectiveness.type,
|
|
260
|
+
getSampleValue: (sample) => {
|
|
261
|
+
return sample.right_torque_effectiveness;
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
dataType: data_left_pedal_smoothness_1.DataLeftPedalSmoothness.type,
|
|
266
|
+
getSampleValue: (sample) => {
|
|
267
|
+
return sample.left_pedal_smoothness;
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
dataType: data_right_pedal_smoothness_1.DataRightPedalSmoothness.type,
|
|
272
|
+
getSampleValue: (sample) => {
|
|
273
|
+
return sample.right_pedal_smoothness;
|
|
274
|
+
}
|
|
233
275
|
}
|
|
234
276
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|