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