@openfn/language-fhir-4 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +119 -12
- package/dist/index.js +118 -12
- package/package.json +5 -5
- package/types/builders.d.ts +27 -11
- package/types/index.d.ts +1 -0
- package/types/values.d.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ __export(src_exports, {
|
|
|
32
32
|
cursor: () => import_language_common3.cursor,
|
|
33
33
|
dataPath: () => import_language_common3.dataPath,
|
|
34
34
|
dataValue: () => import_language_common3.dataValue,
|
|
35
|
+
datatypes: () => datatypes_exports,
|
|
35
36
|
dateFns: () => import_language_common3.dateFns,
|
|
36
37
|
default: () => src_default,
|
|
37
38
|
delete: () => _delete,
|
|
@@ -368,6 +369,7 @@ __export(builders_exports, {
|
|
|
368
369
|
explanationOfBenefit: () => explanationOfBenefit,
|
|
369
370
|
ext: () => ext,
|
|
370
371
|
extendSystemMap: () => extendSystemMap,
|
|
372
|
+
extendValues: () => extendValues,
|
|
371
373
|
extension: () => extension,
|
|
372
374
|
familyMemberHistory: () => familyMemberHistory,
|
|
373
375
|
findExtension: () => findExtension,
|
|
@@ -388,8 +390,10 @@ __export(builders_exports, {
|
|
|
388
390
|
library: () => library,
|
|
389
391
|
list: () => list,
|
|
390
392
|
location: () => location,
|
|
393
|
+
lookupValue: () => lookupValue,
|
|
391
394
|
manufacturedItemDefinition: () => manufacturedItemDefinition,
|
|
392
395
|
mapSystems: () => mapSystems,
|
|
396
|
+
mapValues: () => mapValues,
|
|
393
397
|
measure: () => measure,
|
|
394
398
|
measureReport: () => measureReport,
|
|
395
399
|
media: () => media,
|
|
@@ -431,6 +435,7 @@ __export(builders_exports, {
|
|
|
431
435
|
schedule: () => schedule,
|
|
432
436
|
serviceRequest: () => serviceRequest,
|
|
433
437
|
setSystemMap: () => setSystemMap,
|
|
438
|
+
setValues: () => setValues,
|
|
434
439
|
slot: () => slot,
|
|
435
440
|
specimen: () => specimen,
|
|
436
441
|
specimenDefinition: () => specimenDefinition,
|
|
@@ -449,9 +454,60 @@ __export(builders_exports, {
|
|
|
449
454
|
var import_lodash2 = __toESM(require("lodash"), 1);
|
|
450
455
|
|
|
451
456
|
// src/datatypes.ts
|
|
457
|
+
var datatypes_exports = {};
|
|
458
|
+
__export(datatypes_exports, {
|
|
459
|
+
addExtension: () => addExtension,
|
|
460
|
+
c: () => c,
|
|
461
|
+
cc: () => cc,
|
|
462
|
+
coding: () => coding,
|
|
463
|
+
composite: () => composite,
|
|
464
|
+
concept: () => concept,
|
|
465
|
+
ext: () => ext,
|
|
466
|
+
extendSystemMap: () => extendSystemMap,
|
|
467
|
+
extendValues: () => extendValues,
|
|
468
|
+
extension: () => extension,
|
|
469
|
+
findExtension: () => findExtension,
|
|
470
|
+
id: () => id,
|
|
471
|
+
identifier: () => identifier,
|
|
472
|
+
lookupValue: () => lookupValue,
|
|
473
|
+
mapSystems: () => mapSystems,
|
|
474
|
+
mapValues: () => mapValues,
|
|
475
|
+
ref: () => ref,
|
|
476
|
+
reference: () => reference,
|
|
477
|
+
setSystemMap: () => setSystemMap,
|
|
478
|
+
setValues: () => setValues,
|
|
479
|
+
value: () => value
|
|
480
|
+
});
|
|
452
481
|
var import_lodash = __toESM(require("lodash"), 1);
|
|
453
482
|
var systemMap = {};
|
|
454
483
|
var datetimeregex = /^([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?$/;
|
|
484
|
+
var defaultValues = {};
|
|
485
|
+
var userValues = {};
|
|
486
|
+
var setValues = (url, values, type = "user") => {
|
|
487
|
+
if (type === "default") {
|
|
488
|
+
defaultValues[url] ?? (defaultValues[url] = {});
|
|
489
|
+
defaultValues[url] = values;
|
|
490
|
+
} else {
|
|
491
|
+
userValues[url] ?? (userValues[url] = {});
|
|
492
|
+
userValues[url] = values;
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
var extendValues = (url, values, type = "user") => {
|
|
496
|
+
if (type === "default") {
|
|
497
|
+
defaultValues[url] ?? (defaultValues[url] = {});
|
|
498
|
+
Object.assign(defaultValues[url], values);
|
|
499
|
+
} else {
|
|
500
|
+
userValues[url] ?? (userValues[url] = {});
|
|
501
|
+
Object.assign(userValues[url], values);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
var lookupValue = (url, code) => {
|
|
505
|
+
var _a, _b;
|
|
506
|
+
let value2;
|
|
507
|
+
value2 = ((_a = userValues[url]) == null ? void 0 : _a[code]) ?? code;
|
|
508
|
+
value2 = ((_b = defaultValues[url]) == null ? void 0 : _b[value2]) ?? value2;
|
|
509
|
+
return value2;
|
|
510
|
+
};
|
|
455
511
|
var mapSystems = (obj) => {
|
|
456
512
|
if (Array.isArray(obj)) {
|
|
457
513
|
return obj.map(mapSystems);
|
|
@@ -464,6 +520,13 @@ var mapSystems = (obj) => {
|
|
|
464
520
|
}
|
|
465
521
|
return obj;
|
|
466
522
|
};
|
|
523
|
+
var mapValues = (obj, hints) => {
|
|
524
|
+
const newObj = { ...obj };
|
|
525
|
+
for (const key in obj) {
|
|
526
|
+
newObj[key] = key in hints ? lookupValue(hints[key], obj[key]) : newObj[key];
|
|
527
|
+
}
|
|
528
|
+
return newObj;
|
|
529
|
+
};
|
|
467
530
|
var setSystemMap = (newMappings) => (state) => {
|
|
468
531
|
systemMap = newMappings;
|
|
469
532
|
return state;
|
|
@@ -471,20 +534,19 @@ var setSystemMap = (newMappings) => (state) => {
|
|
|
471
534
|
var extendSystemMap = (newMappings) => {
|
|
472
535
|
Object.assign(systemMap, newMappings);
|
|
473
536
|
};
|
|
474
|
-
var identifier = (id2,
|
|
537
|
+
var identifier = (id2, ext2 = [], valueHints = {}) => {
|
|
475
538
|
if (Array.isArray(id2)) {
|
|
476
|
-
return id2.map((i2) => identifier(i2));
|
|
539
|
+
return id2.map((i2) => identifier(i2, ext2, valueHints));
|
|
477
540
|
}
|
|
478
|
-
const i =
|
|
541
|
+
const i = mapValues(id2, valueHints);
|
|
479
542
|
if (typeof id2 === "string") {
|
|
480
543
|
i.value = id2;
|
|
481
544
|
} else {
|
|
482
|
-
if (
|
|
483
|
-
|
|
545
|
+
if (i.type) {
|
|
546
|
+
i.type = concept(i.type);
|
|
484
547
|
}
|
|
485
|
-
Object.assign(i, id2);
|
|
486
548
|
}
|
|
487
|
-
ext2.forEach((e) => {
|
|
549
|
+
ext2 == null ? void 0 : ext2.forEach((e) => {
|
|
488
550
|
addExtension(i, e.url, e.value);
|
|
489
551
|
});
|
|
490
552
|
return mapSystems(i);
|
|
@@ -514,11 +576,20 @@ var findExtension = (obj, targetUrl, path) => {
|
|
|
514
576
|
}
|
|
515
577
|
return result;
|
|
516
578
|
};
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
579
|
+
function coding(code, system, extra = {}) {
|
|
580
|
+
if (arguments.length === 1) {
|
|
581
|
+
if (Array.isArray(arguments[0])) {
|
|
582
|
+
const [code2, system2, extra2] = arguments[0];
|
|
583
|
+
return coding(code2, system2, extra2);
|
|
584
|
+
}
|
|
585
|
+
return mapSystems(arguments[0]);
|
|
586
|
+
}
|
|
587
|
+
return mapSystems({
|
|
588
|
+
code,
|
|
589
|
+
system,
|
|
590
|
+
...extra
|
|
591
|
+
});
|
|
592
|
+
}
|
|
522
593
|
var c = coding;
|
|
523
594
|
var value = (value2, system, ...extra) => mapSystems({
|
|
524
595
|
value: value2,
|
|
@@ -3185,6 +3256,13 @@ function Encounter_default(props) {
|
|
|
3185
3256
|
resource.statusHistory.push(_statusHistory);
|
|
3186
3257
|
}
|
|
3187
3258
|
}
|
|
3259
|
+
if (!import_lodash33.default.isNil(props.class)) {
|
|
3260
|
+
let src = props.class;
|
|
3261
|
+
if (typeof src === "string") {
|
|
3262
|
+
src = lookupValue("http://terminology.hl7.org/ValueSet/v3-ActEncounterCode", src);
|
|
3263
|
+
}
|
|
3264
|
+
resource.class = coding(src);
|
|
3265
|
+
}
|
|
3188
3266
|
if (!import_lodash33.default.isNil(props.classHistory)) {
|
|
3189
3267
|
let src = props.classHistory;
|
|
3190
3268
|
if (!Array.isArray(src)) {
|
|
@@ -4273,6 +4351,13 @@ function ImagingStudy_default(props) {
|
|
|
4273
4351
|
}
|
|
4274
4352
|
resource.identifier = identifier(props.identifier);
|
|
4275
4353
|
}
|
|
4354
|
+
if (!import_lodash48.default.isNil(props.modality)) {
|
|
4355
|
+
let src = props.modality;
|
|
4356
|
+
if (typeof src === "string") {
|
|
4357
|
+
src = lookupValue("http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_29.html", src);
|
|
4358
|
+
}
|
|
4359
|
+
resource.modality = coding(src);
|
|
4360
|
+
}
|
|
4276
4361
|
if (!import_lodash48.default.isNil(props.subject)) {
|
|
4277
4362
|
resource.subject = reference(props.subject);
|
|
4278
4363
|
}
|
|
@@ -4831,6 +4916,13 @@ function Location_default(props) {
|
|
|
4831
4916
|
}
|
|
4832
4917
|
resource.identifier = identifier(props.identifier);
|
|
4833
4918
|
}
|
|
4919
|
+
if (!import_lodash57.default.isNil(props.operationalStatus)) {
|
|
4920
|
+
let src = props.operationalStatus;
|
|
4921
|
+
if (typeof src === "string") {
|
|
4922
|
+
src = lookupValue("http://terminology.hl7.org/ValueSet/v2-0116", src);
|
|
4923
|
+
}
|
|
4924
|
+
resource.operationalStatus = coding(src);
|
|
4925
|
+
}
|
|
4834
4926
|
if (!import_lodash57.default.isNil(props.type)) {
|
|
4835
4927
|
if (!Array.isArray(props.type)) {
|
|
4836
4928
|
props.type = [props.type];
|
|
@@ -5805,6 +5897,13 @@ function MedicinalProductDefinition_default(props) {
|
|
|
5805
5897
|
}
|
|
5806
5898
|
resource.clinicalTrial = reference(props.clinicalTrial);
|
|
5807
5899
|
}
|
|
5900
|
+
if (!import_lodash68.default.isNil(props.code)) {
|
|
5901
|
+
let src = props.code;
|
|
5902
|
+
if (typeof src === "string") {
|
|
5903
|
+
src = lookupValue("http://hl7.org/fhir/ValueSet/medication-codes", src);
|
|
5904
|
+
}
|
|
5905
|
+
resource.code = coding(src);
|
|
5906
|
+
}
|
|
5808
5907
|
if (!import_lodash68.default.isNil(props.name)) {
|
|
5809
5908
|
let src = props.name;
|
|
5810
5909
|
if (!Array.isArray(src)) {
|
|
@@ -6971,6 +7070,13 @@ function Questionnaire_default(props) {
|
|
|
6971
7070
|
}
|
|
6972
7071
|
resource.jurisdiction = concept(props.jurisdiction);
|
|
6973
7072
|
}
|
|
7073
|
+
if (!import_lodash85.default.isNil(props.code)) {
|
|
7074
|
+
let src = props.code;
|
|
7075
|
+
if (typeof src === "string") {
|
|
7076
|
+
src = lookupValue("http://hl7.org/fhir/ValueSet/questionnaire-questions", src);
|
|
7077
|
+
}
|
|
7078
|
+
resource.code = coding(src);
|
|
7079
|
+
}
|
|
6974
7080
|
if (!import_lodash85.default.isNil(props.item)) {
|
|
6975
7081
|
let src = props.item;
|
|
6976
7082
|
if (!Array.isArray(src)) {
|
|
@@ -9822,6 +9928,7 @@ var src_default = Adaptor_exports;
|
|
|
9822
9928
|
cursor,
|
|
9823
9929
|
dataPath,
|
|
9824
9930
|
dataValue,
|
|
9931
|
+
datatypes,
|
|
9825
9932
|
dateFns,
|
|
9826
9933
|
delete: null,
|
|
9827
9934
|
each,
|
package/dist/index.js
CHANGED
|
@@ -340,6 +340,7 @@ __export(builders_exports, {
|
|
|
340
340
|
explanationOfBenefit: () => explanationOfBenefit,
|
|
341
341
|
ext: () => ext,
|
|
342
342
|
extendSystemMap: () => extendSystemMap,
|
|
343
|
+
extendValues: () => extendValues,
|
|
343
344
|
extension: () => extension,
|
|
344
345
|
familyMemberHistory: () => familyMemberHistory,
|
|
345
346
|
findExtension: () => findExtension,
|
|
@@ -360,8 +361,10 @@ __export(builders_exports, {
|
|
|
360
361
|
library: () => library,
|
|
361
362
|
list: () => list,
|
|
362
363
|
location: () => location,
|
|
364
|
+
lookupValue: () => lookupValue,
|
|
363
365
|
manufacturedItemDefinition: () => manufacturedItemDefinition,
|
|
364
366
|
mapSystems: () => mapSystems,
|
|
367
|
+
mapValues: () => mapValues,
|
|
365
368
|
measure: () => measure,
|
|
366
369
|
measureReport: () => measureReport,
|
|
367
370
|
media: () => media,
|
|
@@ -403,6 +406,7 @@ __export(builders_exports, {
|
|
|
403
406
|
schedule: () => schedule,
|
|
404
407
|
serviceRequest: () => serviceRequest,
|
|
405
408
|
setSystemMap: () => setSystemMap,
|
|
409
|
+
setValues: () => setValues,
|
|
406
410
|
slot: () => slot,
|
|
407
411
|
specimen: () => specimen,
|
|
408
412
|
specimenDefinition: () => specimenDefinition,
|
|
@@ -421,9 +425,60 @@ __export(builders_exports, {
|
|
|
421
425
|
import _2 from "lodash";
|
|
422
426
|
|
|
423
427
|
// src/datatypes.ts
|
|
428
|
+
var datatypes_exports = {};
|
|
429
|
+
__export(datatypes_exports, {
|
|
430
|
+
addExtension: () => addExtension,
|
|
431
|
+
c: () => c,
|
|
432
|
+
cc: () => cc,
|
|
433
|
+
coding: () => coding,
|
|
434
|
+
composite: () => composite,
|
|
435
|
+
concept: () => concept,
|
|
436
|
+
ext: () => ext,
|
|
437
|
+
extendSystemMap: () => extendSystemMap,
|
|
438
|
+
extendValues: () => extendValues,
|
|
439
|
+
extension: () => extension,
|
|
440
|
+
findExtension: () => findExtension,
|
|
441
|
+
id: () => id,
|
|
442
|
+
identifier: () => identifier,
|
|
443
|
+
lookupValue: () => lookupValue,
|
|
444
|
+
mapSystems: () => mapSystems,
|
|
445
|
+
mapValues: () => mapValues,
|
|
446
|
+
ref: () => ref,
|
|
447
|
+
reference: () => reference,
|
|
448
|
+
setSystemMap: () => setSystemMap,
|
|
449
|
+
setValues: () => setValues,
|
|
450
|
+
value: () => value
|
|
451
|
+
});
|
|
424
452
|
import _ from "lodash";
|
|
425
453
|
var systemMap = {};
|
|
426
454
|
var datetimeregex = /^([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?$/;
|
|
455
|
+
var defaultValues = {};
|
|
456
|
+
var userValues = {};
|
|
457
|
+
var setValues = (url, values, type = "user") => {
|
|
458
|
+
if (type === "default") {
|
|
459
|
+
defaultValues[url] ?? (defaultValues[url] = {});
|
|
460
|
+
defaultValues[url] = values;
|
|
461
|
+
} else {
|
|
462
|
+
userValues[url] ?? (userValues[url] = {});
|
|
463
|
+
userValues[url] = values;
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
var extendValues = (url, values, type = "user") => {
|
|
467
|
+
if (type === "default") {
|
|
468
|
+
defaultValues[url] ?? (defaultValues[url] = {});
|
|
469
|
+
Object.assign(defaultValues[url], values);
|
|
470
|
+
} else {
|
|
471
|
+
userValues[url] ?? (userValues[url] = {});
|
|
472
|
+
Object.assign(userValues[url], values);
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
var lookupValue = (url, code) => {
|
|
476
|
+
var _a, _b;
|
|
477
|
+
let value2;
|
|
478
|
+
value2 = ((_a = userValues[url]) == null ? void 0 : _a[code]) ?? code;
|
|
479
|
+
value2 = ((_b = defaultValues[url]) == null ? void 0 : _b[value2]) ?? value2;
|
|
480
|
+
return value2;
|
|
481
|
+
};
|
|
427
482
|
var mapSystems = (obj) => {
|
|
428
483
|
if (Array.isArray(obj)) {
|
|
429
484
|
return obj.map(mapSystems);
|
|
@@ -436,6 +491,13 @@ var mapSystems = (obj) => {
|
|
|
436
491
|
}
|
|
437
492
|
return obj;
|
|
438
493
|
};
|
|
494
|
+
var mapValues = (obj, hints) => {
|
|
495
|
+
const newObj = { ...obj };
|
|
496
|
+
for (const key in obj) {
|
|
497
|
+
newObj[key] = key in hints ? lookupValue(hints[key], obj[key]) : newObj[key];
|
|
498
|
+
}
|
|
499
|
+
return newObj;
|
|
500
|
+
};
|
|
439
501
|
var setSystemMap = (newMappings) => (state) => {
|
|
440
502
|
systemMap = newMappings;
|
|
441
503
|
return state;
|
|
@@ -443,20 +505,19 @@ var setSystemMap = (newMappings) => (state) => {
|
|
|
443
505
|
var extendSystemMap = (newMappings) => {
|
|
444
506
|
Object.assign(systemMap, newMappings);
|
|
445
507
|
};
|
|
446
|
-
var identifier = (id2,
|
|
508
|
+
var identifier = (id2, ext2 = [], valueHints = {}) => {
|
|
447
509
|
if (Array.isArray(id2)) {
|
|
448
|
-
return id2.map((i2) => identifier(i2));
|
|
510
|
+
return id2.map((i2) => identifier(i2, ext2, valueHints));
|
|
449
511
|
}
|
|
450
|
-
const i =
|
|
512
|
+
const i = mapValues(id2, valueHints);
|
|
451
513
|
if (typeof id2 === "string") {
|
|
452
514
|
i.value = id2;
|
|
453
515
|
} else {
|
|
454
|
-
if (
|
|
455
|
-
|
|
516
|
+
if (i.type) {
|
|
517
|
+
i.type = concept(i.type);
|
|
456
518
|
}
|
|
457
|
-
Object.assign(i, id2);
|
|
458
519
|
}
|
|
459
|
-
ext2.forEach((e) => {
|
|
520
|
+
ext2 == null ? void 0 : ext2.forEach((e) => {
|
|
460
521
|
addExtension(i, e.url, e.value);
|
|
461
522
|
});
|
|
462
523
|
return mapSystems(i);
|
|
@@ -486,11 +547,20 @@ var findExtension = (obj, targetUrl, path) => {
|
|
|
486
547
|
}
|
|
487
548
|
return result;
|
|
488
549
|
};
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
550
|
+
function coding(code, system, extra = {}) {
|
|
551
|
+
if (arguments.length === 1) {
|
|
552
|
+
if (Array.isArray(arguments[0])) {
|
|
553
|
+
const [code2, system2, extra2] = arguments[0];
|
|
554
|
+
return coding(code2, system2, extra2);
|
|
555
|
+
}
|
|
556
|
+
return mapSystems(arguments[0]);
|
|
557
|
+
}
|
|
558
|
+
return mapSystems({
|
|
559
|
+
code,
|
|
560
|
+
system,
|
|
561
|
+
...extra
|
|
562
|
+
});
|
|
563
|
+
}
|
|
494
564
|
var c = coding;
|
|
495
565
|
var value = (value2, system, ...extra) => mapSystems({
|
|
496
566
|
value: value2,
|
|
@@ -3157,6 +3227,13 @@ function Encounter_default(props) {
|
|
|
3157
3227
|
resource.statusHistory.push(_statusHistory);
|
|
3158
3228
|
}
|
|
3159
3229
|
}
|
|
3230
|
+
if (!_33.isNil(props.class)) {
|
|
3231
|
+
let src = props.class;
|
|
3232
|
+
if (typeof src === "string") {
|
|
3233
|
+
src = lookupValue("http://terminology.hl7.org/ValueSet/v3-ActEncounterCode", src);
|
|
3234
|
+
}
|
|
3235
|
+
resource.class = coding(src);
|
|
3236
|
+
}
|
|
3160
3237
|
if (!_33.isNil(props.classHistory)) {
|
|
3161
3238
|
let src = props.classHistory;
|
|
3162
3239
|
if (!Array.isArray(src)) {
|
|
@@ -4245,6 +4322,13 @@ function ImagingStudy_default(props) {
|
|
|
4245
4322
|
}
|
|
4246
4323
|
resource.identifier = identifier(props.identifier);
|
|
4247
4324
|
}
|
|
4325
|
+
if (!_48.isNil(props.modality)) {
|
|
4326
|
+
let src = props.modality;
|
|
4327
|
+
if (typeof src === "string") {
|
|
4328
|
+
src = lookupValue("http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_29.html", src);
|
|
4329
|
+
}
|
|
4330
|
+
resource.modality = coding(src);
|
|
4331
|
+
}
|
|
4248
4332
|
if (!_48.isNil(props.subject)) {
|
|
4249
4333
|
resource.subject = reference(props.subject);
|
|
4250
4334
|
}
|
|
@@ -4803,6 +4887,13 @@ function Location_default(props) {
|
|
|
4803
4887
|
}
|
|
4804
4888
|
resource.identifier = identifier(props.identifier);
|
|
4805
4889
|
}
|
|
4890
|
+
if (!_57.isNil(props.operationalStatus)) {
|
|
4891
|
+
let src = props.operationalStatus;
|
|
4892
|
+
if (typeof src === "string") {
|
|
4893
|
+
src = lookupValue("http://terminology.hl7.org/ValueSet/v2-0116", src);
|
|
4894
|
+
}
|
|
4895
|
+
resource.operationalStatus = coding(src);
|
|
4896
|
+
}
|
|
4806
4897
|
if (!_57.isNil(props.type)) {
|
|
4807
4898
|
if (!Array.isArray(props.type)) {
|
|
4808
4899
|
props.type = [props.type];
|
|
@@ -5777,6 +5868,13 @@ function MedicinalProductDefinition_default(props) {
|
|
|
5777
5868
|
}
|
|
5778
5869
|
resource.clinicalTrial = reference(props.clinicalTrial);
|
|
5779
5870
|
}
|
|
5871
|
+
if (!_68.isNil(props.code)) {
|
|
5872
|
+
let src = props.code;
|
|
5873
|
+
if (typeof src === "string") {
|
|
5874
|
+
src = lookupValue("http://hl7.org/fhir/ValueSet/medication-codes", src);
|
|
5875
|
+
}
|
|
5876
|
+
resource.code = coding(src);
|
|
5877
|
+
}
|
|
5780
5878
|
if (!_68.isNil(props.name)) {
|
|
5781
5879
|
let src = props.name;
|
|
5782
5880
|
if (!Array.isArray(src)) {
|
|
@@ -6943,6 +7041,13 @@ function Questionnaire_default(props) {
|
|
|
6943
7041
|
}
|
|
6944
7042
|
resource.jurisdiction = concept(props.jurisdiction);
|
|
6945
7043
|
}
|
|
7044
|
+
if (!_85.isNil(props.code)) {
|
|
7045
|
+
let src = props.code;
|
|
7046
|
+
if (typeof src === "string") {
|
|
7047
|
+
src = lookupValue("http://hl7.org/fhir/ValueSet/questionnaire-questions", src);
|
|
7048
|
+
}
|
|
7049
|
+
resource.code = coding(src);
|
|
7050
|
+
}
|
|
6946
7051
|
if (!_85.isNil(props.item)) {
|
|
6947
7052
|
let src = props.item;
|
|
6948
7053
|
if (!Array.isArray(src)) {
|
|
@@ -9793,6 +9898,7 @@ export {
|
|
|
9793
9898
|
cursor,
|
|
9794
9899
|
dataPath,
|
|
9795
9900
|
dataValue,
|
|
9901
|
+
datatypes_exports as datatypes,
|
|
9796
9902
|
dateFns,
|
|
9797
9903
|
src_default as default,
|
|
9798
9904
|
_delete as delete,
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-fhir-4",
|
|
3
3
|
"label": "FHIR r4",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.9",
|
|
5
5
|
"description": "OpenFn FHIR r4 adaptor",
|
|
6
6
|
"author": "Open Function Group",
|
|
7
7
|
"license": "LGPLv3",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"fhir": {
|
|
10
10
|
"specUrl": "https://hl7.org/fhir/R4B/definitions.json.zip",
|
|
11
|
-
"adaptorGeneratedDate": "2026-02-
|
|
12
|
-
"generatorVersion": "0.
|
|
11
|
+
"adaptorGeneratedDate": "2026-02-19T17:52:48.093Z",
|
|
12
|
+
"generatorVersion": "0.6.0",
|
|
13
13
|
"options": {
|
|
14
14
|
"simpleBuilders": true
|
|
15
15
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"fhir": "^4.12.0",
|
|
21
21
|
"swc-loader": "^0.2.6",
|
|
22
22
|
"tsx": "^4.19.2",
|
|
23
|
-
"@openfn/language-common": "3.2.
|
|
23
|
+
"@openfn/language-common": "3.2.3"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/mocha": "^10.0.10",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"rimraf": "3.0.2",
|
|
32
32
|
"ts-node": "10.9.1",
|
|
33
33
|
"typescript": "5.9.2",
|
|
34
|
-
"undici": "^
|
|
34
|
+
"undici": "^7.19.2"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
package/types/builders.d.ts
CHANGED
|
@@ -381,7 +381,7 @@ interface ElementDefinition {
|
|
|
381
381
|
valueSet: any;
|
|
382
382
|
};
|
|
383
383
|
/** Corresponding codes in terminologies */
|
|
384
|
-
code?: Coding;
|
|
384
|
+
code?: Coding[];
|
|
385
385
|
/** Comments about the use of this element */
|
|
386
386
|
comment?: markdown;
|
|
387
387
|
/** Reference to invariant about presence */
|
|
@@ -502,7 +502,7 @@ interface ElementDefinition {
|
|
|
502
502
|
/** Value must have at least these property values */
|
|
503
503
|
pattern?: base64Binary | boolean | any | string | string | string | number | string | string | number | markdown | oid | number | string | string | number | string | url | uuid | Address | Age | Annotation | Attachment | (string[] | CodeableConcept) | CodeableReference | Coding | ContactPoint | Count | Distance | Duration | HumanName | (string | Identifier) | Money | Period | Quantity | Range | Ratio | RatioRange | (string | Reference) | SampledData | Signature | Timing | ContactDetail | Contributor | DataRequirement | Expression | ParameterDefinition | RelatedArtifact | TriggerDefinition | UsageContext | Dosage;
|
|
504
504
|
/** xmlAttr | xmlText | typeAttr | cdaText | xhtml */
|
|
505
|
-
representation?: string;
|
|
505
|
+
representation?: string[];
|
|
506
506
|
/** Why this resource has been created */
|
|
507
507
|
requirements?: markdown;
|
|
508
508
|
/** Concise definition for space-constrained presentation */
|
|
@@ -654,11 +654,11 @@ interface Meta {
|
|
|
654
654
|
/** Profiles this resource claims to conform to */
|
|
655
655
|
profile?: any[];
|
|
656
656
|
/** Security Labels applied to this resource */
|
|
657
|
-
security?: Coding;
|
|
657
|
+
security?: Coding[];
|
|
658
658
|
/** Identifies where the resource comes from */
|
|
659
659
|
source?: string;
|
|
660
660
|
/** Tags applied to this resource */
|
|
661
|
-
tag?: Coding;
|
|
661
|
+
tag?: Coding[];
|
|
662
662
|
/** Version specific identifier */
|
|
663
663
|
versionId?: string;
|
|
664
664
|
}
|
|
@@ -922,7 +922,7 @@ interface Signature {
|
|
|
922
922
|
/** The technical format of the signed resources */
|
|
923
923
|
targetFormat?: string;
|
|
924
924
|
/** Indication of the reason the entity signed the object(s) */
|
|
925
|
-
type?: Coding;
|
|
925
|
+
type?: Coding[];
|
|
926
926
|
/** When the signature was created */
|
|
927
927
|
when?: string;
|
|
928
928
|
/** Who signed */
|
|
@@ -4387,7 +4387,24 @@ type VisionPrescription_Props = {
|
|
|
4387
4387
|
[key: string]: any;
|
|
4388
4388
|
};
|
|
4389
4389
|
|
|
4390
|
+
/**
|
|
4391
|
+
* Set the data value index
|
|
4392
|
+
*/
|
|
4393
|
+
declare const setValues: (url: any, values: any, type?: string) => void;
|
|
4394
|
+
/**
|
|
4395
|
+
* Add new entries to the data value index
|
|
4396
|
+
*/
|
|
4397
|
+
declare const extendValues: (url: any, values: any, type?: string) => void;
|
|
4398
|
+
/**
|
|
4399
|
+
* Look up a code from a value set
|
|
4400
|
+
*/
|
|
4401
|
+
declare const lookupValue: (url: any, code: any) => any;
|
|
4390
4402
|
declare const mapSystems: (obj: any) => any;
|
|
4403
|
+
/**
|
|
4404
|
+
* Go over all the keys of an obejct and, based on the hints,
|
|
4405
|
+
* expand values using value maps
|
|
4406
|
+
*/
|
|
4407
|
+
declare const mapValues: (obj: any, hints: any) => any;
|
|
4391
4408
|
/**
|
|
4392
4409
|
* Define a set of mapped system values.
|
|
4393
4410
|
*
|
|
@@ -4408,15 +4425,14 @@ declare const extendSystemMap: (newMappings: any) => void;
|
|
|
4408
4425
|
* @function
|
|
4409
4426
|
* @param id - A string identifier, a FHIR identifier object, or an array of either.
|
|
4410
4427
|
* @param ext - Any other arguments will be treated as extensions
|
|
4411
|
-
* @param {string} [system] - the string system to use by default if
|
|
4412
4428
|
*/
|
|
4413
|
-
declare const identifier: (id: string | Identifier,
|
|
4429
|
+
declare const identifier: (id: string | Identifier, ext?: any[], valueHints?: any) => any;
|
|
4414
4430
|
/**
|
|
4415
4431
|
* Alias for b.identifier()
|
|
4416
4432
|
* @public
|
|
4417
4433
|
* @function
|
|
4418
4434
|
*/
|
|
4419
|
-
declare const id: (id: string | Identifier,
|
|
4435
|
+
declare const id: (id: string | Identifier, ext?: any[], valueHints?: any) => any;
|
|
4420
4436
|
/**
|
|
4421
4437
|
* Add an extension to a resource (or object).
|
|
4422
4438
|
* An object will be created and added to an `extension` array on the provided resource.
|
|
@@ -4470,8 +4486,8 @@ declare const findExtension: (obj: any, targetUrl: any, path: any) => any;
|
|
|
4470
4486
|
* @param {string} code - the code value
|
|
4471
4487
|
* @param {string} system - URL to the system. Will be mapped using the system map.
|
|
4472
4488
|
*/
|
|
4473
|
-
declare
|
|
4474
|
-
declare const c:
|
|
4489
|
+
declare function coding(code: string, system: string, extra?: Omit<Coding, 'code' | 'system'>): any;
|
|
4490
|
+
declare const c: typeof coding;
|
|
4475
4491
|
/**
|
|
4476
4492
|
* Create a value object { code, system } with optional system. Systems will be mapped.
|
|
4477
4493
|
* @function
|
|
@@ -7297,5 +7313,5 @@ declare function verificationResult(props: VerificationResult_Props): any;
|
|
|
7297
7313
|
declare function visionPrescription(type: "VisionPrescription", props: VisionPrescription_Props): any;
|
|
7298
7314
|
declare function visionPrescription(props: VisionPrescription_Props): any;
|
|
7299
7315
|
|
|
7300
|
-
export { type Address, type Age, type Annotation, type Attachment, type BackboneElement, type CodeableConcept, type CodeableReference, type Coding, type ContactDetail, type ContactPoint, type Contributor, type Count, type DataRequirement, type Distance, type Dosage, type Duration, type Element, type ElementDefinition, type Expression, type Extension, type HumanName, type Identifier, type MarketingStatus, type Meta, type Money, type MoneyQuantity, type Narrative, type ParameterDefinition, type Period, type Population, type ProdCharacteristic, type ProductShelfLife, type Quantity, type Range, type Ratio, type RatioRange, type Reference, type RelatedArtifact, type SampledData, type Signature, type SimpleQuantity, type Timing, type TriggerDefinition, type UsageContext, account, activityDefinition, addExtension, administrableProductDefinition, adverseEvent, allergyIntolerance, appointment, appointmentResponse, type base64Binary, biologicallyDerivedProduct, bodyStructure, c, carePlan, careTeam, cc, chargeItem, chargeItemDefinition, citation, claim, claimResponse, clinicalImpression, clinicalUseDefinition, type code, coding, communication, communicationRequest, composite, concept, contract, coverage, coverageEligibilityRequest, coverageEligibilityResponse, detectedIssue, device, deviceDefinition, deviceMetric, deviceRequest, deviceUseStatement, diagnosticReport, domainResource, encounter, enrollmentRequest, enrollmentResponse, episodeOfCare, eventDefinition, evidence, evidenceReport, evidenceVariable, explanationOfBenefit, ext, extendSystemMap, extension, familyMemberHistory, findExtension, flag, goal, group, guidanceResponse, healthcareService, id, identifier, imagingStudy, immunization, immunizationEvaluation, immunizationRecommendation, ingredient, insurancePlan, invoice, library, list, location, manufacturedItemDefinition, mapSystems, type markdown, measure, measureReport, media, medication, medicationAdministration, medicationDispense, medicationKnowledge, medicationRequest, medicationStatement, medicinalProductDefinition, molecularSequence, nutritionOrder, nutritionProduct, observation, observationDefinition, type oid, organization, organizationAffiliation, packagedProductDefinition, patient, paymentNotice, paymentReconciliation, person, planDefinition, practitioner, practitionerRole, procedure, questionnaire, questionnaireResponse, ref, reference, regulatedAuthorization, relatedPerson, requestGroup, researchDefinition, researchElementDefinition, researchStudy, researchSubject, riskAssessment, schedule, serviceRequest, setSystemMap, slot, specimen, specimenDefinition, substance, substanceDefinition, supplyDelivery, supplyRequest, task, testReport, type url, type uuid, value, verificationResult, visionPrescription, type xhtml };
|
|
7316
|
+
export { type Address, type Age, type Annotation, type Attachment, type BackboneElement, type CodeableConcept, type CodeableReference, type Coding, type ContactDetail, type ContactPoint, type Contributor, type Count, type DataRequirement, type Distance, type Dosage, type Duration, type Element, type ElementDefinition, type Expression, type Extension, type HumanName, type Identifier, type MarketingStatus, type Meta, type Money, type MoneyQuantity, type Narrative, type ParameterDefinition, type Period, type Population, type ProdCharacteristic, type ProductShelfLife, type Quantity, type Range, type Ratio, type RatioRange, type Reference, type RelatedArtifact, type SampledData, type Signature, type SimpleQuantity, type Timing, type TriggerDefinition, type UsageContext, account, activityDefinition, addExtension, administrableProductDefinition, adverseEvent, allergyIntolerance, appointment, appointmentResponse, type base64Binary, biologicallyDerivedProduct, bodyStructure, c, carePlan, careTeam, cc, chargeItem, chargeItemDefinition, citation, claim, claimResponse, clinicalImpression, clinicalUseDefinition, type code, coding, communication, communicationRequest, composite, concept, contract, coverage, coverageEligibilityRequest, coverageEligibilityResponse, detectedIssue, device, deviceDefinition, deviceMetric, deviceRequest, deviceUseStatement, diagnosticReport, domainResource, encounter, enrollmentRequest, enrollmentResponse, episodeOfCare, eventDefinition, evidence, evidenceReport, evidenceVariable, explanationOfBenefit, ext, extendSystemMap, extendValues, extension, familyMemberHistory, findExtension, flag, goal, group, guidanceResponse, healthcareService, id, identifier, imagingStudy, immunization, immunizationEvaluation, immunizationRecommendation, ingredient, insurancePlan, invoice, library, list, location, lookupValue, manufacturedItemDefinition, mapSystems, mapValues, type markdown, measure, measureReport, media, medication, medicationAdministration, medicationDispense, medicationKnowledge, medicationRequest, medicationStatement, medicinalProductDefinition, molecularSequence, nutritionOrder, nutritionProduct, observation, observationDefinition, type oid, organization, organizationAffiliation, packagedProductDefinition, patient, paymentNotice, paymentReconciliation, person, planDefinition, practitioner, practitionerRole, procedure, questionnaire, questionnaireResponse, ref, reference, regulatedAuthorization, relatedPerson, requestGroup, researchDefinition, researchElementDefinition, researchStudy, researchSubject, riskAssessment, schedule, serviceRequest, setSystemMap, setValues, slot, specimen, specimenDefinition, substance, substanceDefinition, supplyDelivery, supplyRequest, task, testReport, type url, type uuid, value, verificationResult, visionPrescription, type xhtml };
|
|
7301
7317
|
|
package/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|