@d4l/collect-lib 1.48.0 → 1.50.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/dist/index.mjs CHANGED
@@ -922,6 +922,33 @@ var GARMIN_ANNOTATION_ITEM_BLOOD_PRESSURE = {
922
922
  var GARMIN_BLOOD_PRESSURE_ANNOTATION = [
923
923
  GARMIN_ANNOTATION_ITEM_BLOOD_PRESSURE
924
924
  ];
925
+ var GARMIN_ANNOTATION_ITEM_ACTIVITY_LEVEL = {
926
+ type: "activityLevel",
927
+ size: 1,
928
+ format: "unsignedInt",
929
+ note: "0=sedentary, 1=active, 2=highly active (Garmin epoch intensity)"
930
+ };
931
+ var GARMIN_ANNOTATION_ITEM_ACTIVITY_METS = {
932
+ type: "averageMetabolicEquivalent",
933
+ size: 4,
934
+ format: "float32",
935
+ littleEndian: true,
936
+ unit: "MET",
937
+ note: "average METs over the epoch; 0 when Garmin sent none"
938
+ };
939
+ var GARMIN_ANNOTATION_ITEM_ACTIVITY_ACTIVE_TIME = {
940
+ type: "duration",
941
+ size: 2,
942
+ format: "unsignedInt",
943
+ littleEndian: true,
944
+ unit: "s",
945
+ note: "active seconds within the 15-minute epoch"
946
+ };
947
+ var GARMIN_ACTIVITY_ANNOTATION = [
948
+ GARMIN_ANNOTATION_ITEM_ACTIVITY_LEVEL,
949
+ GARMIN_ANNOTATION_ITEM_ACTIVITY_METS,
950
+ GARMIN_ANNOTATION_ITEM_ACTIVITY_ACTIVE_TIME
951
+ ];
925
952
  var GARMIN_SIGNAL_TYPE_ANNOTATIONS = {
926
953
  heartRate: FITBIT_HEART_RATE_ANNOTATION,
927
954
  hrv: FITBIT_HEART_RATE_VARIABILITY_ANNOTATION,
@@ -942,7 +969,8 @@ var GARMIN_SIGNAL_TYPE_ANNOTATIONS = {
942
969
  sleepScore: GARMIN_SLEEP_SCORE_ANNOTATION,
943
970
  vo2max: GARMIN_VO2MAX_ANNOTATION,
944
971
  bodyComposition: GARMIN_BODY_COMPOSITION_ANNOTATION,
945
- bloodPressure: GARMIN_BLOOD_PRESSURE_ANNOTATION
972
+ bloodPressure: GARMIN_BLOOD_PRESSURE_ANNOTATION,
973
+ activity: GARMIN_ACTIVITY_ANNOTATION
946
974
  };
947
975
 
948
976
  // src/devices/annotations/movella.ts
@@ -1348,6 +1376,11 @@ var QItemControlDefinition = "http://hl7.org/fhir/StructureDefinition/questionna
1348
1376
  var RoutineIsPassiveExtension = "http://fhir.data4life.care/StructureDefinition/is-passive-recording";
1349
1377
  var PrepopulateExtension = "http://fhir.data4life.care/StructureDefinition/prepopulate";
1350
1378
  var ImageExtension = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemMedia";
1379
+ var QuestionnaireItemOutputExtension = "http://fhir.data4life.care/StructureDefinition/questionnaire-item-output";
1380
+ var QuestionnaireItemInputExtension = "http://fhir.data4life.care/StructureDefinition/questionnaire-item-input";
1381
+ var TopicInputTopicUrl = "topic";
1382
+ var TopicInputScopeUrl = "scope";
1383
+ var TopicSystem = "http://fhir.data4life.care/topic";
1351
1384
  var SignalIDSystem = "http://fhir.data4life.care/r5/NamingSystem/app-signal-ids";
1352
1385
  var AppIDNamingSystem = "http://fhir.data4life.care/r5/NamingSystem/app-db-ids";
1353
1386
  var SensorTypeSystem = "http://fhir.data4life.care/r5/NamingSystem/sensor-device-type";
@@ -1428,6 +1461,14 @@ function generateFHIRConsent(id, consent, decision, start, end) {
1428
1461
  };
1429
1462
  }
1430
1463
 
1464
+ // src/fhir/topic-id.ts
1465
+ var TOPIC_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
1466
+ var isValidTopicId = (id) => TOPIC_ID_PATTERN.test(id);
1467
+ var topicIdFromCanonical = (canonical) => canonical.substring(canonical.lastIndexOf("/") + 1);
1468
+ var isValidTopicCanonical = (canonical) => isValidTopicId(topicIdFromCanonical(canonical));
1469
+ var TOPIC_SCOPE_CODES = ["session", "latest", "all"];
1470
+ var isValidTopicScope = (code) => TOPIC_SCOPE_CODES.includes(code);
1471
+
1431
1472
  // src/fhir/utils.ts
1432
1473
  import { v4 as uuid } from "uuid";
1433
1474
  function generateUrn() {
@@ -7299,6 +7340,10 @@ export {
7299
7340
  FITBIT_SLEEP_LEVEL_MAP,
7300
7341
  FITBIT_SPO2_ANNOTATION,
7301
7342
  FITBIT_STEPS_ANNOTATION,
7343
+ GARMIN_ACTIVITY_ANNOTATION,
7344
+ GARMIN_ANNOTATION_ITEM_ACTIVITY_ACTIVE_TIME,
7345
+ GARMIN_ANNOTATION_ITEM_ACTIVITY_LEVEL,
7346
+ GARMIN_ANNOTATION_ITEM_ACTIVITY_METS,
7302
7347
  GARMIN_ANNOTATION_ITEM_BLOOD_PRESSURE,
7303
7348
  GARMIN_ANNOTATION_ITEM_BODY_BATTERY,
7304
7349
  GARMIN_ANNOTATION_ITEM_BODY_COMPOSITION,
@@ -7371,6 +7416,8 @@ export {
7371
7416
  PostalCodeFromItemUrl,
7372
7417
  PrepopulateExtension,
7373
7418
  QItemControlDefinition,
7419
+ QuestionnaireItemInputExtension,
7420
+ QuestionnaireItemOutputExtension,
7374
7421
  RECORDING_MODEL_CURRENT_VERSION,
7375
7422
  RECORDING_SIGNAL_MODEL_CURRENT_VERSION,
7376
7423
  RelativeMaxValueExtension,
@@ -7391,8 +7438,13 @@ export {
7391
7438
  StudyNameSystem,
7392
7439
  SurveyGuard,
7393
7440
  TAG_LENGTH,
7441
+ TOPIC_ID_PATTERN,
7442
+ TOPIC_SCOPE_CODES,
7394
7443
  TimeFuncs,
7395
7444
  TokenNamingSystem,
7445
+ TopicInputScopeUrl,
7446
+ TopicInputTopicUrl,
7447
+ TopicSystem,
7396
7448
  ULID_REGEX,
7397
7449
  ULIDtoUUID,
7398
7450
  UUID_REGEX,
@@ -7438,6 +7490,9 @@ export {
7438
7490
  isNotBeforeStartDate,
7439
7491
  isScalarAnswer,
7440
7492
  isScoreEligible,
7493
+ isValidTopicCanonical,
7494
+ isValidTopicId,
7495
+ isValidTopicScope,
7441
7496
  isYearString,
7442
7497
  newStepDateGuard,
7443
7498
  overwriteTime,
@@ -7446,6 +7501,7 @@ export {
7446
7501
  timezonelessDate,
7447
7502
  toDeviceConfig,
7448
7503
  toQuestionnaireResponseItem,
7504
+ topicIdFromCanonical,
7449
7505
  uint8ArrayToBinaryString,
7450
7506
  utf8ToUint8Array,
7451
7507
  v4AesKey,