fhir-dosage-utils 1.2.0 → 1.2.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/dist/main.js CHANGED
@@ -52,18 +52,27 @@ function $34ebae8ac5b52fcd$export$30c337e25ab8e95b({ extensions: extensions }) {
52
52
 
53
53
  // translators
54
54
  // To avoid circular dependancies issue, let's have a single place for exports and imports
55
- // types
56
- function $5ab57a471c359130$export$7de3722258b87db9({ config: config, dos: dos, i18next: i18next }) {
55
+ // Types
56
+ function $5461d5c8b4bc074f$export$76d408d587da5203(dos, key) {
57
57
  // If empty, return undefined
58
58
  if (dos.doseAndRate === undefined) return undefined;
59
59
  // Find the first entry that match criteria
60
- let doseQuantity = dos.doseAndRate.find((s)=>s.doseQuantity !== undefined);
60
+ let doseAndRate = dos.doseAndRate.find((s)=>s[key] !== undefined);
61
+ // If not found, skip
62
+ if (doseAndRate === undefined) return undefined;
63
+ // return property
64
+ return doseAndRate[key];
65
+ }
66
+
67
+
68
+ function $5ab57a471c359130$export$7de3722258b87db9({ config: config, dos: dos, i18next: i18next }) {
69
+ let doseQuantity = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "doseQuantity");
61
70
  // If not found, skip
62
71
  if (doseQuantity === undefined) return undefined;
63
- let quantity = doseQuantity.doseQuantity.value || 1;
72
+ let quantity = doseQuantity.value || 1;
64
73
  let unit = config.fromFHIRQuantityUnitToString({
65
74
  language: config.language,
66
- quantity: doseQuantity.doseQuantity
75
+ quantity: doseQuantity
67
76
  });
68
77
  return i18next.t("fields.doseQuantity", {
69
78
  quantity: quantity,
@@ -122,16 +131,14 @@ function $9ee880701f47723b$export$be17d167ed50d870({ range: range, config: confi
122
131
  }
123
132
 
124
133
 
134
+
125
135
  function $9a073aa5b09aa778$export$4cd16590995531a9({ dos: dos, config: config, i18next: i18next }) {
126
- // If empty, return undefined
127
- if (dos.doseAndRate === undefined) return undefined;
128
- // Find the first entry that match criteria
129
- let doseRange = dos.doseAndRate.find((s)=>s.doseRange !== undefined);
136
+ let doseRange = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "doseRange");
130
137
  // If not found, skip
131
138
  if (doseRange === undefined) return undefined;
132
139
  // Turn range into a text
133
140
  const text = (0, $9ee880701f47723b$export$be17d167ed50d870)({
134
- range: doseRange.doseRange,
141
+ range: doseRange,
135
142
  config: config,
136
143
  i18next: i18next
137
144
  });
@@ -143,20 +150,17 @@ function $9a073aa5b09aa778$export$4cd16590995531a9({ dos: dos, config: config, i
143
150
  }
144
151
 
145
152
 
146
- // types
153
+
147
154
  function $052c79abb28cba29$export$4e24ef8c7997cc56({ dos: dos, config: config, i18next: i18next }) {
148
- // If empty, return undefined
149
- if (dos.doseAndRate === undefined) return undefined;
150
- // Find the first entry that match criteria
151
- let rateQuantity = dos.doseAndRate.find((s)=>s.rateQuantity !== undefined);
155
+ let rateQuantity = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "rateQuantity");
152
156
  // If not found, skip
153
157
  if (rateQuantity === undefined) return undefined;
154
158
  // information from rate
155
- let value = rateQuantity.rateQuantity.value || 1;
159
+ let value = rateQuantity.value || 1;
156
160
  // quantity unit
157
161
  let unit = config.fromFHIRQuantityUnitToString({
158
162
  language: config.language,
159
- quantity: rateQuantity.rateQuantity
163
+ quantity: rateQuantity
160
164
  });
161
165
  return i18next.t("fields.rateQuantity", {
162
166
  quantity: value,
@@ -167,16 +171,14 @@ function $052c79abb28cba29$export$4e24ef8c7997cc56({ dos: dos, config: config, i
167
171
 
168
172
  // Utility function
169
173
 
174
+
170
175
  function $703b645b55481398$export$d3dd7d3522271dba({ dos: dos, config: config, i18next: i18next }) {
171
- // If empty, return undefined
172
- if (dos.doseAndRate === undefined) return undefined;
173
- // Find the first entry that match criteria
174
- let doseAndRate = dos.doseAndRate.find((s)=>s.rateRange !== undefined);
176
+ let rateRange = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "rateRange");
175
177
  // If not found, skip
176
- if (doseAndRate === undefined) return undefined;
178
+ if (rateRange === undefined) return undefined;
177
179
  // Turn range into a text
178
180
  const rangeText = (0, $9ee880701f47723b$export$be17d167ed50d870)({
179
- range: doseAndRate.rateRange,
181
+ range: rateRange,
180
182
  config: config,
181
183
  i18next: i18next
182
184
  });
@@ -234,18 +236,16 @@ function $7895e9944cc835ce$export$fdc6e9cbd31555fb({ ratio: ratio, config: confi
234
236
  }
235
237
 
236
238
 
239
+
237
240
  function $301791f33da707fa$export$b71cfd2510242de2({ dos: dos, config: config, i18next: i18next }) {
238
- // If empty, return undefined
239
- if (dos.doseAndRate === undefined) return undefined;
240
- // Find the first entry that match criteria
241
- let doseAndRate = dos.doseAndRate.find((s)=>s.rateRatio !== undefined);
241
+ let rateRatio = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "rateRatio");
242
242
  // If not found, skip
243
- if (doseAndRate === undefined) return undefined;
243
+ if (rateRatio === undefined) return undefined;
244
244
  // Turn ratio to text
245
245
  const ratioText = (0, $7895e9944cc835ce$export$fdc6e9cbd31555fb)({
246
246
  config: config,
247
247
  i18next: i18next,
248
- ratio: doseAndRate.rateRatio
248
+ ratio: rateRatio
249
249
  });
250
250
  if (ratioText === undefined) return undefined;
251
251
  return i18next.t("fields.rateRatio", {
@@ -254,11 +254,18 @@ function $301791f33da707fa$export$b71cfd2510242de2({ dos: dos, config: config, i
254
254
  }
255
255
 
256
256
 
257
- function $1270a8f06113f53a$export$675ae45fa2875f4a({ dos: dos, i18next: i18next }) {
257
+ function $e8251a88ed398f12$export$1d3efc96e203aa6b(dos) {
258
258
  // If empty, return undefined
259
259
  if (dos.timing === undefined || dos.timing.repeat === undefined) return undefined;
260
+ return dos.timing.repeat;
261
+ }
262
+
263
+
264
+ function $1270a8f06113f53a$export$675ae45fa2875f4a({ dos: dos, i18next: i18next }) {
265
+ let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
266
+ // If empty, return undefined
267
+ if (repeat === undefined) return undefined;
260
268
  // Pickup the repeat interesting attributes
261
- let repeat = dos.timing.repeat;
262
269
  let duration = repeat.duration;
263
270
  let max = repeat.durationMax;
264
271
  let unit = repeat.durationUnit;
@@ -281,11 +288,12 @@ function $1270a8f06113f53a$export$675ae45fa2875f4a({ dos: dos, i18next: i18next
281
288
  }
282
289
 
283
290
 
291
+
284
292
  function $bc43734b944260d2$export$d663412e0c469ce2({ dos: dos, i18next: i18next }) {
293
+ let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
285
294
  // If empty, return undefined
286
- if (dos.timing === undefined || dos.timing.repeat === undefined) return undefined;
295
+ if (repeat === undefined) return undefined;
287
296
  // Pickup the repeat interesting attributes
288
- let repeat = dos.timing.repeat;
289
297
  let frequency = repeat.frequency;
290
298
  let max = repeat.frequencyMax;
291
299
  // Do nothing if no frequency / frequencyMax, I am not a wizard
@@ -309,11 +317,12 @@ function $bc43734b944260d2$export$d663412e0c469ce2({ dos: dos, i18next: i18next
309
317
  }
310
318
 
311
319
 
320
+
312
321
  function $b9825dd9e0a2e687$export$aa31b783699f637({ dos: dos, i18next: i18next }) {
322
+ let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
313
323
  // If empty, return undefined
314
- if (dos.timing === undefined || dos.timing.repeat === undefined) return undefined;
324
+ if (repeat === undefined) return undefined;
315
325
  // Pickup the repeat interesting attributes
316
- let repeat = dos.timing.repeat;
317
326
  let period = repeat.period;
318
327
  let max = repeat.periodMax;
319
328
  let unit = repeat.periodUnit;
@@ -364,6 +373,7 @@ function $93b58b7d2ead3b95$export$826742c1df3eca39(i18next, arr, linkWord = "and
364
373
  }
365
374
 
366
375
 
376
+
367
377
  // Function to extract times
368
378
  function $7a065f861a4b61f2$var$extractTime(minutes) {
369
379
  let days = Math.floor(minutes / 1440);
@@ -407,10 +417,10 @@ function $7a065f861a4b61f2$var$transformWhen(i18next, when) {
407
417
  return finalString;
408
418
  }
409
419
  function $7a065f861a4b61f2$export$433fa514f44031f3({ dos: dos, i18next: i18next }) {
420
+ let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
410
421
  // If empty, return undefined
411
- if (dos.timing === undefined || dos.timing.repeat === undefined) return undefined;
422
+ if (repeat === undefined) return undefined;
412
423
  // Pickup the repeat interesting attributes
413
- let repeat = dos.timing.repeat;
414
424
  let offset = repeat.offset;
415
425
  let when = repeat.when;
416
426
  // If both are undefined, don't do anything
@@ -426,11 +436,12 @@ function $7a065f861a4b61f2$export$433fa514f44031f3({ dos: dos, i18next: i18next
426
436
 
427
437
  // Function
428
438
 
439
+
429
440
  function $46f2142e76cf7e45$export$f6325e43097e9543({ dos: dos, i18next: i18next }) {
441
+ let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
430
442
  // If empty, return undefined
431
- if (dos.timing === undefined || dos.timing.repeat === undefined) return undefined;
443
+ if (repeat === undefined) return undefined;
432
444
  // Pickup the repeat interesting attributes
433
- let repeat = dos.timing.repeat;
434
445
  let dayOfWeek = repeat.dayOfWeek;
435
446
  // If empty, skip it
436
447
  if (dayOfWeek === undefined || dayOfWeek.length === 0) return undefined;
@@ -448,6 +459,7 @@ function $46f2142e76cf7e45$export$f6325e43097e9543({ dos: dos, i18next: i18next
448
459
 
449
460
  // Functions
450
461
 
462
+
451
463
  /**
452
464
  * time during the day, in the format hh:mm:ss (a subset of [ISO8601] icon).
453
465
  * There is no date specified. Seconds must be provided due to schema type constraints but may be zero-filled
@@ -461,10 +473,10 @@ function $46f2142e76cf7e45$export$f6325e43097e9543({ dos: dos, i18next: i18next
461
473
  return parts.join(":");
462
474
  }
463
475
  function $a846209a7dd119d4$export$ee205fa48981886d({ dos: dos, i18next: i18next }) {
476
+ let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
464
477
  // If empty, return undefined
465
- if (dos.timing === undefined || dos.timing.repeat === undefined) return undefined;
478
+ if (repeat === undefined) return undefined;
466
479
  // Pickup the repeat interesting attributes
467
- let repeat = dos.timing.repeat;
468
480
  let timeOfDay = repeat.timeOfDay;
469
481
  // If empty, skip it
470
482
  if (timeOfDay === undefined || timeOfDay.length === 0) return undefined;
@@ -512,7 +524,8 @@ function $ee04e2a8ed39962f$export$5c69a2202525487a({ dos: dos, config: config, i
512
524
  }
513
525
 
514
526
 
515
- // types
527
+ // Functions
528
+
516
529
  // Duration to string
517
530
  function $9d632517596957df$var$transformDurationToString(i18next, duration, config) {
518
531
  let quantity = duration.value;
@@ -532,10 +545,10 @@ function $9d632517596957df$var$transformDurationToString(i18next, duration, conf
532
545
  }
533
546
  }
534
547
  function $9d632517596957df$export$b927a06bc51aea32({ dos: dos, config: config, i18next: i18next }) {
548
+ let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
535
549
  // If empty, return undefined
536
- if (dos.timing === undefined || dos.timing.repeat === undefined) return undefined;
550
+ if (repeat === undefined) return undefined;
537
551
  // Pickup the repeat interesting attributes
538
- let repeat = dos.timing.repeat;
539
552
  let boundsDuration = repeat.boundsDuration;
540
553
  // Do nothing if no boundsDuration, I am not a wizard
541
554
  if (boundsDuration === undefined) return undefined;
@@ -550,11 +563,12 @@ function $9d632517596957df$export$b927a06bc51aea32({ dos: dos, config: config, i
550
563
 
551
564
  // types
552
565
 
566
+
553
567
  function $2da391a8a8345a3d$export$8c667cbf7bebaa93({ dos: dos, config: config, i18next: i18next }) {
568
+ let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
554
569
  // If empty, return undefined
555
- if (dos.timing === undefined || dos.timing.repeat === undefined) return undefined;
570
+ if (repeat === undefined) return undefined;
556
571
  // Pickup the repeat interesting attributes
557
- let repeat = dos.timing.repeat;
558
572
  let boundsRange = repeat.boundsRange;
559
573
  // Do nothing if no boundsRange, I am not a wizard
560
574
  if (boundsRange === undefined) return undefined;
@@ -575,11 +589,12 @@ function $2da391a8a8345a3d$export$8c667cbf7bebaa93({ dos: dos, config: config, i
575
589
  }
576
590
 
577
591
 
592
+
578
593
  function $39470eb799331038$export$498ca7f558a02e67({ dos: dos, i18next: i18next }) {
594
+ let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
579
595
  // If empty, return undefined
580
- if (dos.timing === undefined || dos.timing.repeat === undefined) return undefined;
596
+ if (repeat === undefined) return undefined;
581
597
  // Pickup the repeat interesting attributes
582
- let repeat = dos.timing.repeat;
583
598
  let count = repeat.count;
584
599
  let countMax = repeat.countMax;
585
600
  // Do nothing if no count, I am not a wizard
@@ -885,8 +900,6 @@ function $2c21ace90ecdbde6$export$9f330b4bf8c0975c({ entry: entry, ...args }) {
885
900
 
886
901
 
887
902
 
888
- // backends i18next
889
- const $74b0cf9d3dbd5b46$var$localeImport = async (lng, ns)=>import(`./locales/${lng}/${ns}.json`);
890
903
  class $74b0cf9d3dbd5b46$export$1c191bca55f84a03 {
891
904
  // Set up lib, according provided parameters
892
905
  constructor(args){
@@ -949,7 +962,7 @@ class $74b0cf9d3dbd5b46$export$1c191bca55f84a03 {
949
962
  backend: {
950
963
  backends: [
951
964
  (0, ($parcel$interopDefault($8zHUo$i18nextresourcestobackend)))(// have to cast the function to be webpack / builder friendly
952
- $74b0cf9d3dbd5b46$var$localeImport)
965
+ async (lng, ns)=>import(`./locales/${lng}/${ns}.json`))
953
966
  ]
954
967
  }
955
968
  });