@tellescope/sdk 1.89.0 → 1.90.0
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/lib/cjs/sdk.d.ts +1 -0
- package/lib/cjs/sdk.d.ts.map +1 -1
- package/lib/cjs/sdk.js +1 -0
- package/lib/cjs/sdk.js.map +1 -1
- package/lib/cjs/tests/tests.js +382 -31
- package/lib/cjs/tests/tests.js.map +1 -1
- package/lib/esm/sdk.d.ts +1 -0
- package/lib/esm/sdk.d.ts.map +1 -1
- package/lib/esm/sdk.js +1 -0
- package/lib/esm/sdk.js.map +1 -1
- package/lib/esm/tests/tests.js +382 -31
- package/lib/esm/tests/tests.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/sdk.ts +4 -0
- package/src/tests/tests.ts +316 -3
- package/test_generated.pdf +0 -0
package/src/tests/tests.ts
CHANGED
|
@@ -7234,13 +7234,13 @@ const vital_trigger_tests = async () => {
|
|
|
7234
7234
|
vitals,
|
|
7235
7235
|
title,
|
|
7236
7236
|
} : {
|
|
7237
|
-
configurations: Pick<VitalConfiguration, 'unit' | 'ranges'>[]
|
|
7237
|
+
configurations: Pick<VitalConfiguration, 'mealStatus' | 'unit' | 'ranges'>[]
|
|
7238
7238
|
triggers: { configurationIndexes: number[], classifications: string[] }[],
|
|
7239
|
-
vitals: (Pick<EnduserObservation, 'measurement'> & Pick<Partial<EnduserObservation>, | 'timestamp'>)[],
|
|
7239
|
+
vitals: (Pick<EnduserObservation, 'measurement'> & Pick<Partial<EnduserObservation>, | 'timestamp' | 'beforeMeal'>)[],
|
|
7240
7240
|
shouldTrigger: boolean,
|
|
7241
7241
|
title: string,
|
|
7242
7242
|
}) => {
|
|
7243
|
-
const e = await sdk.api.endusers.createOne({ })
|
|
7243
|
+
const e = await sdk.api.endusers.createOne({ weight: { unit: 'LB', value: 180 } })
|
|
7244
7244
|
const configurations = (
|
|
7245
7245
|
await sdk.api.vital_configurations.createSome(_configurations.map((c, i) => ({
|
|
7246
7246
|
title: `configuration ${i}`,
|
|
@@ -7292,6 +7292,293 @@ const vital_trigger_tests = async () => {
|
|
|
7292
7292
|
])
|
|
7293
7293
|
}
|
|
7294
7294
|
|
|
7295
|
+
await runTriggerTest({
|
|
7296
|
+
title: "Any Meal Passing (Unset)",
|
|
7297
|
+
shouldTrigger: true,
|
|
7298
|
+
configurations: [{
|
|
7299
|
+
unit: 'mg/dL',
|
|
7300
|
+
// no meal status
|
|
7301
|
+
// mealStatus: 'Before',
|
|
7302
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7303
|
+
}],
|
|
7304
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7305
|
+
vitals: [{
|
|
7306
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7307
|
+
timestamp: new Date(),
|
|
7308
|
+
}]
|
|
7309
|
+
})
|
|
7310
|
+
await runTriggerTest({
|
|
7311
|
+
title: "Any Meal Passing (Unset) [Before]",
|
|
7312
|
+
shouldTrigger: true,
|
|
7313
|
+
configurations: [{
|
|
7314
|
+
unit: 'mg/dL',
|
|
7315
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7316
|
+
}],
|
|
7317
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7318
|
+
vitals: [{
|
|
7319
|
+
beforeMeal: true,
|
|
7320
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7321
|
+
timestamp: new Date(),
|
|
7322
|
+
}]
|
|
7323
|
+
})
|
|
7324
|
+
await runTriggerTest({
|
|
7325
|
+
title: "Any Meal Passing (Unset) [After]",
|
|
7326
|
+
shouldTrigger: true,
|
|
7327
|
+
configurations: [{
|
|
7328
|
+
unit: 'mg/dL',
|
|
7329
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7330
|
+
}],
|
|
7331
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7332
|
+
vitals: [{
|
|
7333
|
+
beforeMeal: false,
|
|
7334
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7335
|
+
timestamp: new Date(),
|
|
7336
|
+
}]
|
|
7337
|
+
})
|
|
7338
|
+
await runTriggerTest({
|
|
7339
|
+
title: "Any Meal Passing",
|
|
7340
|
+
shouldTrigger: true,
|
|
7341
|
+
configurations: [{
|
|
7342
|
+
unit: 'mg/dL',
|
|
7343
|
+
mealStatus: 'Any',
|
|
7344
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7345
|
+
}],
|
|
7346
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7347
|
+
vitals: [{
|
|
7348
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7349
|
+
timestamp: new Date(),
|
|
7350
|
+
}]
|
|
7351
|
+
})
|
|
7352
|
+
await runTriggerTest({
|
|
7353
|
+
title: "Before Meal Passing",
|
|
7354
|
+
shouldTrigger: true,
|
|
7355
|
+
configurations: [{
|
|
7356
|
+
unit: 'mg/dL',
|
|
7357
|
+
mealStatus: 'Before',
|
|
7358
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7359
|
+
}],
|
|
7360
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7361
|
+
vitals: [{
|
|
7362
|
+
beforeMeal: true,
|
|
7363
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7364
|
+
timestamp: new Date(),
|
|
7365
|
+
}]
|
|
7366
|
+
})
|
|
7367
|
+
await runTriggerTest({
|
|
7368
|
+
title: "Before Meal Failing (omitted)",
|
|
7369
|
+
shouldTrigger: false,
|
|
7370
|
+
configurations: [{
|
|
7371
|
+
unit: 'mg/dL',
|
|
7372
|
+
mealStatus: 'Before',
|
|
7373
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7374
|
+
}],
|
|
7375
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7376
|
+
vitals: [{
|
|
7377
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7378
|
+
timestamp: new Date(),
|
|
7379
|
+
}]
|
|
7380
|
+
})
|
|
7381
|
+
await runTriggerTest({
|
|
7382
|
+
title: "Before Meal Failing",
|
|
7383
|
+
shouldTrigger: false,
|
|
7384
|
+
configurations: [{
|
|
7385
|
+
unit: 'mg/dL',
|
|
7386
|
+
mealStatus: 'Before',
|
|
7387
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7388
|
+
}],
|
|
7389
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7390
|
+
vitals: [{
|
|
7391
|
+
beforeMeal: false,
|
|
7392
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7393
|
+
timestamp: new Date(),
|
|
7394
|
+
}]
|
|
7395
|
+
})
|
|
7396
|
+
|
|
7397
|
+
await runTriggerTest({
|
|
7398
|
+
title: "After Meal Passing",
|
|
7399
|
+
shouldTrigger: true,
|
|
7400
|
+
configurations: [{
|
|
7401
|
+
unit: 'mg/dL',
|
|
7402
|
+
mealStatus: 'After',
|
|
7403
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7404
|
+
}],
|
|
7405
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7406
|
+
vitals: [{
|
|
7407
|
+
beforeMeal: false,
|
|
7408
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7409
|
+
timestamp: new Date(),
|
|
7410
|
+
}]
|
|
7411
|
+
})
|
|
7412
|
+
await runTriggerTest({
|
|
7413
|
+
title: "After Meal Failing (omitted)",
|
|
7414
|
+
shouldTrigger: false,
|
|
7415
|
+
configurations: [{
|
|
7416
|
+
unit: 'mg/dL',
|
|
7417
|
+
mealStatus: 'After',
|
|
7418
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7419
|
+
}],
|
|
7420
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7421
|
+
vitals: [{
|
|
7422
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7423
|
+
timestamp: new Date(),
|
|
7424
|
+
}]
|
|
7425
|
+
})
|
|
7426
|
+
await runTriggerTest({
|
|
7427
|
+
title: "After Meal Failing",
|
|
7428
|
+
shouldTrigger: false,
|
|
7429
|
+
configurations: [{
|
|
7430
|
+
unit: 'mg/dL',
|
|
7431
|
+
mealStatus: 'After',
|
|
7432
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, trendIntervalInMS: 0 }, ],
|
|
7433
|
+
}],
|
|
7434
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7435
|
+
vitals: [{
|
|
7436
|
+
beforeMeal: true,
|
|
7437
|
+
measurement: { unit: 'mg/dL', value: 100 },
|
|
7438
|
+
timestamp: new Date(),
|
|
7439
|
+
}]
|
|
7440
|
+
})
|
|
7441
|
+
|
|
7442
|
+
await runTriggerTest({
|
|
7443
|
+
title: "Before meal trend passing",
|
|
7444
|
+
shouldTrigger: true,
|
|
7445
|
+
configurations: [{
|
|
7446
|
+
mealStatus: 'Before',
|
|
7447
|
+
unit: 'mg/dL',
|
|
7448
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Less Than', value: 1 }, trendIntervalInMS: 1000 }, ],
|
|
7449
|
+
}],
|
|
7450
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7451
|
+
vitals: [
|
|
7452
|
+
{ beforeMeal: true, measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date() },
|
|
7453
|
+
{ beforeMeal: true, measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date(new Date().getTime() - 999) },
|
|
7454
|
+
]
|
|
7455
|
+
})
|
|
7456
|
+
await runTriggerTest({
|
|
7457
|
+
title: "Before meal trend failing, undefined",
|
|
7458
|
+
shouldTrigger: false,
|
|
7459
|
+
configurations: [{
|
|
7460
|
+
mealStatus: 'Before',
|
|
7461
|
+
unit: 'mg/dL',
|
|
7462
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Less Than', value: 1 }, trendIntervalInMS: 1000 }, ],
|
|
7463
|
+
}],
|
|
7464
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7465
|
+
vitals: [
|
|
7466
|
+
{ measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date() },
|
|
7467
|
+
{ measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date(new Date().getTime() - 999) },
|
|
7468
|
+
]
|
|
7469
|
+
})
|
|
7470
|
+
await runTriggerTest({
|
|
7471
|
+
title: "Before meal trend failing",
|
|
7472
|
+
shouldTrigger: false,
|
|
7473
|
+
configurations: [{
|
|
7474
|
+
mealStatus: 'Before',
|
|
7475
|
+
unit: 'mg/dL',
|
|
7476
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Less Than', value: 1 }, trendIntervalInMS: 1000 }, ],
|
|
7477
|
+
}],
|
|
7478
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7479
|
+
vitals: [
|
|
7480
|
+
{ beforeMeal: false, measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date() },
|
|
7481
|
+
{ beforeMeal: false, measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date(new Date().getTime() - 999) },
|
|
7482
|
+
]
|
|
7483
|
+
})
|
|
7484
|
+
|
|
7485
|
+
|
|
7486
|
+
await runTriggerTest({
|
|
7487
|
+
title: "After meal trend passing",
|
|
7488
|
+
shouldTrigger: true,
|
|
7489
|
+
configurations: [{
|
|
7490
|
+
mealStatus: 'After',
|
|
7491
|
+
unit: 'mg/dL',
|
|
7492
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Less Than', value: 1 }, trendIntervalInMS: 1000 }, ],
|
|
7493
|
+
}],
|
|
7494
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7495
|
+
vitals: [
|
|
7496
|
+
{ beforeMeal: false, measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date() },
|
|
7497
|
+
{ beforeMeal: false, measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date(new Date().getTime() - 999) },
|
|
7498
|
+
]
|
|
7499
|
+
})
|
|
7500
|
+
await runTriggerTest({
|
|
7501
|
+
title: "After meal trend failing, undefined",
|
|
7502
|
+
shouldTrigger: false,
|
|
7503
|
+
configurations: [{
|
|
7504
|
+
mealStatus: 'After',
|
|
7505
|
+
unit: 'mg/dL',
|
|
7506
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Less Than', value: 1 }, trendIntervalInMS: 1000 }, ],
|
|
7507
|
+
}],
|
|
7508
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7509
|
+
vitals: [
|
|
7510
|
+
{ measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date() },
|
|
7511
|
+
{ measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date(new Date().getTime() - 999) },
|
|
7512
|
+
]
|
|
7513
|
+
})
|
|
7514
|
+
await runTriggerTest({
|
|
7515
|
+
title: "After meal trend failing",
|
|
7516
|
+
shouldTrigger: false,
|
|
7517
|
+
configurations: [{
|
|
7518
|
+
mealStatus: 'After',
|
|
7519
|
+
unit: 'mg/dL',
|
|
7520
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Less Than', value: 1 }, trendIntervalInMS: 1000 }, ],
|
|
7521
|
+
}],
|
|
7522
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7523
|
+
vitals: [
|
|
7524
|
+
{ beforeMeal: true, measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date() },
|
|
7525
|
+
{ beforeMeal: true, measurement: { unit: 'mg/dL', value: 1 }, timestamp: new Date(new Date().getTime() - 999) },
|
|
7526
|
+
]
|
|
7527
|
+
})
|
|
7528
|
+
|
|
7529
|
+
await runTriggerTest({
|
|
7530
|
+
title: "Weight Trend from Profile (positive, not enough)",
|
|
7531
|
+
shouldTrigger: false,
|
|
7532
|
+
configurations: [{
|
|
7533
|
+
unit: 'LB',
|
|
7534
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, deviationFromProfileWeight: true, trendIntervalInMS: 0 }, ],
|
|
7535
|
+
}],
|
|
7536
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7537
|
+
vitals: [{
|
|
7538
|
+
measurement: { unit: 'LB', value: 180 },
|
|
7539
|
+
timestamp: new Date(),
|
|
7540
|
+
}]
|
|
7541
|
+
})
|
|
7542
|
+
await runTriggerTest({
|
|
7543
|
+
title: "Weight Trend from Profile (negative, not enough)",
|
|
7544
|
+
shouldTrigger: false,
|
|
7545
|
+
configurations: [{
|
|
7546
|
+
unit: 'LB',
|
|
7547
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: -1 }, deviationFromProfileWeight: true, trendIntervalInMS: 0 }, ],
|
|
7548
|
+
}],
|
|
7549
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7550
|
+
vitals: [{
|
|
7551
|
+
measurement: { unit: 'LB', value: 180 },
|
|
7552
|
+
timestamp: new Date(),
|
|
7553
|
+
}]
|
|
7554
|
+
})
|
|
7555
|
+
await runTriggerTest({
|
|
7556
|
+
title: "Weight Trend from Profile",
|
|
7557
|
+
shouldTrigger: true,
|
|
7558
|
+
configurations: [{
|
|
7559
|
+
unit: 'LB',
|
|
7560
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Greater Than', value: 1 }, deviationFromProfileWeight: true, trendIntervalInMS: 0 }, ],
|
|
7561
|
+
}],
|
|
7562
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7563
|
+
vitals: [{
|
|
7564
|
+
measurement: { unit: 'LB', value: 182 },
|
|
7565
|
+
timestamp: new Date(),
|
|
7566
|
+
}]
|
|
7567
|
+
})
|
|
7568
|
+
await runTriggerTest({
|
|
7569
|
+
title: "Weight Trend from Profile (negative)",
|
|
7570
|
+
shouldTrigger: true,
|
|
7571
|
+
configurations: [{
|
|
7572
|
+
unit: 'LB',
|
|
7573
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Less Than', value: -1 }, deviationFromProfileWeight: true, trendIntervalInMS: 0 }, ],
|
|
7574
|
+
}],
|
|
7575
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7576
|
+
vitals: [{
|
|
7577
|
+
measurement: { unit: 'LB', value: 178 },
|
|
7578
|
+
timestamp: new Date(),
|
|
7579
|
+
}]
|
|
7580
|
+
})
|
|
7581
|
+
|
|
7295
7582
|
await runTriggerTest({
|
|
7296
7583
|
title: "Basic Passing Test (Less Than Sucess)",
|
|
7297
7584
|
shouldTrigger: true,
|
|
@@ -7555,6 +7842,32 @@ const vital_trigger_tests = async () => {
|
|
|
7555
7842
|
{ measurement: { unit: 'LB', value: 1 }, timestamp: new Date(new Date().getTime() - 999) },
|
|
7556
7843
|
]
|
|
7557
7844
|
})
|
|
7845
|
+
await runTriggerTest({
|
|
7846
|
+
title: "2-point trend passing (negative)",
|
|
7847
|
+
shouldTrigger: true,
|
|
7848
|
+
configurations: [{
|
|
7849
|
+
unit: 'LB',
|
|
7850
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Less Than', value: -1 }, trendIntervalInMS: 1000 }, ],
|
|
7851
|
+
}],
|
|
7852
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7853
|
+
vitals: [
|
|
7854
|
+
{ measurement: { unit: 'LB', value: 1 }, timestamp: new Date() },
|
|
7855
|
+
{ measurement: { unit: 'LB', value: 10 }, timestamp: new Date(new Date().getTime() - 999) },
|
|
7856
|
+
]
|
|
7857
|
+
})
|
|
7858
|
+
await runTriggerTest({
|
|
7859
|
+
title: "2-point trend failing (negative)",
|
|
7860
|
+
shouldTrigger: false,
|
|
7861
|
+
configurations: [{
|
|
7862
|
+
unit: 'LB',
|
|
7863
|
+
ranges: [{ classification: 'Target', comparison: { type: 'Less Than', value: -1 }, trendIntervalInMS: 1000 }, ],
|
|
7864
|
+
}],
|
|
7865
|
+
triggers: [{ classifications: ['Target'], configurationIndexes: [0] }],
|
|
7866
|
+
vitals: [
|
|
7867
|
+
{ measurement: { unit: 'LB', value: 1 }, timestamp: new Date() },
|
|
7868
|
+
{ measurement: { unit: 'LB', value: 2 }, timestamp: new Date(new Date().getTime() - 999) },
|
|
7869
|
+
]
|
|
7870
|
+
})
|
|
7558
7871
|
await runTriggerTest({
|
|
7559
7872
|
title: "2-point trend failing for difference too small",
|
|
7560
7873
|
shouldTrigger: false,
|
package/test_generated.pdf
CHANGED
|
Binary file
|