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