fhir-dosage-utils 1.10.0 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/main.js CHANGED
@@ -18,40 +18,44 @@ function $parcel$interopDefault(a) {
18
18
  $parcel$defineInteropFlag(module.exports);
19
19
 
20
20
  $parcel$export(module.exports, "default", () => $882b6d93070905b3$export$2e2bcd8739ae039);
21
- // Classe(s)
22
21
 
23
22
 
24
- // Types
23
+ function $3d60081b7152576d$export$e7321bf46d18757f(val) {
24
+ return val !== undefined;
25
+ }
26
+ function $3d60081b7152576d$export$3b3497187fd4cc1a(...args) {
27
+ return args.every($3d60081b7152576d$export$e7321bf46d18757f);
28
+ }
29
+ function $3d60081b7152576d$export$cbff5d1bcc7ff30a(...args) {
30
+ return !args.some($3d60081b7152576d$export$e7321bf46d18757f);
31
+ }
32
+
33
+
25
34
  function $1c57f108974f2805$export$b1a6aed91fad1636({ quantity: quantity }) {
26
- if (quantity.code !== undefined) return quantity.code;
27
- if (quantity.unit !== undefined) return quantity.unit;
35
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(quantity.code)) return quantity.code;
36
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(quantity.unit)) return quantity.unit;
28
37
  return "";
29
38
  }
30
39
 
31
40
 
32
- // Functions
41
+
33
42
  function $7642ff4865ae4b0f$export$d9ff4a623e416a11(array) {
34
- return array === undefined || array.length === 0;
43
+ return !(0, $3d60081b7152576d$export$e7321bf46d18757f)(array) || array.length === 0;
35
44
  }
36
45
 
37
46
 
47
+
38
48
  function $a6c648898dc8c3b6$export$f478f96b98da13a4({ code: code }) {
39
- // If no code, skip it
40
- if (code === undefined) return undefined;
41
- // Take text first
42
- if (code.text !== undefined) return code.text;
43
- // If empty, skip it
49
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(code)) return undefined;
50
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(code.text)) return code.text;
44
51
  if ((0, $7642ff4865ae4b0f$export$d9ff4a623e416a11)(code.coding)) return undefined;
45
- // Take first coding; display first then code
46
52
  let firstCode = code.coding[0];
47
53
  return firstCode.display || firstCode.code;
48
54
  }
49
55
 
50
56
 
51
- // Functions
52
57
 
