@sports-alliance/sports-lib 7.2.2 → 7.2.3
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/.agent/README.md +16 -0
- package/inspect_jump_raw.js +24 -0
- package/lib/cjs/data/data.jump-event.d.ts +6 -1
- package/lib/cjs/data/data.jump-stats.d.ts +91 -0
- package/lib/cjs/data/data.jump-stats.js +112 -0
- package/lib/cjs/data/data.store.js +20 -1
- package/lib/cjs/events/adapters/importers/fit/importer.fit.js +107 -9
- package/lib/cjs/events/adapters/importers/fit/importer.fit.mtb.spec.js +34 -6
- package/lib/esm/data/data.jump-event.d.ts +6 -1
- package/lib/esm/data/data.jump-stats.d.ts +91 -0
- package/lib/esm/index.js +298 -8
- package/package.json +2 -2
package/.agent/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Agent Configuration for sports-lib
|
|
2
|
+
|
|
3
|
+
This directory contains configuration, skills, and workflows for AI agents working on the `sports-lib` project.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
- **skills/**: Contains specialized "skills" (instructions + scripts) for the agent.
|
|
8
|
+
- `debug-utils`: Instructions for using the project's ad-hoc FIT file debugging scripts.
|
|
9
|
+
- **workflows/**: Contains step-by-step guides for common tasks.
|
|
10
|
+
- `add-new-data.md`: How to identify and add new data fields from FIT files.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
When asking an agent to help with debugging or adding data, you can refer them to these specific skills or workflows if they don't automatically pick them up.
|
|
15
|
+
- "Use the debug-utils skill to inspect this file."
|
|
16
|
+
- "Follow the add-new-data workflow."
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const FitParser = require('fit-file-parser').default;
|
|
3
|
+
|
|
4
|
+
const content = fs.readFileSync('./samples/fit/jumps-mtb.fit');
|
|
5
|
+
const fitParser = new FitParser({ force: true, mode: 'both' });
|
|
6
|
+
|
|
7
|
+
fitParser.parse(content, (error, data) => {
|
|
8
|
+
if (error) {
|
|
9
|
+
console.error(error);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
console.log('=== ROOT KEYS ===');
|
|
13
|
+
console.log(Object.keys(data).join('\n'));
|
|
14
|
+
|
|
15
|
+
if (data.jumps) {
|
|
16
|
+
console.log('\n=== FIRST JUMP ===');
|
|
17
|
+
console.log(data.jumps[0]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (data.user_profiles) {
|
|
21
|
+
console.log('\n=== USER PROFILES ===');
|
|
22
|
+
console.log(data.user_profiles);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { DataEvent } from './data.event';
|
|
2
2
|
export interface JumpEventInterface {
|
|
3
3
|
distance: number;
|
|
4
|
-
height
|
|
4
|
+
height?: number;
|
|
5
5
|
score: number;
|
|
6
|
+
hang_time?: number;
|
|
7
|
+
position_lat?: number;
|
|
8
|
+
position_long?: number;
|
|
9
|
+
speed?: number;
|
|
10
|
+
rotations?: number;
|
|
6
11
|
}
|
|
7
12
|
export declare class DataJumpEvent extends DataEvent {
|
|
8
13
|
jumpData: JumpEventInterface;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { DataNumber } from './data.number';
|
|
2
|
+
export declare class DataJumpHangTimeMin extends DataNumber {
|
|
3
|
+
static type: string;
|
|
4
|
+
static unit: string;
|
|
5
|
+
constructor(value: number);
|
|
6
|
+
}
|
|
7
|
+
export declare class DataJumpHangTimeMax extends DataNumber {
|
|
8
|
+
static type: string;
|
|
9
|
+
static unit: string;
|
|
10
|
+
constructor(value: number);
|
|
11
|
+
}
|
|
12
|
+
export declare class DataJumpHangTimeAvg extends DataNumber {
|
|
13
|
+
static type: string;
|
|
14
|
+
static unit: string;
|
|
15
|
+
constructor(value: number);
|
|
16
|
+
}
|
|
17
|
+
export declare class DataJumpDistanceMin extends DataNumber {
|
|
18
|
+
static type: string;
|
|
19
|
+
static unit: string;
|
|
20
|
+
constructor(value: number);
|
|
21
|
+
}
|
|
22
|
+
export declare class DataJumpDistanceMax extends DataNumber {
|
|
23
|
+
static type: string;
|
|
24
|
+
static unit: string;
|
|
25
|
+
constructor(value: number);
|
|
26
|
+
}
|
|
27
|
+
export declare class DataJumpDistanceAvg extends DataNumber {
|
|
28
|
+
static type: string;
|
|
29
|
+
static unit: string;
|
|
30
|
+
constructor(value: number);
|
|
31
|
+
}
|
|
32
|
+
export declare class DataJumpSpeedMin extends DataNumber {
|
|
33
|
+
static type: string;
|
|
34
|
+
static unit: string;
|
|
35
|
+
constructor(value: number);
|
|
36
|
+
}
|
|
37
|
+
export declare class DataJumpSpeedMax extends DataNumber {
|
|
38
|
+
static type: string;
|
|
39
|
+
static unit: string;
|
|
40
|
+
constructor(value: number);
|
|
41
|
+
}
|
|
42
|
+
export declare class DataJumpSpeedAvg extends DataNumber {
|
|
43
|
+
static type: string;
|
|
44
|
+
static unit: string;
|
|
45
|
+
constructor(value: number);
|
|
46
|
+
}
|
|
47
|
+
export declare class DataJumpRotationsMin extends DataNumber {
|
|
48
|
+
static type: string;
|
|
49
|
+
static unit: string;
|
|
50
|
+
constructor(value: number);
|
|
51
|
+
}
|
|
52
|
+
export declare class DataJumpRotationsMax extends DataNumber {
|
|
53
|
+
static type: string;
|
|
54
|
+
static unit: string;
|
|
55
|
+
constructor(value: number);
|
|
56
|
+
}
|
|
57
|
+
export declare class DataJumpRotationsAvg extends DataNumber {
|
|
58
|
+
static type: string;
|
|
59
|
+
static unit: string;
|
|
60
|
+
constructor(value: number);
|
|
61
|
+
}
|
|
62
|
+
export declare class DataJumpScoreMin extends DataNumber {
|
|
63
|
+
static type: string;
|
|
64
|
+
static unit: string;
|
|
65
|
+
constructor(value: number);
|
|
66
|
+
}
|
|
67
|
+
export declare class DataJumpScoreMax extends DataNumber {
|
|
68
|
+
static type: string;
|
|
69
|
+
static unit: string;
|
|
70
|
+
constructor(value: number);
|
|
71
|
+
}
|
|
72
|
+
export declare class DataJumpScoreAvg extends DataNumber {
|
|
73
|
+
static type: string;
|
|
74
|
+
static unit: string;
|
|
75
|
+
constructor(value: number);
|
|
76
|
+
}
|
|
77
|
+
export declare class DataJumpHeightMin extends DataNumber {
|
|
78
|
+
static type: string;
|
|
79
|
+
static unit: string;
|
|
80
|
+
constructor(value: number);
|
|
81
|
+
}
|
|
82
|
+
export declare class DataJumpHeightMax extends DataNumber {
|
|
83
|
+
static type: string;
|
|
84
|
+
static unit: string;
|
|
85
|
+
constructor(value: number);
|
|
86
|
+
}
|
|
87
|
+
export declare class DataJumpHeightAvg extends DataNumber {
|
|
88
|
+
static type: string;
|
|
89
|
+
static unit: string;
|
|
90
|
+
constructor(value: number);
|
|
91
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataJumpHeightAvg = exports.DataJumpHeightMax = exports.DataJumpHeightMin = exports.DataJumpScoreAvg = exports.DataJumpScoreMax = exports.DataJumpScoreMin = exports.DataJumpRotationsAvg = exports.DataJumpRotationsMax = exports.DataJumpRotationsMin = exports.DataJumpSpeedAvg = exports.DataJumpSpeedMax = exports.DataJumpSpeedMin = exports.DataJumpDistanceAvg = exports.DataJumpDistanceMax = exports.DataJumpDistanceMin = exports.DataJumpHangTimeAvg = exports.DataJumpHangTimeMax = exports.DataJumpHangTimeMin = void 0;
|
|
4
|
+
const data_number_1 = require("./data.number");
|
|
5
|
+
class DataJumpHangTimeMin extends data_number_1.DataNumber {
|
|
6
|
+
constructor(value) { super(value); }
|
|
7
|
+
}
|
|
8
|
+
exports.DataJumpHangTimeMin = DataJumpHangTimeMin;
|
|
9
|
+
DataJumpHangTimeMin.type = 'Jump Hang Time Min';
|
|
10
|
+
DataJumpHangTimeMin.unit = 's';
|
|
11
|
+
class DataJumpHangTimeMax extends data_number_1.DataNumber {
|
|
12
|
+
constructor(value) { super(value); }
|
|
13
|
+
}
|
|
14
|
+
exports.DataJumpHangTimeMax = DataJumpHangTimeMax;
|
|
15
|
+
DataJumpHangTimeMax.type = 'Jump Hang Time Max';
|
|
16
|
+
DataJumpHangTimeMax.unit = 's';
|
|
17
|
+
class DataJumpHangTimeAvg extends data_number_1.DataNumber {
|
|
18
|
+
constructor(value) { super(value); }
|
|
19
|
+
}
|
|
20
|
+
exports.DataJumpHangTimeAvg = DataJumpHangTimeAvg;
|
|
21
|
+
DataJumpHangTimeAvg.type = 'Jump Hang Time Avg';
|
|
22
|
+
DataJumpHangTimeAvg.unit = 's';
|
|
23
|
+
class DataJumpDistanceMin extends data_number_1.DataNumber {
|
|
24
|
+
constructor(value) { super(value); }
|
|
25
|
+
}
|
|
26
|
+
exports.DataJumpDistanceMin = DataJumpDistanceMin;
|
|
27
|
+
DataJumpDistanceMin.type = 'Jump Distance Min';
|
|
28
|
+
DataJumpDistanceMin.unit = 'm';
|
|
29
|
+
class DataJumpDistanceMax extends data_number_1.DataNumber {
|
|
30
|
+
constructor(value) { super(value); }
|
|
31
|
+
}
|
|
32
|
+
exports.DataJumpDistanceMax = DataJumpDistanceMax;
|
|
33
|
+
DataJumpDistanceMax.type = 'Jump Distance Max';
|
|
34
|
+
DataJumpDistanceMax.unit = 'm';
|
|
35
|
+
class DataJumpDistanceAvg extends data_number_1.DataNumber {
|
|
36
|
+
constructor(value) { super(value); }
|
|
37
|
+
}
|
|
38
|
+
exports.DataJumpDistanceAvg = DataJumpDistanceAvg;
|
|
39
|
+
DataJumpDistanceAvg.type = 'Jump Distance Avg';
|
|
40
|
+
DataJumpDistanceAvg.unit = 'm';
|
|
41
|
+
class DataJumpSpeedMin extends data_number_1.DataNumber {
|
|
42
|
+
constructor(value) { super(value); }
|
|
43
|
+
}
|
|
44
|
+
exports.DataJumpSpeedMin = DataJumpSpeedMin;
|
|
45
|
+
DataJumpSpeedMin.type = 'Jump Speed Min';
|
|
46
|
+
DataJumpSpeedMin.unit = 'm/s';
|
|
47
|
+
class DataJumpSpeedMax extends data_number_1.DataNumber {
|
|
48
|
+
constructor(value) { super(value); }
|
|
49
|
+
}
|
|
50
|
+
exports.DataJumpSpeedMax = DataJumpSpeedMax;
|
|
51
|
+
DataJumpSpeedMax.type = 'Jump Speed Max';
|
|
52
|
+
DataJumpSpeedMax.unit = 'm/s';
|
|
53
|
+
class DataJumpSpeedAvg extends data_number_1.DataNumber {
|
|
54
|
+
constructor(value) { super(value); }
|
|
55
|
+
}
|
|
56
|
+
exports.DataJumpSpeedAvg = DataJumpSpeedAvg;
|
|
57
|
+
DataJumpSpeedAvg.type = 'Jump Speed Avg';
|
|
58
|
+
DataJumpSpeedAvg.unit = 'm/s';
|
|
59
|
+
class DataJumpRotationsMin extends data_number_1.DataNumber {
|
|
60
|
+
constructor(value) { super(value); }
|
|
61
|
+
}
|
|
62
|
+
exports.DataJumpRotationsMin = DataJumpRotationsMin;
|
|
63
|
+
DataJumpRotationsMin.type = 'Jump Rotations Min';
|
|
64
|
+
DataJumpRotationsMin.unit = '';
|
|
65
|
+
class DataJumpRotationsMax extends data_number_1.DataNumber {
|
|
66
|
+
constructor(value) { super(value); }
|
|
67
|
+
}
|
|
68
|
+
exports.DataJumpRotationsMax = DataJumpRotationsMax;
|
|
69
|
+
DataJumpRotationsMax.type = 'Jump Rotations Max';
|
|
70
|
+
DataJumpRotationsMax.unit = '';
|
|
71
|
+
class DataJumpRotationsAvg extends data_number_1.DataNumber {
|
|
72
|
+
constructor(value) { super(value); }
|
|
73
|
+
}
|
|
74
|
+
exports.DataJumpRotationsAvg = DataJumpRotationsAvg;
|
|
75
|
+
DataJumpRotationsAvg.type = 'Jump Rotations Avg';
|
|
76
|
+
DataJumpRotationsAvg.unit = '';
|
|
77
|
+
class DataJumpScoreMin extends data_number_1.DataNumber {
|
|
78
|
+
constructor(value) { super(value); }
|
|
79
|
+
}
|
|
80
|
+
exports.DataJumpScoreMin = DataJumpScoreMin;
|
|
81
|
+
DataJumpScoreMin.type = 'Jump Score Min';
|
|
82
|
+
DataJumpScoreMin.unit = '';
|
|
83
|
+
class DataJumpScoreMax extends data_number_1.DataNumber {
|
|
84
|
+
constructor(value) { super(value); }
|
|
85
|
+
}
|
|
86
|
+
exports.DataJumpScoreMax = DataJumpScoreMax;
|
|
87
|
+
DataJumpScoreMax.type = 'Jump Score Max';
|
|
88
|
+
DataJumpScoreMax.unit = '';
|
|
89
|
+
class DataJumpScoreAvg extends data_number_1.DataNumber {
|
|
90
|
+
constructor(value) { super(value); }
|
|
91
|
+
}
|
|
92
|
+
exports.DataJumpScoreAvg = DataJumpScoreAvg;
|
|
93
|
+
DataJumpScoreAvg.type = 'Jump Score Avg';
|
|
94
|
+
DataJumpScoreAvg.unit = '';
|
|
95
|
+
class DataJumpHeightMin extends data_number_1.DataNumber {
|
|
96
|
+
constructor(value) { super(value); }
|
|
97
|
+
}
|
|
98
|
+
exports.DataJumpHeightMin = DataJumpHeightMin;
|
|
99
|
+
DataJumpHeightMin.type = 'Jump Height Min';
|
|
100
|
+
DataJumpHeightMin.unit = 'm';
|
|
101
|
+
class DataJumpHeightMax extends data_number_1.DataNumber {
|
|
102
|
+
constructor(value) { super(value); }
|
|
103
|
+
}
|
|
104
|
+
exports.DataJumpHeightMax = DataJumpHeightMax;
|
|
105
|
+
DataJumpHeightMax.type = 'Jump Height Max';
|
|
106
|
+
DataJumpHeightMax.unit = 'm';
|
|
107
|
+
class DataJumpHeightAvg extends data_number_1.DataNumber {
|
|
108
|
+
constructor(value) { super(value); }
|
|
109
|
+
}
|
|
110
|
+
exports.DataJumpHeightAvg = DataJumpHeightAvg;
|
|
111
|
+
DataJumpHeightAvg.type = 'Jump Height Avg';
|
|
112
|
+
DataJumpHeightAvg.unit = 'm';
|
|
@@ -213,6 +213,7 @@ const data_fitness_age_1 = require("./data.fitness-age");
|
|
|
213
213
|
const data_max_hr_setting_1 = require("./data.max-hr-setting");
|
|
214
214
|
const data_depth_1 = require("./data.depth");
|
|
215
215
|
const data_depth_max_1 = require("./data.depth-max");
|
|
216
|
+
const data_jump_stats_1 = require("./data.jump-stats");
|
|
216
217
|
// "Total Training effect" was renamed to "Aerobic Training Effect" in sports-lib 6.0
|
|
217
218
|
class DataTotalTrainingEffectLegacy extends data_aerobic_training_effect_1.DataAerobicTrainingEffect {
|
|
218
219
|
}
|
|
@@ -524,7 +525,25 @@ exports.DataStore = {
|
|
|
524
525
|
DataFitnessAge: data_fitness_age_1.DataFitnessAge,
|
|
525
526
|
DataMaxHRSetting: data_max_hr_setting_1.DataMaxHRSetting,
|
|
526
527
|
DataDepth: data_depth_1.DataDepth,
|
|
527
|
-
DataDepthMax: data_depth_max_1.DataDepthMax
|
|
528
|
+
DataDepthMax: data_depth_max_1.DataDepthMax,
|
|
529
|
+
DataJumpHangTimeMin: data_jump_stats_1.DataJumpHangTimeMin,
|
|
530
|
+
DataJumpHangTimeMax: data_jump_stats_1.DataJumpHangTimeMax,
|
|
531
|
+
DataJumpHangTimeAvg: data_jump_stats_1.DataJumpHangTimeAvg,
|
|
532
|
+
DataJumpDistanceMin: data_jump_stats_1.DataJumpDistanceMin,
|
|
533
|
+
DataJumpDistanceMax: data_jump_stats_1.DataJumpDistanceMax,
|
|
534
|
+
DataJumpDistanceAvg: data_jump_stats_1.DataJumpDistanceAvg,
|
|
535
|
+
DataJumpSpeedMin: data_jump_stats_1.DataJumpSpeedMin,
|
|
536
|
+
DataJumpSpeedMax: data_jump_stats_1.DataJumpSpeedMax,
|
|
537
|
+
DataJumpSpeedAvg: data_jump_stats_1.DataJumpSpeedAvg,
|
|
538
|
+
DataJumpRotationsMin: data_jump_stats_1.DataJumpRotationsMin,
|
|
539
|
+
DataJumpRotationsMax: data_jump_stats_1.DataJumpRotationsMax,
|
|
540
|
+
DataJumpRotationsAvg: data_jump_stats_1.DataJumpRotationsAvg,
|
|
541
|
+
DataJumpScoreMin: data_jump_stats_1.DataJumpScoreMin,
|
|
542
|
+
DataJumpScoreMax: data_jump_stats_1.DataJumpScoreMax,
|
|
543
|
+
DataJumpScoreAvg: data_jump_stats_1.DataJumpScoreAvg,
|
|
544
|
+
DataJumpHeightMin: data_jump_stats_1.DataJumpHeightMin,
|
|
545
|
+
DataJumpHeightMax: data_jump_stats_1.DataJumpHeightMax,
|
|
546
|
+
DataJumpHeightAvg: data_jump_stats_1.DataJumpHeightAvg
|
|
528
547
|
};
|
|
529
548
|
class DynamicDataLoader {
|
|
530
549
|
static getDataInstanceFromDataType(dataType, opts) {
|
|
@@ -167,6 +167,7 @@ const data_age_1 = require("../../../../data/data.age");
|
|
|
167
167
|
const data_gender_1 = require("../../../../data/data.gender");
|
|
168
168
|
const data_avg_grit_1 = require("../../../../data/data.avg-grit");
|
|
169
169
|
const data_jump_event_1 = require("../../../../data/data.jump-event");
|
|
170
|
+
const data_jump_stats_1 = require("../../../../data/data.jump-stats");
|
|
170
171
|
// Threshold to detect that session.timestamp are not trustable (when exceeding 15% of session.total_elapsed_time)
|
|
171
172
|
const INVALID_DATES_ELAPSED_TIME_RATIO_THRESHOLD = 1.15;
|
|
172
173
|
class EventImporterFIT {
|
|
@@ -184,7 +185,7 @@ class EventImporterFIT {
|
|
|
184
185
|
mode: 'both'
|
|
185
186
|
});
|
|
186
187
|
fitFileParser.parse(arrayBuffer, (error, fitDataObject) => {
|
|
187
|
-
var _a;
|
|
188
|
+
var _a, _b;
|
|
188
189
|
if (error) {
|
|
189
190
|
// For now, assume any error from parser on this file means it's broken/empty in a way we treat as EmptyEventLibError
|
|
190
191
|
// to satisfy existing tests. Or ideally we wrap in a generic EventLibError.
|
|
@@ -217,6 +218,17 @@ class EventImporterFIT {
|
|
|
217
218
|
});
|
|
218
219
|
});
|
|
219
220
|
}
|
|
221
|
+
// Check for jumps data at the top level
|
|
222
|
+
if (fitDataObject.jumps && fitDataObject.jumps.length > 0) {
|
|
223
|
+
(_b = fitDataObject.sessions) === null || _b === void 0 ? void 0 : _b.forEach((session) => {
|
|
224
|
+
const sessionStartTime = new Date(session.start_time).getTime();
|
|
225
|
+
const sessionEndTime = sessionStartTime + (session.total_elapsed_time || 0) * 1000;
|
|
226
|
+
session.jumps = fitDataObject.jumps.filter((jump) => {
|
|
227
|
+
const jumpTime = new Date(jump.timestamp).getTime();
|
|
228
|
+
return jumpTime >= sessionStartTime && jumpTime < sessionEndTime;
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
}
|
|
220
232
|
// Iterate over the sessions and create their activities
|
|
221
233
|
const activities = fitDataObject.sessions.map((sessionObject) => {
|
|
222
234
|
// Get the activity from the sessionObject
|
|
@@ -351,7 +363,12 @@ class EventImporterFIT {
|
|
|
351
363
|
activity.addEvent(new data_jump_event_1.DataJumpEvent(activity.getDateIndex(jump.timestamp), {
|
|
352
364
|
distance: jump.distance,
|
|
353
365
|
height: jump.height,
|
|
354
|
-
score: jump.score
|
|
366
|
+
score: jump.score,
|
|
367
|
+
hang_time: jump.hang_time,
|
|
368
|
+
position_lat: jump.position_lat,
|
|
369
|
+
position_long: jump.position_long,
|
|
370
|
+
speed: jump.speed,
|
|
371
|
+
rotations: jump.rotations
|
|
355
372
|
}));
|
|
356
373
|
});
|
|
357
374
|
}
|
|
@@ -626,13 +643,6 @@ class EventImporterFIT {
|
|
|
626
643
|
const activity = new activity_1.Activity(startDate, endDate, this.getActivityTypeFromSessionObject(sessionObject), this.getCreatorFromFitDataObject(fitDataObject), options);
|
|
627
644
|
// Set the activity stats
|
|
628
645
|
this.getStatsFromObject(sessionObject, activity, false).forEach(stat => activity.addStat(stat));
|
|
629
|
-
// Check for VO2 Max in jumps
|
|
630
|
-
if (fitDataObject.jumps && fitDataObject.jumps.length) {
|
|
631
|
-
const jumpWithMets = fitDataObject.jumps.find((j) => j.enhanced_mets);
|
|
632
|
-
if (jumpWithMets) {
|
|
633
|
-
activity.addStat(new data_vo2_max_1.DataVO2Max(jumpWithMets.enhanced_mets * 3.5));
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
646
|
// Check for User Profile
|
|
637
647
|
if (fitDataObject.user_profile) {
|
|
638
648
|
const userProfile = fitDataObject.user_profile;
|
|
@@ -1085,6 +1095,94 @@ class EventImporterFIT {
|
|
|
1085
1095
|
if ((0, helpers_1.isNumberOrString)(object.avg_vam)) {
|
|
1086
1096
|
stats.push(new data_avg_vam_1.DataAvgVAM(object.avg_vam));
|
|
1087
1097
|
}
|
|
1098
|
+
// Jump Statistics
|
|
1099
|
+
if (object.jumps && object.jumps.length > 0) {
|
|
1100
|
+
const jumps = object.jumps;
|
|
1101
|
+
let count = 0;
|
|
1102
|
+
let hangTimeSum = 0, hangTimeMin = Number.MAX_VALUE, hangTimeMax = -Number.MAX_VALUE;
|
|
1103
|
+
let distanceSum = 0, distanceMin = Number.MAX_VALUE, distanceMax = -Number.MAX_VALUE;
|
|
1104
|
+
let speedSum = 0, speedMin = Number.MAX_VALUE, speedMax = -Number.MAX_VALUE;
|
|
1105
|
+
let rotationsSum = 0, rotationsMin = Number.MAX_VALUE, rotationsMax = -Number.MAX_VALUE;
|
|
1106
|
+
let scoreSum = 0, scoreMin = Number.MAX_VALUE, scoreMax = -Number.MAX_VALUE;
|
|
1107
|
+
let heightSum = 0, heightMin = Number.MAX_VALUE, heightMax = -Number.MAX_VALUE;
|
|
1108
|
+
jumps.forEach((j) => {
|
|
1109
|
+
count++;
|
|
1110
|
+
// Hangtime
|
|
1111
|
+
if (Number.isFinite(j.hang_time)) {
|
|
1112
|
+
hangTimeSum += j.hang_time;
|
|
1113
|
+
hangTimeMin = Math.min(hangTimeMin, j.hang_time);
|
|
1114
|
+
hangTimeMax = Math.max(hangTimeMax, j.hang_time);
|
|
1115
|
+
}
|
|
1116
|
+
// Distance
|
|
1117
|
+
if (Number.isFinite(j.distance)) {
|
|
1118
|
+
distanceSum += j.distance;
|
|
1119
|
+
distanceMin = Math.min(distanceMin, j.distance);
|
|
1120
|
+
distanceMax = Math.max(distanceMax, j.distance);
|
|
1121
|
+
}
|
|
1122
|
+
// Speed
|
|
1123
|
+
if (Number.isFinite(j.speed)) {
|
|
1124
|
+
speedSum += j.speed;
|
|
1125
|
+
speedMin = Math.min(speedMin, j.speed);
|
|
1126
|
+
speedMax = Math.max(speedMax, j.speed);
|
|
1127
|
+
}
|
|
1128
|
+
// Rotations
|
|
1129
|
+
if (Number.isFinite(j.rotations)) {
|
|
1130
|
+
rotationsSum += j.rotations;
|
|
1131
|
+
rotationsMin = Math.min(rotationsMin, j.rotations);
|
|
1132
|
+
rotationsMax = Math.max(rotationsMax, j.rotations);
|
|
1133
|
+
}
|
|
1134
|
+
// Score
|
|
1135
|
+
if (Number.isFinite(j.score)) {
|
|
1136
|
+
scoreSum += j.score;
|
|
1137
|
+
scoreMin = Math.min(scoreMin, j.score);
|
|
1138
|
+
scoreMax = Math.max(scoreMax, j.score);
|
|
1139
|
+
}
|
|
1140
|
+
// Height
|
|
1141
|
+
if (Number.isFinite(j.height)) {
|
|
1142
|
+
heightSum += j.height;
|
|
1143
|
+
heightMin = Math.min(heightMin, j.height);
|
|
1144
|
+
heightMax = Math.max(heightMax, j.height);
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
if (count > 0) {
|
|
1148
|
+
if (hangTimeMin !== Number.MAX_VALUE)
|
|
1149
|
+
stats.push(new data_jump_stats_1.DataJumpHangTimeMin(hangTimeMin));
|
|
1150
|
+
if (hangTimeMax !== -Number.MAX_VALUE)
|
|
1151
|
+
stats.push(new data_jump_stats_1.DataJumpHangTimeMax(hangTimeMax));
|
|
1152
|
+
if (hangTimeSum > 0)
|
|
1153
|
+
stats.push(new data_jump_stats_1.DataJumpHangTimeAvg(hangTimeSum / count)); // Assuming count is correct divisor for existing values
|
|
1154
|
+
if (distanceMin !== Number.MAX_VALUE)
|
|
1155
|
+
stats.push(new data_jump_stats_1.DataJumpDistanceMin(distanceMin));
|
|
1156
|
+
if (distanceMax !== -Number.MAX_VALUE)
|
|
1157
|
+
stats.push(new data_jump_stats_1.DataJumpDistanceMax(distanceMax));
|
|
1158
|
+
if (distanceSum > 0)
|
|
1159
|
+
stats.push(new data_jump_stats_1.DataJumpDistanceAvg(distanceSum / count));
|
|
1160
|
+
if (speedMin !== Number.MAX_VALUE)
|
|
1161
|
+
stats.push(new data_jump_stats_1.DataJumpSpeedMin(speedMin));
|
|
1162
|
+
if (speedMax !== -Number.MAX_VALUE)
|
|
1163
|
+
stats.push(new data_jump_stats_1.DataJumpSpeedMax(speedMax));
|
|
1164
|
+
if (speedSum > 0)
|
|
1165
|
+
stats.push(new data_jump_stats_1.DataJumpSpeedAvg(speedSum / count));
|
|
1166
|
+
if (rotationsMin !== Number.MAX_VALUE)
|
|
1167
|
+
stats.push(new data_jump_stats_1.DataJumpRotationsMin(rotationsMin));
|
|
1168
|
+
if (rotationsMax !== -Number.MAX_VALUE)
|
|
1169
|
+
stats.push(new data_jump_stats_1.DataJumpRotationsMax(rotationsMax));
|
|
1170
|
+
if (rotationsSum > 0)
|
|
1171
|
+
stats.push(new data_jump_stats_1.DataJumpRotationsAvg(rotationsSum / count));
|
|
1172
|
+
if (scoreMin !== Number.MAX_VALUE)
|
|
1173
|
+
stats.push(new data_jump_stats_1.DataJumpScoreMin(scoreMin));
|
|
1174
|
+
if (scoreMax !== -Number.MAX_VALUE)
|
|
1175
|
+
stats.push(new data_jump_stats_1.DataJumpScoreMax(scoreMax));
|
|
1176
|
+
if (scoreSum > 0)
|
|
1177
|
+
stats.push(new data_jump_stats_1.DataJumpScoreAvg(scoreSum / count));
|
|
1178
|
+
if (heightMin !== Number.MAX_VALUE)
|
|
1179
|
+
stats.push(new data_jump_stats_1.DataJumpHeightMin(heightMin));
|
|
1180
|
+
if (heightMax !== -Number.MAX_VALUE)
|
|
1181
|
+
stats.push(new data_jump_stats_1.DataJumpHeightMax(heightMax));
|
|
1182
|
+
if (heightSum > 0)
|
|
1183
|
+
stats.push(new data_jump_stats_1.DataJumpHeightAvg(heightSum / count));
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1088
1186
|
return stats;
|
|
1089
1187
|
}
|
|
1090
1188
|
static getCreatorFromFitDataObject(fitDataObject) {
|
|
@@ -47,7 +47,6 @@ const path = __importStar(require("path"));
|
|
|
47
47
|
const importer_fit_1 = require("./importer.fit");
|
|
48
48
|
const data_aerobic_training_effect_1 = require("../../../../data/data-aerobic-training-effect");
|
|
49
49
|
const data_anaerobic_training_effect_1 = require("../../../../data/data-anaerobic-training-effect");
|
|
50
|
-
const data_vo2_max_1 = require("../../../../data/data.vo2-max");
|
|
51
50
|
const data_recovery_time_1 = require("../../../../data/data.recovery-time");
|
|
52
51
|
const data_avg_respiration_rate_1 = require("../../../../data/data.avg-respiration-rate");
|
|
53
52
|
const data_heart_rate_zone_five_duration_1 = require("../../../../data/data.heart-rate-zone-five-duration");
|
|
@@ -146,10 +145,6 @@ describe('EventImporterFIT MTB Jumps', () => {
|
|
|
146
145
|
const anaerobic = activity.getStat(data_anaerobic_training_effect_1.DataAnaerobicTrainingEffect.type);
|
|
147
146
|
expect(anaerobic).toBeDefined();
|
|
148
147
|
expect(anaerobic.getValue()).toBe(2);
|
|
149
|
-
// VO2 Max
|
|
150
|
-
const vo2Max = activity.getStat(data_vo2_max_1.DataVO2Max.type);
|
|
151
|
-
expect(vo2Max).toBeDefined();
|
|
152
|
-
expect(vo2Max.getValue()).toBeCloseTo(57.0633, 4);
|
|
153
148
|
expect(activity.getStat(data_temperature_max_1.DataTemperatureMax.type).getValue()).toBe(19);
|
|
154
149
|
expect(activity.getStat(data_temperature_min_1.DataTemperatureMin.type).getValue()).toBe(7);
|
|
155
150
|
// Positions
|
|
@@ -200,13 +195,46 @@ describe('EventImporterFIT MTB Jumps', () => {
|
|
|
200
195
|
// Check Jumps
|
|
201
196
|
const jumpEvents = activity.getAllEvents().filter((e) => e.getType() === data_jump_event_1.DataJumpEvent.type);
|
|
202
197
|
expect(jumpEvents.length).toBeGreaterThan(0);
|
|
198
|
+
expect(jumpEvents.length).toBe(11);
|
|
203
199
|
const jump = jumpEvents[0];
|
|
204
200
|
expect(jump.jumpData).toBeDefined();
|
|
205
201
|
expect((0, helpers_1.isNumber)(jump.jumpData.distance)).toBeTruthy();
|
|
206
|
-
expect((0, helpers_1.isNumber)(jump.jumpData.height)).toBeTruthy();
|
|
207
202
|
expect((0, helpers_1.isNumber)(jump.jumpData.score)).toBeTruthy();
|
|
203
|
+
// Verify new jump fields with expected values
|
|
204
|
+
expect(jump.jumpData.distance).toBeCloseTo(2.069, 2);
|
|
205
|
+
expect(jump.jumpData.hang_time).toBeCloseTo(0.36, 2);
|
|
206
|
+
expect(jump.jumpData.score).toBeCloseTo(62.44, 1);
|
|
207
|
+
expect(jump.jumpData.position_lat).toBeCloseTo(39.6679, 3);
|
|
208
|
+
expect(jump.jumpData.position_long).toBeCloseTo(20.8382, 3);
|
|
209
|
+
expect(jump.jumpData.speed).toBeCloseTo(5.748, 2);
|
|
208
210
|
console.log(`Found ${jumpEvents.length} jumps.`);
|
|
209
211
|
console.log('First jump:', jump.jumpData);
|
|
212
|
+
// Verify Jump Statistics (Min, Max, Avg)
|
|
213
|
+
const { DataJumpDistanceAvg, DataJumpDistanceMax, DataJumpDistanceMin, DataJumpHangTimeAvg, DataJumpHangTimeMax, DataJumpHangTimeMin, DataJumpHeightAvg, DataJumpHeightMax, DataJumpHeightMin, DataJumpRotationsAvg, DataJumpRotationsMax, DataJumpRotationsMin, DataJumpScoreAvg, DataJumpScoreMax, DataJumpScoreMin, DataJumpSpeedAvg, DataJumpSpeedMax, DataJumpSpeedMin } = yield Promise.resolve().then(() => __importStar(require('../../../../data/data.jump-stats')));
|
|
214
|
+
// Hangtime
|
|
215
|
+
expect(activity.getStat(DataJumpHangTimeMin.type).getValue()).toBeCloseTo(0.36, 2);
|
|
216
|
+
expect(activity.getStat(DataJumpHangTimeMax.type).getValue()).toBeCloseTo(0.696, 3);
|
|
217
|
+
expect(activity.getStat(DataJumpHangTimeAvg.type).getValue()).toBeCloseTo(0.45, 2);
|
|
218
|
+
// Distance
|
|
219
|
+
expect(activity.getStat(DataJumpDistanceMin.type).getValue()).toBeCloseTo(1.40, 2);
|
|
220
|
+
expect(activity.getStat(DataJumpDistanceMax.type).getValue()).toBeCloseTo(4.68, 2);
|
|
221
|
+
expect(activity.getStat(DataJumpDistanceAvg.type).getValue()).toBeCloseTo(3.02, 2);
|
|
222
|
+
// Speed
|
|
223
|
+
expect(activity.getStat(DataJumpSpeedMin.type).getValue()).toBeCloseTo(3.88, 2);
|
|
224
|
+
expect(activity.getStat(DataJumpSpeedMax.type).getValue()).toBeCloseTo(8.995, 3);
|
|
225
|
+
expect(activity.getStat(DataJumpSpeedAvg.type).getValue()).toBeCloseTo(6.55, 2);
|
|
226
|
+
// Score
|
|
227
|
+
expect(activity.getStat(DataJumpScoreMin.type).getValue()).toBeCloseTo(53.9, 1);
|
|
228
|
+
expect(activity.getStat(DataJumpScoreMax.type).getValue()).toBeCloseTo(122.6, 1);
|
|
229
|
+
expect(activity.getStat(DataJumpScoreAvg.type).getValue()).toBeCloseTo(81.8, 1);
|
|
230
|
+
// Rotations (Should be undefined for this file)
|
|
231
|
+
expect(activity.getStat(DataJumpRotationsMin.type)).toBeUndefined();
|
|
232
|
+
expect(activity.getStat(DataJumpRotationsMax.type)).toBeUndefined();
|
|
233
|
+
expect(activity.getStat(DataJumpRotationsAvg.type)).toBeUndefined();
|
|
234
|
+
// Height (Should be undefined for this file)
|
|
235
|
+
expect(activity.getStat(DataJumpHeightMin.type)).toBeUndefined();
|
|
236
|
+
expect(activity.getStat(DataJumpHeightMax.type)).toBeUndefined();
|
|
237
|
+
expect(activity.getStat(DataJumpHeightAvg.type)).toBeUndefined();
|
|
210
238
|
// We can check if we can find a sample with Grit.
|
|
211
239
|
// In sports-lib, samples are often accessed via activity.getStream(type) or similar, BUT
|
|
212
240
|
// importer creates `DataPoint`s? Or `DataSample`s?
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { DataEvent } from './data.event';
|
|
2
2
|
export interface JumpEventInterface {
|
|
3
3
|
distance: number;
|
|
4
|
-
height
|
|
4
|
+
height?: number;
|
|
5
5
|
score: number;
|
|
6
|
+
hang_time?: number;
|
|
7
|
+
position_lat?: number;
|
|
8
|
+
position_long?: number;
|
|
9
|
+
speed?: number;
|
|
10
|
+
rotations?: number;
|
|
6
11
|
}
|
|
7
12
|
export declare class DataJumpEvent extends DataEvent {
|
|
8
13
|
jumpData: JumpEventInterface;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { DataNumber } from './data.number';
|
|
2
|
+
export declare class DataJumpHangTimeMin extends DataNumber {
|
|
3
|
+
static type: string;
|
|
4
|
+
static unit: string;
|
|
5
|
+
constructor(value: number);
|
|
6
|
+
}
|
|
7
|
+
export declare class DataJumpHangTimeMax extends DataNumber {
|
|
8
|
+
static type: string;
|
|
9
|
+
static unit: string;
|
|
10
|
+
constructor(value: number);
|
|
11
|
+
}
|
|
12
|
+
export declare class DataJumpHangTimeAvg extends DataNumber {
|
|
13
|
+
static type: string;
|
|
14
|
+
static unit: string;
|
|
15
|
+
constructor(value: number);
|
|
16
|
+
}
|
|
17
|
+
export declare class DataJumpDistanceMin extends DataNumber {
|
|
18
|
+
static type: string;
|
|
19
|
+
static unit: string;
|
|
20
|
+
constructor(value: number);
|
|
21
|
+
}
|
|
22
|
+
export declare class DataJumpDistanceMax extends DataNumber {
|
|
23
|
+
static type: string;
|
|
24
|
+
static unit: string;
|
|
25
|
+
constructor(value: number);
|
|
26
|
+
}
|
|
27
|
+
export declare class DataJumpDistanceAvg extends DataNumber {
|
|
28
|
+
static type: string;
|
|
29
|
+
static unit: string;
|
|
30
|
+
constructor(value: number);
|
|
31
|
+
}
|
|
32
|
+
export declare class DataJumpSpeedMin extends DataNumber {
|
|
33
|
+
static type: string;
|
|
34
|
+
static unit: string;
|
|
35
|
+
constructor(value: number);
|
|
36
|
+
}
|
|
37
|
+
export declare class DataJumpSpeedMax extends DataNumber {
|
|
38
|
+
static type: string;
|
|
39
|
+
static unit: string;
|
|
40
|
+
constructor(value: number);
|
|
41
|
+
}
|
|
42
|
+
export declare class DataJumpSpeedAvg extends DataNumber {
|
|
43
|
+
static type: string;
|
|
44
|
+
static unit: string;
|
|
45
|
+
constructor(value: number);
|
|
46
|
+
}
|
|
47
|
+
export declare class DataJumpRotationsMin extends DataNumber {
|
|
48
|
+
static type: string;
|
|
49
|
+
static unit: string;
|
|
50
|
+
constructor(value: number);
|
|
51
|
+
}
|
|
52
|
+
export declare class DataJumpRotationsMax extends DataNumber {
|
|
53
|
+
static type: string;
|
|
54
|
+
static unit: string;
|
|
55
|
+
constructor(value: number);
|
|
56
|
+
}
|
|
57
|
+
export declare class DataJumpRotationsAvg extends DataNumber {
|
|
58
|
+
static type: string;
|
|
59
|
+
static unit: string;
|
|
60
|
+
constructor(value: number);
|
|
61
|
+
}
|
|
62
|
+
export declare class DataJumpScoreMin extends DataNumber {
|
|
63
|
+
static type: string;
|
|
64
|
+
static unit: string;
|
|
65
|
+
constructor(value: number);
|
|
66
|
+
}
|
|
67
|
+
export declare class DataJumpScoreMax extends DataNumber {
|
|
68
|
+
static type: string;
|
|
69
|
+
static unit: string;
|
|
70
|
+
constructor(value: number);
|
|
71
|
+
}
|
|
72
|
+
export declare class DataJumpScoreAvg extends DataNumber {
|
|
73
|
+
static type: string;
|
|
74
|
+
static unit: string;
|
|
75
|
+
constructor(value: number);
|
|
76
|
+
}
|
|
77
|
+
export declare class DataJumpHeightMin extends DataNumber {
|
|
78
|
+
static type: string;
|
|
79
|
+
static unit: string;
|
|
80
|
+
constructor(value: number);
|
|
81
|
+
}
|
|
82
|
+
export declare class DataJumpHeightMax extends DataNumber {
|
|
83
|
+
static type: string;
|
|
84
|
+
static unit: string;
|
|
85
|
+
constructor(value: number);
|
|
86
|
+
}
|
|
87
|
+
export declare class DataJumpHeightAvg extends DataNumber {
|
|
88
|
+
static type: string;
|
|
89
|
+
static unit: string;
|
|
90
|
+
constructor(value: number);
|
|
91
|
+
}
|
package/lib/esm/index.js
CHANGED
|
@@ -4142,6 +4142,206 @@ var DataDepthMax = class extends DataNumber {
|
|
|
4142
4142
|
}
|
|
4143
4143
|
};
|
|
4144
4144
|
|
|
4145
|
+
// src/data/data.jump-stats.ts
|
|
4146
|
+
var DataJumpHangTimeMin = class extends DataNumber {
|
|
4147
|
+
static {
|
|
4148
|
+
this.type = "Jump Hang Time Min";
|
|
4149
|
+
}
|
|
4150
|
+
static {
|
|
4151
|
+
this.unit = "s";
|
|
4152
|
+
}
|
|
4153
|
+
constructor(value) {
|
|
4154
|
+
super(value);
|
|
4155
|
+
}
|
|
4156
|
+
};
|
|
4157
|
+
var DataJumpHangTimeMax = class extends DataNumber {
|
|
4158
|
+
static {
|
|
4159
|
+
this.type = "Jump Hang Time Max";
|
|
4160
|
+
}
|
|
4161
|
+
static {
|
|
4162
|
+
this.unit = "s";
|
|
4163
|
+
}
|
|
4164
|
+
constructor(value) {
|
|
4165
|
+
super(value);
|
|
4166
|
+
}
|
|
4167
|
+
};
|
|
4168
|
+
var DataJumpHangTimeAvg = class extends DataNumber {
|
|
4169
|
+
static {
|
|
4170
|
+
this.type = "Jump Hang Time Avg";
|
|
4171
|
+
}
|
|
4172
|
+
static {
|
|
4173
|
+
this.unit = "s";
|
|
4174
|
+
}
|
|
4175
|
+
constructor(value) {
|
|
4176
|
+
super(value);
|
|
4177
|
+
}
|
|
4178
|
+
};
|
|
4179
|
+
var DataJumpDistanceMin = class extends DataNumber {
|
|
4180
|
+
static {
|
|
4181
|
+
this.type = "Jump Distance Min";
|
|
4182
|
+
}
|
|
4183
|
+
static {
|
|
4184
|
+
this.unit = "m";
|
|
4185
|
+
}
|
|
4186
|
+
constructor(value) {
|
|
4187
|
+
super(value);
|
|
4188
|
+
}
|
|
4189
|
+
};
|
|
4190
|
+
var DataJumpDistanceMax = class extends DataNumber {
|
|
4191
|
+
static {
|
|
4192
|
+
this.type = "Jump Distance Max";
|
|
4193
|
+
}
|
|
4194
|
+
static {
|
|
4195
|
+
this.unit = "m";
|
|
4196
|
+
}
|
|
4197
|
+
constructor(value) {
|
|
4198
|
+
super(value);
|
|
4199
|
+
}
|
|
4200
|
+
};
|
|
4201
|
+
var DataJumpDistanceAvg = class extends DataNumber {
|
|
4202
|
+
static {
|
|
4203
|
+
this.type = "Jump Distance Avg";
|
|
4204
|
+
}
|
|
4205
|
+
static {
|
|
4206
|
+
this.unit = "m";
|
|
4207
|
+
}
|
|
4208
|
+
constructor(value) {
|
|
4209
|
+
super(value);
|
|
4210
|
+
}
|
|
4211
|
+
};
|
|
4212
|
+
var DataJumpSpeedMin = class extends DataNumber {
|
|
4213
|
+
static {
|
|
4214
|
+
this.type = "Jump Speed Min";
|
|
4215
|
+
}
|
|
4216
|
+
static {
|
|
4217
|
+
this.unit = "m/s";
|
|
4218
|
+
}
|
|
4219
|
+
constructor(value) {
|
|
4220
|
+
super(value);
|
|
4221
|
+
}
|
|
4222
|
+
};
|
|
4223
|
+
var DataJumpSpeedMax = class extends DataNumber {
|
|
4224
|
+
static {
|
|
4225
|
+
this.type = "Jump Speed Max";
|
|
4226
|
+
}
|
|
4227
|
+
static {
|
|
4228
|
+
this.unit = "m/s";
|
|
4229
|
+
}
|
|
4230
|
+
constructor(value) {
|
|
4231
|
+
super(value);
|
|
4232
|
+
}
|
|
4233
|
+
};
|
|
4234
|
+
var DataJumpSpeedAvg = class extends DataNumber {
|
|
4235
|
+
static {
|
|
4236
|
+
this.type = "Jump Speed Avg";
|
|
4237
|
+
}
|
|
4238
|
+
static {
|
|
4239
|
+
this.unit = "m/s";
|
|
4240
|
+
}
|
|
4241
|
+
constructor(value) {
|
|
4242
|
+
super(value);
|
|
4243
|
+
}
|
|
4244
|
+
};
|
|
4245
|
+
var DataJumpRotationsMin = class extends DataNumber {
|
|
4246
|
+
static {
|
|
4247
|
+
this.type = "Jump Rotations Min";
|
|
4248
|
+
}
|
|
4249
|
+
static {
|
|
4250
|
+
this.unit = "";
|
|
4251
|
+
}
|
|
4252
|
+
constructor(value) {
|
|
4253
|
+
super(value);
|
|
4254
|
+
}
|
|
4255
|
+
};
|
|
4256
|
+
var DataJumpRotationsMax = class extends DataNumber {
|
|
4257
|
+
static {
|
|
4258
|
+
this.type = "Jump Rotations Max";
|
|
4259
|
+
}
|
|
4260
|
+
static {
|
|
4261
|
+
this.unit = "";
|
|
4262
|
+
}
|
|
4263
|
+
constructor(value) {
|
|
4264
|
+
super(value);
|
|
4265
|
+
}
|
|
4266
|
+
};
|
|
4267
|
+
var DataJumpRotationsAvg = class extends DataNumber {
|
|
4268
|
+
static {
|
|
4269
|
+
this.type = "Jump Rotations Avg";
|
|
4270
|
+
}
|
|
4271
|
+
static {
|
|
4272
|
+
this.unit = "";
|
|
4273
|
+
}
|
|
4274
|
+
constructor(value) {
|
|
4275
|
+
super(value);
|
|
4276
|
+
}
|
|
4277
|
+
};
|
|
4278
|
+
var DataJumpScoreMin = class extends DataNumber {
|
|
4279
|
+
static {
|
|
4280
|
+
this.type = "Jump Score Min";
|
|
4281
|
+
}
|
|
4282
|
+
static {
|
|
4283
|
+
this.unit = "";
|
|
4284
|
+
}
|
|
4285
|
+
constructor(value) {
|
|
4286
|
+
super(value);
|
|
4287
|
+
}
|
|
4288
|
+
};
|
|
4289
|
+
var DataJumpScoreMax = class extends DataNumber {
|
|
4290
|
+
static {
|
|
4291
|
+
this.type = "Jump Score Max";
|
|
4292
|
+
}
|
|
4293
|
+
static {
|
|
4294
|
+
this.unit = "";
|
|
4295
|
+
}
|
|
4296
|
+
constructor(value) {
|
|
4297
|
+
super(value);
|
|
4298
|
+
}
|
|
4299
|
+
};
|
|
4300
|
+
var DataJumpScoreAvg = class extends DataNumber {
|
|
4301
|
+
static {
|
|
4302
|
+
this.type = "Jump Score Avg";
|
|
4303
|
+
}
|
|
4304
|
+
static {
|
|
4305
|
+
this.unit = "";
|
|
4306
|
+
}
|
|
4307
|
+
constructor(value) {
|
|
4308
|
+
super(value);
|
|
4309
|
+
}
|
|
4310
|
+
};
|
|
4311
|
+
var DataJumpHeightMin = class extends DataNumber {
|
|
4312
|
+
static {
|
|
4313
|
+
this.type = "Jump Height Min";
|
|
4314
|
+
}
|
|
4315
|
+
static {
|
|
4316
|
+
this.unit = "m";
|
|
4317
|
+
}
|
|
4318
|
+
constructor(value) {
|
|
4319
|
+
super(value);
|
|
4320
|
+
}
|
|
4321
|
+
};
|
|
4322
|
+
var DataJumpHeightMax = class extends DataNumber {
|
|
4323
|
+
static {
|
|
4324
|
+
this.type = "Jump Height Max";
|
|
4325
|
+
}
|
|
4326
|
+
static {
|
|
4327
|
+
this.unit = "m";
|
|
4328
|
+
}
|
|
4329
|
+
constructor(value) {
|
|
4330
|
+
super(value);
|
|
4331
|
+
}
|
|
4332
|
+
};
|
|
4333
|
+
var DataJumpHeightAvg = class extends DataNumber {
|
|
4334
|
+
static {
|
|
4335
|
+
this.type = "Jump Height Avg";
|
|
4336
|
+
}
|
|
4337
|
+
static {
|
|
4338
|
+
this.unit = "m";
|
|
4339
|
+
}
|
|
4340
|
+
constructor(value) {
|
|
4341
|
+
super(value);
|
|
4342
|
+
}
|
|
4343
|
+
};
|
|
4344
|
+
|
|
4145
4345
|
// src/data/data.store.ts
|
|
4146
4346
|
var DataTotalTrainingEffectLegacy = class extends DataAerobicTrainingEffect {
|
|
4147
4347
|
static {
|
|
@@ -4451,7 +4651,25 @@ var DataStore = {
|
|
|
4451
4651
|
DataFitnessAge,
|
|
4452
4652
|
DataMaxHRSetting,
|
|
4453
4653
|
DataDepth,
|
|
4454
|
-
DataDepthMax
|
|
4654
|
+
DataDepthMax,
|
|
4655
|
+
DataJumpHangTimeMin,
|
|
4656
|
+
DataJumpHangTimeMax,
|
|
4657
|
+
DataJumpHangTimeAvg,
|
|
4658
|
+
DataJumpDistanceMin,
|
|
4659
|
+
DataJumpDistanceMax,
|
|
4660
|
+
DataJumpDistanceAvg,
|
|
4661
|
+
DataJumpSpeedMin,
|
|
4662
|
+
DataJumpSpeedMax,
|
|
4663
|
+
DataJumpSpeedAvg,
|
|
4664
|
+
DataJumpRotationsMin,
|
|
4665
|
+
DataJumpRotationsMax,
|
|
4666
|
+
DataJumpRotationsAvg,
|
|
4667
|
+
DataJumpScoreMin,
|
|
4668
|
+
DataJumpScoreMax,
|
|
4669
|
+
DataJumpScoreAvg,
|
|
4670
|
+
DataJumpHeightMin,
|
|
4671
|
+
DataJumpHeightMax,
|
|
4672
|
+
DataJumpHeightAvg
|
|
4455
4673
|
};
|
|
4456
4674
|
var DynamicDataLoader = class _DynamicDataLoader {
|
|
4457
4675
|
static {
|
|
@@ -10078,6 +10296,16 @@ var EventImporterFIT = class {
|
|
|
10078
10296
|
});
|
|
10079
10297
|
});
|
|
10080
10298
|
}
|
|
10299
|
+
if (fitDataObject.jumps && fitDataObject.jumps.length > 0) {
|
|
10300
|
+
fitDataObject.sessions?.forEach((session) => {
|
|
10301
|
+
const sessionStartTime = new Date(session.start_time).getTime();
|
|
10302
|
+
const sessionEndTime = sessionStartTime + (session.total_elapsed_time || 0) * 1e3;
|
|
10303
|
+
session.jumps = fitDataObject.jumps.filter((jump) => {
|
|
10304
|
+
const jumpTime = new Date(jump.timestamp).getTime();
|
|
10305
|
+
return jumpTime >= sessionStartTime && jumpTime < sessionEndTime;
|
|
10306
|
+
});
|
|
10307
|
+
});
|
|
10308
|
+
}
|
|
10081
10309
|
const activities = fitDataObject.sessions.map((sessionObject) => {
|
|
10082
10310
|
const activity = this.getActivityFromSessionObject(sessionObject, fitDataObject, options);
|
|
10083
10311
|
sessionObject.laps.forEach((sessionLapObject, index) => {
|
|
@@ -10195,7 +10423,12 @@ var EventImporterFIT = class {
|
|
|
10195
10423
|
new DataJumpEvent(activity.getDateIndex(jump.timestamp), {
|
|
10196
10424
|
distance: jump.distance,
|
|
10197
10425
|
height: jump.height,
|
|
10198
|
-
score: jump.score
|
|
10426
|
+
score: jump.score,
|
|
10427
|
+
hang_time: jump.hang_time,
|
|
10428
|
+
position_lat: jump.position_lat,
|
|
10429
|
+
position_long: jump.position_long,
|
|
10430
|
+
speed: jump.speed,
|
|
10431
|
+
rotations: jump.rotations
|
|
10199
10432
|
})
|
|
10200
10433
|
);
|
|
10201
10434
|
});
|
|
@@ -10414,12 +10647,6 @@ var EventImporterFIT = class {
|
|
|
10414
10647
|
options
|
|
10415
10648
|
);
|
|
10416
10649
|
this.getStatsFromObject(sessionObject, activity, false).forEach((stat) => activity.addStat(stat));
|
|
10417
|
-
if (fitDataObject.jumps && fitDataObject.jumps.length) {
|
|
10418
|
-
const jumpWithMets = fitDataObject.jumps.find((j) => j.enhanced_mets);
|
|
10419
|
-
if (jumpWithMets) {
|
|
10420
|
-
activity.addStat(new DataVO2Max(jumpWithMets.enhanced_mets * 3.5));
|
|
10421
|
-
}
|
|
10422
|
-
}
|
|
10423
10650
|
if (fitDataObject.user_profile) {
|
|
10424
10651
|
const userProfile = fitDataObject.user_profile;
|
|
10425
10652
|
if (isNumberOrString(userProfile.weight)) {
|
|
@@ -10801,6 +11028,69 @@ var EventImporterFIT = class {
|
|
|
10801
11028
|
if (isNumberOrString(object.avg_vam)) {
|
|
10802
11029
|
stats.push(new DataAvgVAM(object.avg_vam));
|
|
10803
11030
|
}
|
|
11031
|
+
if (object.jumps && object.jumps.length > 0) {
|
|
11032
|
+
const jumps = object.jumps;
|
|
11033
|
+
let count = 0;
|
|
11034
|
+
let hangTimeSum = 0, hangTimeMin = Number.MAX_VALUE, hangTimeMax = -Number.MAX_VALUE;
|
|
11035
|
+
let distanceSum = 0, distanceMin = Number.MAX_VALUE, distanceMax = -Number.MAX_VALUE;
|
|
11036
|
+
let speedSum = 0, speedMin = Number.MAX_VALUE, speedMax = -Number.MAX_VALUE;
|
|
11037
|
+
let rotationsSum = 0, rotationsMin = Number.MAX_VALUE, rotationsMax = -Number.MAX_VALUE;
|
|
11038
|
+
let scoreSum = 0, scoreMin = Number.MAX_VALUE, scoreMax = -Number.MAX_VALUE;
|
|
11039
|
+
let heightSum = 0, heightMin = Number.MAX_VALUE, heightMax = -Number.MAX_VALUE;
|
|
11040
|
+
jumps.forEach((j) => {
|
|
11041
|
+
count++;
|
|
11042
|
+
if (Number.isFinite(j.hang_time)) {
|
|
11043
|
+
hangTimeSum += j.hang_time;
|
|
11044
|
+
hangTimeMin = Math.min(hangTimeMin, j.hang_time);
|
|
11045
|
+
hangTimeMax = Math.max(hangTimeMax, j.hang_time);
|
|
11046
|
+
}
|
|
11047
|
+
if (Number.isFinite(j.distance)) {
|
|
11048
|
+
distanceSum += j.distance;
|
|
11049
|
+
distanceMin = Math.min(distanceMin, j.distance);
|
|
11050
|
+
distanceMax = Math.max(distanceMax, j.distance);
|
|
11051
|
+
}
|
|
11052
|
+
if (Number.isFinite(j.speed)) {
|
|
11053
|
+
speedSum += j.speed;
|
|
11054
|
+
speedMin = Math.min(speedMin, j.speed);
|
|
11055
|
+
speedMax = Math.max(speedMax, j.speed);
|
|
11056
|
+
}
|
|
11057
|
+
if (Number.isFinite(j.rotations)) {
|
|
11058
|
+
rotationsSum += j.rotations;
|
|
11059
|
+
rotationsMin = Math.min(rotationsMin, j.rotations);
|
|
11060
|
+
rotationsMax = Math.max(rotationsMax, j.rotations);
|
|
11061
|
+
}
|
|
11062
|
+
if (Number.isFinite(j.score)) {
|
|
11063
|
+
scoreSum += j.score;
|
|
11064
|
+
scoreMin = Math.min(scoreMin, j.score);
|
|
11065
|
+
scoreMax = Math.max(scoreMax, j.score);
|
|
11066
|
+
}
|
|
11067
|
+
if (Number.isFinite(j.height)) {
|
|
11068
|
+
heightSum += j.height;
|
|
11069
|
+
heightMin = Math.min(heightMin, j.height);
|
|
11070
|
+
heightMax = Math.max(heightMax, j.height);
|
|
11071
|
+
}
|
|
11072
|
+
});
|
|
11073
|
+
if (count > 0) {
|
|
11074
|
+
if (hangTimeMin !== Number.MAX_VALUE) stats.push(new DataJumpHangTimeMin(hangTimeMin));
|
|
11075
|
+
if (hangTimeMax !== -Number.MAX_VALUE) stats.push(new DataJumpHangTimeMax(hangTimeMax));
|
|
11076
|
+
if (hangTimeSum > 0) stats.push(new DataJumpHangTimeAvg(hangTimeSum / count));
|
|
11077
|
+
if (distanceMin !== Number.MAX_VALUE) stats.push(new DataJumpDistanceMin(distanceMin));
|
|
11078
|
+
if (distanceMax !== -Number.MAX_VALUE) stats.push(new DataJumpDistanceMax(distanceMax));
|
|
11079
|
+
if (distanceSum > 0) stats.push(new DataJumpDistanceAvg(distanceSum / count));
|
|
11080
|
+
if (speedMin !== Number.MAX_VALUE) stats.push(new DataJumpSpeedMin(speedMin));
|
|
11081
|
+
if (speedMax !== -Number.MAX_VALUE) stats.push(new DataJumpSpeedMax(speedMax));
|
|
11082
|
+
if (speedSum > 0) stats.push(new DataJumpSpeedAvg(speedSum / count));
|
|
11083
|
+
if (rotationsMin !== Number.MAX_VALUE) stats.push(new DataJumpRotationsMin(rotationsMin));
|
|
11084
|
+
if (rotationsMax !== -Number.MAX_VALUE) stats.push(new DataJumpRotationsMax(rotationsMax));
|
|
11085
|
+
if (rotationsSum > 0) stats.push(new DataJumpRotationsAvg(rotationsSum / count));
|
|
11086
|
+
if (scoreMin !== Number.MAX_VALUE) stats.push(new DataJumpScoreMin(scoreMin));
|
|
11087
|
+
if (scoreMax !== -Number.MAX_VALUE) stats.push(new DataJumpScoreMax(scoreMax));
|
|
11088
|
+
if (scoreSum > 0) stats.push(new DataJumpScoreAvg(scoreSum / count));
|
|
11089
|
+
if (heightMin !== Number.MAX_VALUE) stats.push(new DataJumpHeightMin(heightMin));
|
|
11090
|
+
if (heightMax !== -Number.MAX_VALUE) stats.push(new DataJumpHeightMax(heightMax));
|
|
11091
|
+
if (heightSum > 0) stats.push(new DataJumpHeightAvg(heightSum / count));
|
|
11092
|
+
}
|
|
11093
|
+
}
|
|
10804
11094
|
return stats;
|
|
10805
11095
|
}
|
|
10806
11096
|
static getCreatorFromFitDataObject(fitDataObject) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sports-alliance/sports-lib",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.3",
|
|
4
4
|
"description": "A Library to for importing / exporting and processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gpx",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"fast-xml-parser": "^5.3.3",
|
|
57
|
-
"fit-file-parser": "2.2.
|
|
57
|
+
"fit-file-parser": "2.2.5",
|
|
58
58
|
"geolib": "^3.3.4",
|
|
59
59
|
"gpx-builder": "^3.7.8",
|
|
60
60
|
"kalmanjs": "^1.1.0",
|