53
58
  function $34ebae8ac5b52fcd$export$30c337e25ab8e95b({ extensions: extensions }) {
54
- // If no extensions, skip it
55
59
  if ((0, $7642ff4865ae4b0f$export$d9ff4a623e416a11)(extensions)) return undefined;
56
60
  // KIS implementation : print it as provided, without doing anything
57
61
  // Extensions have so many cases btw, that having a basic function does the trick
@@ -97,18 +101,12 @@ const $99ea7fa882fd33ad$export$38cd8db2db178f58 = {
97
101
 
98
102
 
99
103
  class $868b4eaa4f62b9f7$export$f807d9a22ff8372d {
100
- // Set up lib, according provided parameters
101
104
  constructor(userConfig, i18nConfig){
102
- // User config
103
105
  this.config = {
104
- // default attributes
105
106
  ...(0, $99ea7fa882fd33ad$export$38cd8db2db178f58),
106
- // attributes set by user
107
107
  ...userConfig
108
108
  };
109
- // I18N config
110
109
  this.i18nConfig = {
111
- // default attributes
112
110
  fallbackLng: "en",
113
111
  lng: this.config.language,
114
112
  ns: [
@@ -119,7 +117,6 @@ class $868b4eaa4f62b9f7$export$f807d9a22ff8372d {
119
117
  "quantityComparator"
120
118
  ],
121
119
  defaultNS: "common",
122
- // attributes set by user
123
120
  ...i18nConfig
124
121
  };
125
122
  this.i18nInstance = (0, ($parcel$interopDefault($8zHUo$i18next))).createInstance();
@@ -187,55 +184,41 @@ class $868b4eaa4f62b9f7$export$f807d9a22ff8372d {
187
184
  }
188
185
 
189
186
 
190
- // translators
191
- // To avoid circular dependancies issue, let's have a single place for exports and imports
192
- // Functions
193
- // Types
187
+
194
188
  function $5461d5c8b4bc074f$export$76d408d587da5203(dos, key) {
195
- // If empty, return undefined
196
- if (dos.doseAndRate === undefined) return undefined;
189
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(dos.doseAndRate)) return undefined;
197
190
  // Find the first entry that match criteria
198
- let doseAndRate = dos.doseAndRate.find((s)=>s[key] !== undefined);
199
- // If not found, skip
200
- if (doseAndRate === undefined) return undefined;
201
- // return property
191
+ let doseAndRate = dos.doseAndRate.find((s)=>(0, $3d60081b7152576d$export$e7321bf46d18757f)(s[key]));
192
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(doseAndRate)) return undefined;
202
193
  return doseAndRate[key];
203
194
  }
204
195
 
205
196
 
206
- // Function
207
- // Type
197
+
208
198
  function $6ce94eb09701f53d$export$e9106be159f8c977({ quantity: quantity, config: config, i18next: i18next }) {
209
- // extract function for the unit display from config
210
199
  const { fromFHIRQuantityUnitToString: fromFHIRQuantityUnitToString, language: language } = config;
211
- // Compute the result
212
200
  let unit = fromFHIRQuantityUnitToString({
213
201
  language: language,
214
202
  quantity: quantity
215
203
  });
216
204
  let value = quantity.value || 1;
217
- // If no unit is present (in other words ""), we don't put it
218
205
  let quantityString = unit.length === 0 ? i18next.t("amount.quantity.withoutUnit", {
219
206
  quantity: value
220
207
  }) : i18next.t("amount.quantity.withUnit", {
221
208
  quantity: value,
222
209
  unit: unit
223
210
  });
224
- // Compute the comparator
225
211
  let comparatorCode = quantity.comparator;
226
- let comparatorString = comparatorCode !== undefined ? i18next.t(`quantityComparator:${comparatorCode}`) : undefined;
227
- // If no comparator, print it
228
- if (comparatorString === undefined) return quantityString;
229
- else // concatenate comparator and quantity
212
+ let comparatorString = (0, $3d60081b7152576d$export$e7321bf46d18757f)(comparatorCode) ? i18next.t(`quantityComparator:${comparatorCode}`) : undefined;
213
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(comparatorString)) return quantityString;
230
214
  return `${comparatorString} ${quantityString}`;
231
215
  }
232
216
 
233
217
 
218
+
234
219
  function $5ab57a471c359130$export$7de3722258b87db9({ config: config, dos: dos, i18next: i18next }) {
235
220
  let doseQuantity = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "doseQuantity");
236
- // If not found, skip
237
- if (doseQuantity === undefined) return undefined;
238
- // Otherwise rendering it
221
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(doseQuantity)) return undefined;
239
222
  return i18next.t("fields.doseQuantity", {
240
223
  quantityText: (0, $6ce94eb09701f53d$export$e9106be159f8c977)({
241
224
  quantity: doseQuantity,
@@ -246,50 +229,51 @@ function $5ab57a471c359130$export$7de3722258b87db9({ config: config, dos: dos, i
246
229
  }
247
230
 
248
231
 
249
- // Utility function
250
- // Quantity unit to string
232
+
233
+ function $c3b3b5857aef7d44$export$aace639f4c93bb3d(quantity) {
234
+ return [
235
+ quantity?.unit,
236
+ quantity?.code
237
+ ].some((0, $3d60081b7152576d$export$e7321bf46d18757f));
238
+ }
239
+
240
+
241
+
251
242
  function $9ee880701f47723b$var$transformQuantityUnitToString(i18next, quantity, config) {
252
243
  let quantityValue = quantity.value;
253
- // If common units from HL7, do the job
254
244
  if (quantity.system === "http://hl7.org/fhir/ValueSet/duration-units") {
255
245
  let code = quantity.code;
256
246
  return i18next.t(`unitsOfTime:withoutCount.${code}`, {
257
247
  count: quantityValue
258
248
  });
259
249
  }
260
- // otherwise, it is UCUM, ... so let the user do the job
261
250
  return config.fromFHIRQuantityUnitToString({
262
251
  language: config.language,
263
252
  quantity: quantity
264
253
  });
265
254
  }
266
255
  function $9ee880701f47723b$export$be17d167ed50d870({ range: range, config: config, i18next: i18next }) {
267
- // Extract params
268
256
  const { low: low, high: high } = range;
269
257
  const lowValue = low?.value;
270
258
  const highValue = high?.value;
271
- // prepare unit display
272
259
  let quantityUnit = high || low;
273
- let hasUnit = quantityUnit?.unit !== undefined || quantityUnit?.code !== undefined;
274
- // Four cases
260
+ let hasQuantityUnit = (0, $c3b3b5857aef7d44$export$aace639f4c93bb3d)(quantityUnit);
275
261
  // 1. If we have a empty object, return undefined
276
- if (lowValue === undefined && highValue === undefined) return undefined;
277
- // quantity unit
278
- let unit = hasUnit ? $9ee880701f47723b$var$transformQuantityUnitToString(i18next, quantityUnit, config) : "";
279
- let technicalKey = hasUnit ? "withUnit" : "withoutUnit";
262
+ if ((0, $3d60081b7152576d$export$cbff5d1bcc7ff30a)(lowValue, highValue)) return undefined;
263
+ let unit = hasQuantityUnit ? $9ee880701f47723b$var$transformQuantityUnitToString(i18next, quantityUnit, config) : "";
264
+ let technicalKey = hasQuantityUnit ? "withUnit" : "withoutUnit";
280
265
  // 2. Both low & high are present
281
- if (lowValue !== undefined && highValue !== undefined) return i18next.t(`amount.range.${technicalKey}.lowAndHigh`, {
266
+ if ((0, $3d60081b7152576d$export$3b3497187fd4cc1a)(lowValue, highValue)) return i18next.t(`amount.range.${technicalKey}.lowAndHigh`, {
282
267
  low: lowValue,
283
268
  high: highValue,
284
269
  unit: unit
285
270
  });
286
271
  // 3. Only high is present
287
- if (highValue !== undefined) return i18next.t(`amount.range.${technicalKey}.onlyHigh`, {
272
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(highValue)) return i18next.t(`amount.range.${technicalKey}.onlyHigh`, {
288
273
  high: highValue,
289
274
  unit: unit
290
275
  });
291
276
  // 4. Only low is present
292
- // Warning, this case is kind dangerous and clinically unsafe so minimal effort on this ...
293
277
  return i18next.t(`amount.range.${technicalKey}.onlyLow`, {
294
278
  low: lowValue,
295
279
  unit: unit
@@ -298,31 +282,28 @@ function $9ee880701f47723b$export$be17d167ed50d870({ range: range, config: confi
298
282
 
299
283
 
300
284
 
285
+
301
286
  function $9a073aa5b09aa778$export$4cd16590995531a9({ dos: dos, config: config, i18next: i18next }) {
302
287
  let doseRange = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "doseRange");
303
- // If not found, skip
304
- if (doseRange === undefined) return undefined;
305
- // Turn range into a text
288
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(doseRange)) return undefined;
306
289
  const text = (0, $9ee880701f47723b$export$be17d167ed50d870)({
307
290
  range: doseRange,
308
291
  config: config,
309
292
  i18next: i18next
310
293
  });
311
- // Reject if empty
312
- if (text === undefined) return undefined;
294
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(text)) return undefined;
313
295
  return i18next.t("fields.doseRange", {
314
296
  rangeText: text
315
297
  });
316
298
  }
317
299
 
318
300
 
319
- // Functions
301
+
320
302
 
321
303
 
322
304
  function $052c79abb28cba29$export$4e24ef8c7997cc56({ dos: dos, config: config, i18next: i18next }) {
323
305
  let rateQuantity = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "rateQuantity");
324
- // If not found, skip
325
- if (rateQuantity === undefined) return undefined;
306
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(rateQuantity)) return undefined;
326
307
  return i18next.t("fields.rateQuantity", {
327
308
  quantityText: (0, $6ce94eb09701f53d$export$e9106be159f8c977)({
328
309
  quantity: rateQuantity,
@@ -333,48 +314,35 @@ function $052c79abb28cba29$export$4e24ef8c7997cc56({ dos: dos, config: config, i
333
314
  }
334
315
 
335
316
 
336
- // Utility function
317
+
337
318
 
338
319
 
339
320
  function $703b645b55481398$export$d3dd7d3522271dba({ dos: dos, config: config, i18next: i18next }) {
340
321
  let rateRange = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "rateRange");
341
- // If not found, skip
342
- if (rateRange === undefined) return undefined;
343
- // Turn range into a text
322
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(rateRange)) return undefined;
344
323
  const rangeText = (0, $9ee880701f47723b$export$be17d167ed50d870)({
345
324
  range: rateRange,
346
325
  config: config,
347
326
  i18next: i18next
348
327
  });
349
- // Reject if empty
350
- if (rangeText === undefined) return undefined;
351
- // return the final string
328
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(rangeText)) return undefined;
352
329
  return i18next.t("fields.rateRange", {
353
330
  rangeText: rangeText
354
331
  });
355
332
  }
356
333
 
357
334
 
358
- // Functions
359
335
 
360
- // Quantity has an unit ?
361
- function $7895e9944cc835ce$var$hasUnit(quantity) {
362
- return [
363
- quantity?.unit,
364
- quantity?.code
365
- ].some((field)=>field !== undefined);
366
- }
336
+
337
+
367
338
  // To cover all nasty cases of denominator
368
339
  function $7895e9944cc835ce$var$fromDenominatorToString({ config: config, i18next: i18next, quantity: quantity }) {
369
- let hasUnitDenominator = $7895e9944cc835ce$var$hasUnit(quantity);
340
+ let hasUnitDenominator = (0, $c3b3b5857aef7d44$export$aace639f4c93bb3d)(quantity);
370
341
  let value = quantity.value;
371
- // If no unit, it is quite simple
372
342
  if (!hasUnitDenominator) return `:${value}`;
373
- // Get correct linkword (depending of the quantity value)
374
343
  let linkword = i18next.t("amount.ratio.denominatorLinkword", {
375
344
  count: value
376
345
  });
377
- // Get quantity text (depending of the quantity value)
378
346
  let quantityText = value !== 1 ? (0, $6ce94eb09701f53d$export$e9106be159f8c977)({
379
347
  quantity: quantity,
380
348
  config: config,
@@ -383,21 +351,15 @@ function $7895e9944cc835ce$var$fromDenominatorToString({ config: config, i18next
383
351
  quantity: quantity,
384
352
  language: config.language
385
353
  });
386
- // Concatenate all computed parts
387
354
  // The space before is intentional so that numerator and denominator are well printed regardless of situation
388
355
  return ` ${linkword} ${quantityText}`;
389
356
  }
390
357
  function $7895e9944cc835ce$export$fdc6e9cbd31555fb({ ratio: ratio, config: config, i18next: i18next }) {
391
- // Extract params
392
358
  const { denominator: denominator, numerator: numerator } = ratio;
393
- // quantity
394
359
  let quantityNumerator = numerator?.value;
395
360
  let quantityDenominator = denominator?.value;
396
- // Collect results
397
361
  const parts = [];
398
- // Deal with numerator first
399
- if (quantityNumerator !== undefined) {
400
- // Reuse the quantity to string translation
362
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(quantityNumerator)) {
401
363
  const numeratorString = (0, $6ce94eb09701f53d$export$e9106be159f8c977)({
402
364
  quantity: numerator,
403
365
  config: config,
@@ -405,9 +367,7 @@ function $7895e9944cc835ce$export$fdc6e9cbd31555fb({ ratio: ratio, config: confi
405
367
  });
406
368
  parts.push(numeratorString);
407
369
  }
408
- // Deal with denominator
409
- if (quantityDenominator !== undefined) {
410
- // Several cases exist for that, let use a proper function for that
370
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(quantityDenominator)) {
411
371
  const denominatorString = $7895e9944cc835ce$var$fromDenominatorToString({
412
372
  config: config,
413
373
  i18next: i18next,
@@ -415,55 +375,47 @@ function $7895e9944cc835ce$export$fdc6e9cbd31555fb({ ratio: ratio, config: confi
415
375
  });
416
376
  parts.push(denominatorString);
417
377
  }
418
- // Concatenate the result
419
378
  return parts.length > 0 ? parts.join("") : undefined;
420
379
  }
421
380
 
422
381
 
423
382
 
383
+
424
384
  function $301791f33da707fa$export$b71cfd2510242de2({ dos: dos, config: config, i18next: i18next }) {
425
385
  let rateRatio = (0, $5461d5c8b4bc074f$export$76d408d587da5203)(dos, "rateRatio");
426
- // If not found, skip
427
- if (rateRatio === undefined) return undefined;
428
- // Turn ratio to text
386
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(rateRatio)) return undefined;
429
387
  const ratioText = (0, $7895e9944cc835ce$export$fdc6e9cbd31555fb)({
430
388
  config: config,
431
389
  i18next: i18next,
432
390
  ratio: rateRatio
433
391
  });
434
- if (ratioText === undefined) return undefined;
392
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(ratioText)) return undefined;
435
393
  return i18next.t("fields.rateRatio", {
436
394
  ratioText: ratioText
437
395
  });
438
396
  }
439
397
 
440
398
 
441
- function $e8251a88ed398f12$export$1d3efc96e203aa6b(dos) {
442
- // If empty, return undefined
443
- if (dos.timing?.repeat === undefined) return undefined;
444
- return dos.timing.repeat;
399
+
400
+ function $cc064cd9e69cf2cf$export$59de929dfa9e850b(dos, key) {
401
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(dos.timing?.repeat)) return undefined;
402
+ return dos.timing.repeat[key];
445
403
  }
446
404
 
447
405
 
406
+
448
407
  function $1270a8f06113f53a$export$675ae45fa2875f4a({ dos: dos, i18next: i18next }) {
449
- let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
450
- // If empty, return undefined
451
- if (repeat === undefined) return undefined;
452
- // Pickup the repeat interesting attributes
453
- let duration = repeat.duration;
454
- let max = repeat.durationMax;
455
- let unit = repeat.durationUnit;
456
- // Do nothing if no unit, I am not a wizard
457
- if (unit === undefined) return undefined;
408
+ let duration = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "duration");
409
+ let max = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "durationMax");
410
+ let unit = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "durationUnit");
411
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(unit)) return undefined;
458
412
  return [
459
- // duration
460
- duration !== undefined && i18next.t("fields.duration", {
413
+ (0, $3d60081b7152576d$export$e7321bf46d18757f)(duration) && i18next.t("fields.duration", {
461
414
  durationText: i18next.t(`unitsOfTime:withCount.${unit}`, {
462
415
  count: duration
463
416
  })
464
417
  }),
465
- // durationMax
466
- max !== undefined && i18next.t("fields.durationMax", {
418
+ (0, $3d60081b7152576d$export$e7321bf46d18757f)(max) && i18next.t("fields.durationMax", {
467
419
  durationMaxText: i18next.t(`unitsOfTime:withCount.${unit}`, {
468
420
  count: max
469
421
  })
@@ -473,23 +425,18 @@ function $1270a8f06113f53a$export$675ae45fa2875f4a({ dos: dos, i18next: i18next
473
425
 
474
426
 
475
427
 
428
+
476
429
  function $bc43734b944260d2$export$d663412e0c469ce2({ dos: dos, i18next: i18next }) {
477
- let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
478
- // If empty, return undefined
479
- if (repeat === undefined) return undefined;
480
- // Pickup the repeat interesting attributes
481
- let frequency = repeat.frequency;
482
- let max = repeat.frequencyMax;
483
- // Do nothing if no frequency / frequencyMax, I am not a wizard
484
- if (frequency === undefined && max === undefined) return undefined;
485
- // Three cases
430
+ let frequency = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "frequency");
431
+ let max = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "frequencyMax");
432
+ if ((0, $3d60081b7152576d$export$cbff5d1bcc7ff30a)(frequency, max)) return undefined;
486
433
  // 1. Frequency and frequencyMax are present
487
- if (frequency !== undefined && max !== undefined) return i18next.t("fields.frequency.withfrequencyMax", {
434
+ if ((0, $3d60081b7152576d$export$3b3497187fd4cc1a)(frequency, max)) return i18next.t("fields.frequency.withfrequencyMax", {
488
435
  count: max,
489
436
  frequency: frequency
490
437
  });
491
438
  // 2. Only frequencyMax is present
492
- if (max !== undefined) return i18next.t("fields.frequencyMax.frequencyMax", {
439
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(max)) return i18next.t("fields.frequencyMax.frequencyMax", {
493
440
  count: max
494
441
  });
495
442
  // 3. Only frequency is present
@@ -500,19 +447,14 @@ function $bc43734b944260d2$export$d663412e0c469ce2({ dos: dos, i18next: i18next
500
447
 
501
448
 
502
449
 
450
+
503
451
  function $b9825dd9e0a2e687$export$aa31b783699f637({ dos: dos, i18next: i18next }) {
504
- let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
505
- // If empty, return undefined
506
- if (repeat === undefined) return undefined;
507
- // Pickup the repeat interesting attributes
508
- let period = repeat.period;
509
- let max = repeat.periodMax;
510
- let unit = repeat.periodUnit;
511
- // Do nothing if no unit, I am not a wizard
512
- if (unit === undefined) return undefined;
513
- // Three cases
452
+ let period = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "period");
453
+ let max = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "periodMax");
454
+ let unit = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "periodUnit");
455
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(unit)) return undefined;
514
456
  // 1. period and periodMax are present
515
- if (period !== undefined && max !== undefined) return i18next.t("fields.periodMax.withPeriod", {
457
+ if ((0, $3d60081b7152576d$export$3b3497187fd4cc1a)(period, max)) return i18next.t("fields.periodMax.withPeriod", {
516
458
  period: period,
517
459
  count: max,
518
460
  unit: i18next.t(`unitsOfTime:withoutCount.${unit}`, {
@@ -520,7 +462,7 @@ function $b9825dd9e0a2e687$export$aa31b783699f637({ dos: dos, i18next: i18next }
520
462
  })
521
463
  });
522
464
  // 2. Only periodMax is present
523
- if (max !== undefined) return i18next.t("fields.periodMax.onlyPeriodMax", {
465
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(max)) return i18next.t("fields.periodMax.onlyPeriodMax", {
524
466
  count: max,
525
467
  unit: i18next.t(`unitsOfTime:withoutCount.${unit}`, {
526
468
  count: max
@@ -536,16 +478,13 @@ function $b9825dd9e0a2e687$export$aa31b783699f637({ dos: dos, i18next: i18next }
536
478
  }
537
479
 
538
480
 
539
- // Functions
540
481
  const $93b58b7d2ead3b95$var$linkworsdMap = {
541
482
  and: "linkwords.and",
542
483
  then: "linkwords.then"
543
484
  };
544
485
  function $93b58b7d2ead3b95$export$826742c1df3eca39(i18next, arr, linkWord = "and") {
545
- // Split the array into two parts: all entries except the last one, and the last
546
486
  const firstString = arr.slice(0, -1).join(", ");
547
487
  const lastString = arr.slice(-1).join("");
548
- // concatenate the result
549
488
  const linkWordTechnicalKey = $93b58b7d2ead3b95$var$linkworsdMap[linkWord];
550
489
  const linkWordAsString = arr.length > 1 ? ` ${i18next.t(linkWordTechnicalKey)} ` : "";
551
490
  const finalString = firstString + linkWordAsString + lastString;
@@ -555,6 +494,7 @@ function $93b58b7d2ead3b95$export$826742c1df3eca39(i18next, arr, linkWord = "and
555
494
 
556
495
 
557
496
 
497
+
558
498
  // Function to extract times
559
499
  function $7a065f861a4b61f2$var$extractTime(minutes) {
560
500
  let days = Math.floor(minutes / 1440);
@@ -566,67 +506,45 @@ function $7a065f861a4b61f2$var$extractTime(minutes) {
566
506
  minutes: remainingMinutes
567
507
  };
568
508
  }
569
- // Function to transform offset into a string
570
509
  function $7a065f861a4b61f2$var$transformOffset(i18next, offset) {
571
- if (offset === undefined || offset <= 0) return undefined;
572
- // extract days / hours / minutes from it
510
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(offset) || offset <= 0) return undefined;
573
511
  let time = $7a065f861a4b61f2$var$extractTime(offset);
574
- // generate part
575
512
  let subParts = [
576
- // days
577
513
  time.days > 0 ? i18next.t("unitsOfTime:withCount.d", {
578
514
  count: time.days
579
515
  }) : undefined,
580
- // hours
581
516
  time.hours > 0 ? i18next.t("unitsOfTime:withCount.h", {
582
517
  count: time.hours
583
518
  }) : undefined,
584
- // minutes
585
519
  time.minutes > 0 ? i18next.t("unitsOfTime:withCount.min", {
586
520
  count: time.minutes
587
521
  }) : undefined
588
- ].filter((s)=>s !== undefined);
522
+ ].filter((0, $3d60081b7152576d$export$e7321bf46d18757f));
589
523
  return subParts.join(" ");
590
524
  }
591
- // Function to transform when[] into a string
592
525
  function $7a065f861a4b61f2$var$transformWhen(i18next, when) {
593
- // Only run when array is not empty
594
526
  if ((0, $7642ff4865ae4b0f$export$d9ff4a623e416a11)(when)) return undefined;
595
- // Turn it into a string
596
527
  const whens = when.map((whenCode)=>i18next.t(`eventTiming:${whenCode}`));
597
528
  return (0, $93b58b7d2ead3b95$export$826742c1df3eca39)(i18next, whens);
598
529
  }
599
530
  function $7a065f861a4b61f2$export$433fa514f44031f3({ dos: dos, i18next: i18next }) {
600
- let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
601
- // If empty, return undefined
602
- if (repeat === undefined) return undefined;
603
- // Pickup the repeat interesting attributes
604
- let offset = repeat.offset;
605
- let when = repeat.when;
606
- // If both are undefined, don't do anything
607
- if (offset === undefined && when === undefined) return undefined;
531
+ let offset = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "offset");
532
+ let when = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "when");
533
+ if ((0, $3d60081b7152576d$export$cbff5d1bcc7ff30a)(offset, when)) return undefined;
608
534
  return [
609
- // offset part
610
535
  $7a065f861a4b61f2$var$transformOffset(i18next, offset),
611
- // when part
612
536
  $7a065f861a4b61f2$var$transformWhen(i18next, when)
613
- ].filter((s)=>s !== undefined).join(" ");
537
+ ].filter((0, $3d60081b7152576d$export$e7321bf46d18757f)).join(" ");
614
538
  }
615
539
 
616
540
 
617
- // Function
618
541
 
619
542
 
620
543
 
621
544
  function $46f2142e76cf7e45$export$f6325e43097e9543({ dos: dos, i18next: i18next }) {
622
- let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
623
- // If empty, return undefined
624
- if (repeat === undefined) return undefined;
625
- // Pickup the repeat interesting attributes
626
- let dayOfWeek = repeat.dayOfWeek;
545
+ let dayOfWeek = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "dayOfWeek");
627
546
  // If empty, skip it
628
547
  if ((0, $7642ff4865ae4b0f$export$d9ff4a623e416a11)(dayOfWeek)) return undefined;
629
- // Turn it into a string
630
548
  const dayOfWeeks = dayOfWeek.map((dayCode)=>i18next.t(`daysOfWeek:${dayCode}`));
631
549
  const dayOfWeeksAsString = (0, $93b58b7d2ead3b95$export$826742c1df3eca39)(i18next, dayOfWeeks);
632
550
  return i18next.t("fields.dayOfWeek.dayOfWeek", {
@@ -636,7 +554,6 @@ function $46f2142e76cf7e45$export$f6325e43097e9543({ dos: dos, i18next: i18next
636
554
  }
637
555
 
638
556
 
639
- // Functions
640
557
 
641
558
 
642
559
 
@@ -645,19 +562,12 @@ function $46f2142e76cf7e45$export$f6325e43097e9543({ dos: dos, i18next: i18next
645
562
  * There is no date specified. Seconds must be provided due to schema type constraints but may be zero-filled
646
563
  * and may be ignored at receiver discretion
647
564
  */ function $a846209a7dd119d4$var$formatString(time) {
648
- // Split the time string by ":"
649
565
  var parts = time.split(":");
650
- // Check if the last part (seconds) is "00", if so, remove it
651
566
  if (parts.length > 2 && parts[2] === "00") parts.pop();
652
- // Join the remaining parts with ":"
653
567
  return parts.join(":");
654
568
  }
655
569
  function $a846209a7dd119d4$export$ee205fa48981886d({ dos: dos, i18next: i18next }) {
656
- let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
657
- // If empty, return undefined
658
- if (repeat === undefined) return undefined;
659
- // Pickup the repeat interesting attributes
660
- let timeOfDay = repeat.timeOfDay;
570
+ let timeOfDay = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "timeOfDay");
661
571
  // If empty, skip it
662
572
  if ((0, $7642ff4865ae4b0f$export$d9ff4a623e416a11)(timeOfDay)) return undefined;
663
573
  // Turn it into a string
@@ -670,18 +580,17 @@ function $a846209a7dd119d4$export$ee205fa48981886d({ dos: dos, i18next: i18next
670
580
  }
671
581
 
672
582
 
673
- // Function
583
+
674
584
 
675
585
  // Turn a list of codeable concept into a string
676
586
  function $ee04e2a8ed39962f$var$fromCodeableConceptArrayToString(i18next, codes, config) {
677
587
  const codesAsString = codes.map((code)=>config.fromCodeableConceptToString({
678
588
  code: code,
679
589
  language: config.language
680
- })).filter((s)=>s !== undefined);
590
+ })).filter((0, $3d60081b7152576d$export$e7321bf46d18757f));
681
591
  return (0, $93b58b7d2ead3b95$export$826742c1df3eca39)(i18next, codesAsString);
682
592
  }
683
593
  function $ee04e2a8ed39962f$export$5c69a2202525487a({ dos: dos, config: config, i18next: i18next }) {
684
- // Pickup the interesting attributes
685
594
  let asNeededBoolean = dos.asNeededBoolean;
686
595
  let asNeededCodeableConcept = dos.asNeededCodeableConcept;
687
596
  let asNeededFor = dos.asNeededFor;
@@ -693,7 +602,6 @@ function $ee04e2a8ed39962f$export$5c69a2202525487a({ dos: dos, config: config, i
693
602
  if (codeableList.length > 0) return i18next.t("fields.asNeededFor", {
694
603
  reasons: $ee04e2a8ed39962f$var$fromCodeableConceptArrayToString(i18next, codeableList, config)
695
604
  });
696
- // merge boolean to make it simpler
697
605
  let booleanValue = [
698
606
  asNeededBoolean,
699
607
  asNeeded
@@ -702,9 +610,8 @@ function $ee04e2a8ed39962f$export$5c69a2202525487a({ dos: dos, config: config, i
702
610
  }
703
611
 
704
612
 
705
- // Functions
706
613
 
707
- // Duration to string
614
+
708
615
  function $9d632517596957df$var$transformDurationToString(i18next, duration, config) {
709
616
  let quantity = duration.value;
710
617
  // If common units from HL7, do the job
@@ -713,23 +620,17 @@ function $9d632517596957df$var$transformDurationToString(i18next, duration, conf
713
620
  return i18next.t(`unitsOfTime:withCount.${code}`, {
714
621
  count: quantity
715
622
  });
716
- } else {
717
- // otherwise, it is UCUM, ... so let the user do the job
718
- let unit = config.fromFHIRQuantityUnitToString({
719
- language: config.language,
720
- quantity: duration
721
- });
722
- return `${quantity} ${unit}`;
723
623
  }
624
+ // otherwise, it is UCUM, ... so let the user do the job
625
+ let unit = config.fromFHIRQuantityUnitToString({
626
+ language: config.language,
627
+ quantity: duration
628
+ });
629
+ return `${quantity} ${unit}`;
724
630
  }
725
631
  function $9d632517596957df$export$b927a06bc51aea32({ dos: dos, config: config, i18next: i18next }) {
726
- let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
727
- // If empty, return undefined
728
- if (repeat === undefined) return undefined;
729
- // Pickup the repeat interesting attributes
730
- let boundsDuration = repeat.boundsDuration;
731
- // Do nothing if no boundsDuration, I am not a wizard
732
- if (boundsDuration === undefined) return undefined;
632
+ let boundsDuration = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "boundsDuration");
633
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(boundsDuration)) return undefined;
733
634
  let durationText = $9d632517596957df$var$transformDurationToString(i18next, boundsDuration, config);
734
635
  return i18next.t("fields.boundsDuration", {
735
636
  durationText: durationText
@@ -737,26 +638,18 @@ function $9d632517596957df$export$b927a06bc51aea32({ dos: dos, config: config, i
737
638
  }
738
639
 
739
640
 
740
- // types
641
+
741
642
 
742
643
 
743
644
  function $2da391a8a8345a3d$export$8c667cbf7bebaa93({ dos: dos, config: config, i18next: i18next }) {
744
- let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
745
- // If empty, return undefined
746
- if (repeat === undefined) return undefined;
747
- // Pickup the repeat interesting attributes
748
- let boundsRange = repeat.boundsRange;
749
- // Do nothing if no boundsRange, I am not a wizard
750
- if (boundsRange === undefined) return undefined;
751
- // Turn range into a text
645
+ let boundsRange = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "boundsRange");
646
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(boundsRange)) return undefined;
752
647
  const rangeText = (0, $9ee880701f47723b$export$be17d167ed50d870)({
753
648
  range: boundsRange,
754
649
  config: config,
755
650
  i18next: i18next
756
651
  });
757
- // Reject if empty
758
- if (rangeText === undefined) return undefined;
759
- // return the final string
652
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(rangeText)) return undefined;
760
653
  return i18next.t("fields.boundsRange", {
761
654
  rangeText: rangeText
762
655
  });
@@ -764,23 +657,18 @@ function $2da391a8a8345a3d$export$8c667cbf7bebaa93({ dos: dos, config: config, i
764
657
 
765
658
 
766
659
 
660
+
767
661
  function $39470eb799331038$export$498ca7f558a02e67({ dos: dos, i18next: i18next }) {
768
- let repeat = (0, $e8251a88ed398f12$export$1d3efc96e203aa6b)(dos);
769
- // If empty, return undefined
770
- if (repeat === undefined) return undefined;
771
- // Pickup the repeat interesting attributes
772
- let count = repeat.count;
773
- let countMax = repeat.countMax;
774
- // Do nothing if no count, I am not a wizard
775
- if (count === undefined && countMax === undefined) return undefined;
776
- // Three cases
662
+ let count = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "count");
663
+ let countMax = (0, $cc064cd9e69cf2cf$export$59de929dfa9e850b)(dos, "countMax");
664
+ if ((0, $3d60081b7152576d$export$cbff5d1bcc7ff30a)(count, countMax)) return undefined;
777
665
  // 1. Both count & countMax are present
778
- if (count !== undefined && countMax !== undefined) return i18next.t("fields.countMax.countMax", {
666
+ if ((0, $3d60081b7152576d$export$3b3497187fd4cc1a)(count, countMax)) return i18next.t("fields.countMax.countMax", {
779
667
  count: countMax,
780
668
  low: count
781
669
  });
782
670
  // 2. Only countMax is present
783
- if (countMax !== undefined) return i18next.t("fields.count.count", {
671
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(countMax)) return i18next.t("fields.count.count", {
784
672
  count: countMax
785
673
  });
786
674
  // 3. Only count is present
@@ -790,14 +678,13 @@ function $39470eb799331038$export$498ca7f558a02e67({ dos: dos, i18next: i18next
790
678
  }
791
679
 
792
680
 
793
- // Functions
794
681
 
795
- // types
682
+
796
683
  // Function to clean up the params for dateStyle situation
797
684
  // Note: dateStyle and timeStyle can be used with each other,
798
685
  // but not with other date-time component options (e.g. weekday, hour, month, etc.).
799
686
  function $208be5279f5e6c65$var$generateDateStyleFormatOptions(options) {
800
- if (options.dateStyle !== undefined) return {
687
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(options.dateStyle)) return {
801
688
  dateStyle: options.dateStyle
802
689
  };
803
690
  const defaults = {
@@ -812,7 +699,7 @@ function $208be5279f5e6c65$var$generateDateStyleFormatOptions(options) {
812
699
  }
813
700
  // Function to clean up the params for timeStyle situation
814
701
  function $208be5279f5e6c65$var$generateTimeStyleFormatOptions(options) {
815
- if (options.timeStyle !== undefined) return {
702
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(options.timeStyle)) return {
816
703
  timeStyle: options.timeStyle
817
704
  };
818
705
  const defaults = {
@@ -827,11 +714,8 @@ function $208be5279f5e6c65$var$generateTimeStyleFormatOptions(options) {
827
714
  }
828
715
  function $208be5279f5e6c65$export$a77f8869772ffca4({ config: config, datetimes: datetimes }) {
829
716
  let options = config.dateTimeFormatOptions;
830
- // prepare data for algorithm below
831
717
  const entries = datetimes.map((datetime)=>{
832
- // Convert it to date
833
718
  let date = new Date(datetime);
834
- // other properties
835
719
  let hasTimePart = datetime.includes("T");
836
720
  let hyphensCount = datetime.split("-").length - 1;
837
721
  let hasMonths = hyphensCount >= 1;
@@ -863,16 +747,12 @@ function $208be5279f5e6c65$export$a77f8869772ffca4({ config: config, datetimes:
863
747
  // If only year / month and days are defined, print it according
864
748
  if (!hasTimePart) {
865
749
  let df3 = new Intl.DateTimeFormat(config.language, {
866
- // retrieve value from user
867
- // and fallback if dateStyle is not defined
868
750
  ...$208be5279f5e6c65$var$generateDateStyleFormatOptions(options)
869
751
  });
870
752
  return df3.format(date);
871
753
  }
872
754
  // Otherwise, we have a full datetime
873
755
  let df4 = new Intl.DateTimeFormat(config.language, {
874
- // retrieve value from user
875
- // and fallback if dateStyle / timeStyle is not defined
876
756
  ...$208be5279f5e6c65$var$generateDateStyleFormatOptions(options),
877
757
  ...$208be5279f5e6c65$var$generateTimeStyleFormatOptions(options)
878
758
  });
@@ -881,9 +761,7 @@ function $208be5279f5e6c65$export$a77f8869772ffca4({ config: config, datetimes:
881
761
  return result;
882
762
  }
883
763
  function $208be5279f5e6c65$export$4699e913d5b6ffeb({ config: config, datetime: datetime }) {
884
- // Can't do magic ;)
885
- if (datetime === undefined) return undefined;
886
- // Invoke previous function, and pick up the first entry
764
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(datetime)) return undefined;
887
765
  const result = $208be5279f5e6c65$export$a77f8869772ffca4({
888
766
  config: config,
889
767
  datetimes: [
@@ -896,10 +774,8 @@ function $208be5279f5e6c65$export$4699e913d5b6ffeb({ config: config, datetime: d
896
774
 
897
775
 
898
776
  function $3bceb6a4d7bec96e$export$3c2848bc0f0e3783({ dos: dos, config: config, i18next: i18next }) {
899
- // If empty, return undefined
900
777
  let events = dos.timing?.event;
901
778
  if ((0, $7642ff4865ae4b0f$export$d9ff4a623e416a11)(events)) return undefined;
902
- // List to string
903
779
  let eventList = (0, $208be5279f5e6c65$export$a77f8869772ffca4)({
904
780
  config: config,
905
781
  datetimes: events
@@ -912,26 +788,23 @@ function $3bceb6a4d7bec96e$export$3c2848bc0f0e3783({ dos: dos, config: config, i
912
788
  }
913
789
 
914
790
 
915
- // Function
791
+
916
792
 
917
793
 
918
794
  function $6c156f35df44ca41$export$21e3522d6e713036({ dos: dos, config: config, i18next: i18next }) {
919
- // If empty, return undefined
920
795
  if ((0, $7642ff4865ae4b0f$export$d9ff4a623e416a11)(dos.additionalInstruction)) return undefined;
921
- // Turn it into strings
922
796
  let additionalInstructions = dos.additionalInstruction.map((instruction)=>config.fromCodeableConceptToString({
923
797
  code: instruction,
924
798
  language: config.language
925
- })).filter((s)=>s !== undefined);
799
+ })).filter((0, $3d60081b7152576d$export$e7321bf46d18757f));
926
800
  return (0, $93b58b7d2ead3b95$export$826742c1df3eca39)(i18next, additionalInstructions);
927
801
  }
928
802
 
929
803
 
930
- // Functions
804
+
931
805
 
932
806
  function $e021f207f5cc63d0$export$6e78f21a88fc25ea({ dos: dos, config: config, i18next: i18next }) {
933
- // If empty, return undefined
934
- if (dos.maxDosePerLifetime === undefined) return undefined;
807
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(dos.maxDosePerLifetime)) return undefined;
935
808
  const maxDosePerLifetime = dos.maxDosePerLifetime;
936
809
  return i18next.t("fields.maxDosePerLifetime", {
937
810
  quantityText: (0, $6ce94eb09701f53d$export$e9106be159f8c977)({
@@ -943,11 +816,10 @@ function $e021f207f5cc63d0$export$6e78f21a88fc25ea({ dos: dos, config: config, i
943
816
  }
944
817
 
945
818
 
946
- // Functions
819
+
947
820
 
948
821
  function $9ad44f2c84a9bdf4$export$58c8a9e040283a66({ dos: dos, config: config, i18next: i18next }) {
949
- // If empty, return undefined
950
- if (dos.maxDosePerAdministration === undefined) return undefined;
822
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(dos.maxDosePerAdministration)) return undefined;
951
823
  const maxDosePerAdministration = dos.maxDosePerAdministration;
952
824
  return i18next.t("fields.maxDosePerAdministration", {
953
825
  quantityText: (0, $6ce94eb09701f53d$export$e9106be159f8c977)({
@@ -959,11 +831,10 @@ function $9ad44f2c84a9bdf4$export$58c8a9e040283a66({ dos: dos, config: config, i
959
831
  }
960
832
 
961
833
 
962
- // Functions
834
+
963
835
 
964
836
  function $45256d2a188dcbd7$export$75a89431d80a701a({ dos: dos, config: config, i18next: i18next }) {
965
- // If empty, return undefined
966
- if (dos.timing?.repeat?.boundsPeriod === undefined) return undefined;
837
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(dos.timing?.repeat?.boundsPeriod)) return undefined;
967
838
  // Generate the string version of them
968
839
  const boundsPeriod = dos.timing.repeat.boundsPeriod;
969
840
  let start = (0, $208be5279f5e6c65$export$4699e913d5b6ffeb)({
@@ -974,14 +845,13 @@ function $45256d2a188dcbd7$export$75a89431d80a701a({ dos: dos, config: config, i
974
845
  config: config,
975
846
  datetime: boundsPeriod.end
976
847
  });
977
- // Three cases
978
848
  // 1. Both start and end are present
979
- if (start !== undefined && end !== undefined) return i18next.t("fields.boundsPeriod.startAndEnd", {
849
+ if ((0, $3d60081b7152576d$export$3b3497187fd4cc1a)(start, end)) return i18next.t("fields.boundsPeriod.startAndEnd", {
980
850
  start: start,
981
851
  end: end
982
852
  });
983
853
  // 2. Only start is present
984
- if (start !== undefined) return i18next.t("fields.boundsPeriod.onlyStart", {
854
+ if ((0, $3d60081b7152576d$export$e7321bf46d18757f)(start)) return i18next.t("fields.boundsPeriod.onlyStart", {
985
855
  start: start
986
856
  });
987
857
  // 3. Only end is present
@@ -993,12 +863,11 @@ function $45256d2a188dcbd7$export$75a89431d80a701a({ dos: dos, config: config, i
993
863
 
994
864
 
995
865
 
866
+
996
867
  function $39ffdeadc450f558$export$346b11a8cb220f02({ dos: dos, config: config, i18next: i18next }) {
997
- // If empty, return undefined
998
- if (dos.maxDosePerPeriod === undefined) return undefined;
868
+ if (!(0, $3d60081b7152576d$export$e7321bf46d18757f)(dos.maxDosePerPeriod)) return undefined;
999
869
  const maxDosePerPeriod = dos.maxDosePerPeriod;
1000
- // In R4, it was a single object
1001
- // In R5, it is an array
870
+ // In R4, it was a single object / In R5, it is an array
1002
871
  // So better to have a generic approach
1003
872
  const values = Array.isArray(maxDosePerPeriod) ? maxDosePerPeriod : [
1004
873
  maxDosePerPeriod
@@ -1012,7 +881,7 @@ function $39ffdeadc450f558$export$346b11a8cb220f02({ dos: dos, config: config, i
1012
881
  i18next: i18next,
1013
882
  ratio: period
1014
883
  });
1015
- }).filter((s)=>s !== undefined);
884
+ }).filter((0, $3d60081b7152576d$export$e7321bf46d18757f));
1016
885
  const maxDosePerPeriodText = (0, $93b58b7d2ead3b95$export$826742c1df3eca39)(i18next, valuesAsString);
1017
886
  return i18next.t("fields.maxDosePerPeriod", {
1018
887
  count: values.length,
@@ -1023,7 +892,7 @@ function $39ffdeadc450f558$export$346b11a8cb220f02({ dos: dos, config: config, i
1023
892
 
1024
893
 
1025
894
 
1026
- // Map
895
+
1027
896
  const $2c21ace90ecdbde6$var$displayOrders = {
1028
897
  additionalInstruction: (input)=>(0, $6c156f35df44ca41$export$21e3522d6e713036)(input),
1029
898
  asNeeded: (input)=>(0, $ee04e2a8ed39962f$export$5c69a2202525487a)(input),
@@ -1049,7 +918,7 @@ const $2c21ace90ecdbde6$var$displayOrders = {
1049
918
  let subParts = [
1050
919
  (0, $bc43734b944260d2$export$d663412e0c469ce2)(input),
1051
920
  (0, $b9825dd9e0a2e687$export$aa31b783699f637)(input)
1052
- ].filter((s)=>s !== undefined);
921
+ ].filter((0, $3d60081b7152576d$export$e7321bf46d18757f));
1053
922
  return subParts.length > 0 ? subParts.join(" ") : undefined;
1054
923
  },
1055
924
  maxDosePerAdministration: (input)=>(0, $9ad44f2c84a9bdf4$export$58c8a9e040283a66)(input),
@@ -1093,18 +962,17 @@ const $2c21ace90ecdbde6$var$displayOrders = {
1093
962
  })
1094
963
  };
1095
964
  function $2c21ace90ecdbde6$export$9f330b4bf8c0975c({ entry: entry, ...args }) {
1096
- // Use map to provide a result without iterate on each key
1097
965
  return $2c21ace90ecdbde6$var$displayOrders[entry](args);
1098
966
  }
1099
967
 
1100
968
 
1101
969
 
1102
970
 
971
+
1103
972
  const $74b0cf9d3dbd5b46$var$defaultI18NConfig = {
1104
973
  backend: {
1105
974
  backends: [
1106
- (0, ($parcel$interopDefault($8zHUo$i18nextresourcestobackend)))(// have to cast the function to be webpack / builder friendly
1107
- async (lng, ns)=>import(`./locales/${lng}/${ns}.json`))
975
+ (0, ($parcel$interopDefault($8zHUo$i18nextresourcestobackend)))(async (lng, ns)=>import(`./locales/${lng}/${ns}.json`))
1108
976
  ]
1109
977
  }
1110
978
  };
@@ -1119,35 +987,22 @@ class $74b0cf9d3dbd5b46$export$1c191bca55f84a03 extends (0, $868b4eaa4f62b9f7$ex
1119
987
  /**
1120
988
  * Does this array of Dosage objects contains only "sequential" instructions ?
1121
989
  */ containsOnlySequentialInstructions(dosages) {
1122
- // 1. Collect all sequences number
1123
- let sequencesNumbers = dosages.map((d)=>d.sequence).filter((s)=>s !== undefined);
1124
- // 2. Convert it to a Set
990
+ let sequencesNumbers = dosages.map((d)=>d.sequence).filter((0, $3d60081b7152576d$export$e7321bf46d18757f));
1125
991
  let encounteredSequenceNumbers = new Set(sequencesNumbers);
1126
- // 3. We have a "sequential" situation in two cases
1127
- // A) No sequence number were provided
1128
- // B) All sequence numbers are different
1129
992
  return encounteredSequenceNumbers.size === 0 || encounteredSequenceNumbers.size === dosages.length;
1130
993
  }
1131
994
  /**
1132
995
  * Turn this array of Dosage objects into a data structure useful to handle "sequential" and "concurrent" instructions (cf. "sequence" property).
1133
996
  * @returns {Dosage[][]} - A two-dimensional array where each inner array contains Dosage objects belonging to the same sequence numberr.
1134
997
  */ groupBySequence(dosages) {
1135
- // Prepare variables
1136
998
  let groups = {};
1137
999
  let sequences = new Set();
1138
1000
  for(let idx = 0; idx < dosages.length; idx++){
1139
- // Get dosage object
1140
1001
  const dosage = dosages[idx];
1141
- // Get the sequence number (normally, in real world, it should be present in this case)
1142
- // If no sequence number, assume it is idx + 1
1143
1002
  let sequenceNr = dosage.sequence || idx + 1;
1144
- // Retrieve of create previous entries for this sequence number
1145
1003
  let localGroup = groups[sequenceNr] || [];
1146
- // Add entry
1147
1004
  localGroup.push(dosage);
1148
- // Pushback result
1149
1005
  groups[sequenceNr] = localGroup;
1150
- // For reminder of the parsed sequence
1151
1006
  sequences.add(sequenceNr);
1152
1007
  }
1153
1008
  // By using the Set values, we are sure it is returned in the way Dosages were written
@@ -1162,20 +1017,17 @@ class $74b0cf9d3dbd5b46$export$1c191bca55f84a03 extends (0, $868b4eaa4f62b9f7$ex
1162
1017
  * From a single dosage, extract specific field(s) requested by user.
1163
1018
  * Some use cases could request to split part of the object for given needs (quantity and timing separately)
1164
1019
  */ getFields(dos, ...order) {
1165
- // iterate on each key and generate a string from each part
1166
1020
  let parts = order.map((entry)=>(0, $2c21ace90ecdbde6$export$9f330b4bf8c0975c)({
1167
1021
  config: this.config,
1168
1022
  dos: dos,
1169
1023
  entry: entry,
1170
1024
  i18next: this.i18nInstance
1171
- })).filter((s)=>s !== undefined);
1172
- // Join each part with a separator
1025
+ })).filter((0, $3d60081b7152576d$export$e7321bf46d18757f));
1173
1026
  return parts.join(this.config.displaySeparator);
1174
1027
  }
1175
1028
  /**
1176
1029
  * Turn a FHIR Dosage object into text
1177
1030
  */ fromDosageToText(dos) {
1178
- // iterate on each key and generate a string from each part
1179
1031
  let order = this.config.displayOrder;
1180
1032
  return this.getFields(dos, ...order);
1181
1033
  }