fhirsmith 0.4.2 → 0.5.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/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/library/cron-utilities.js +136 -0
- package/library/html-server.js +13 -29
- package/library/html.js +3 -8
- package/library/languages.js +160 -37
- package/library/package-manager.js +48 -1
- package/library/utilities.js +100 -19
- package/package.json +2 -2
- package/packages/package-crawler.js +6 -1
- package/packages/packages.js +38 -54
- package/publisher/publisher.js +19 -27
- package/registry/api.js +11 -10
- package/registry/crawler.js +31 -29
- package/registry/model.js +5 -26
- package/registry/registry.js +32 -41
- package/server.js +89 -12
- package/shl/shl.js +0 -18
- package/static/assets/js/statuspage.js +1 -9
- package/stats.js +39 -1
- package/token/token.js +14 -9
- package/translations/Messages.properties +2 -1
- package/tx/README.md +17 -6
- package/tx/cs/cs-api.js +19 -1
- package/tx/cs/cs-base.js +77 -0
- package/tx/cs/cs-country.js +46 -0
- package/tx/cs/cs-cpt.js +9 -5
- package/tx/cs/cs-cs.js +27 -13
- package/tx/cs/cs-lang.js +60 -22
- package/tx/cs/cs-loinc.js +69 -98
- package/tx/cs/cs-mimetypes.js +4 -0
- package/tx/cs/cs-ndc.js +6 -0
- package/tx/cs/cs-omop.js +16 -15
- package/tx/cs/cs-rxnorm.js +23 -1
- package/tx/cs/cs-snomed.js +283 -40
- package/tx/cs/cs-ucum.js +90 -70
- package/tx/importers/import-sct.module.js +371 -35
- package/tx/importers/readme.md +117 -7
- package/tx/library/bundle.js +5 -0
- package/tx/library/capabilitystatement.js +3 -142
- package/tx/library/codesystem.js +19 -173
- package/tx/library/conceptmap.js +4 -218
- package/tx/library/designations.js +14 -1
- package/tx/library/extensions.js +7 -0
- package/tx/library/namingsystem.js +3 -89
- package/tx/library/operation-outcome.js +8 -3
- package/tx/library/parameters.js +3 -2
- package/tx/library/renderer.js +10 -6
- package/tx/library/terminologycapabilities.js +3 -243
- package/tx/library/valueset.js +3 -235
- package/tx/library.js +100 -13
- package/tx/operation-context.js +23 -4
- package/tx/params.js +35 -38
- package/tx/provider.js +6 -5
- package/tx/sct/expressions.js +12 -3
- package/tx/tx-html.js +80 -89
- package/tx/tx.fhir.org.yml +6 -5
- package/tx/tx.js +163 -13
- package/tx/vs/vs-database.js +56 -39
- package/tx/vs/vs-package.js +21 -2
- package/tx/vs/vs-vsac.js +175 -39
- package/tx/workers/batch-validate.js +2 -0
- package/tx/workers/batch.js +2 -0
- package/tx/workers/expand.js +132 -112
- package/tx/workers/lookup.js +33 -14
- package/tx/workers/metadata.js +2 -2
- package/tx/workers/read.js +3 -2
- package/tx/workers/related.js +574 -0
- package/tx/workers/search.js +46 -9
- package/tx/workers/subsumes.js +13 -3
- package/tx/workers/translate.js +7 -3
- package/tx/workers/validate.js +258 -285
- package/tx/workers/worker.js +43 -39
- package/tx/xml/bundle-xml.js +237 -0
- package/tx/xml/xml-base.js +215 -64
- package/tx/xversion/xv-bundle.js +71 -0
- package/tx/xversion/xv-capabiliityStatement.js +137 -0
- package/tx/xversion/xv-codesystem.js +169 -0
- package/tx/xversion/xv-conceptmap.js +224 -0
- package/tx/xversion/xv-namingsystem.js +88 -0
- package/tx/xversion/xv-operationoutcome.js +27 -0
- package/tx/xversion/xv-parameters.js +87 -0
- package/tx/xversion/xv-resource.js +45 -0
- package/tx/xversion/xv-terminologyCapabilities.js +214 -0
- package/tx/xversion/xv-valueset.js +234 -0
- package/utilities/dev-proxy-server.js +126 -0
- package/utilities/explode-results.js +58 -0
- package/utilities/split-by-system.js +198 -0
- package/utilities/vsac-cs-fetcher.js +0 -0
- package/{windows-install.js → utilities/windows-install.js} +2 -0
- package/vcl/vcl.js +0 -18
- package/xig/xig.js +241 -230
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {namingSystemToR5, namingSystemFromR5} = require("../xversion/xv-namingsystem");
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a FHIR NamingSystem resource with version conversion support
|
|
@@ -40,7 +40,7 @@ class NamingSystem {
|
|
|
40
40
|
constructor(jsonObj, version = 'R5') {
|
|
41
41
|
this.version = version;
|
|
42
42
|
// Convert to R5 format internally (modifies input for performance)
|
|
43
|
-
this.jsonObj =
|
|
43
|
+
this.jsonObj = namingSystemToR5(jsonObj, version);
|
|
44
44
|
this.validate();
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -50,96 +50,10 @@ class NamingSystem {
|
|
|
50
50
|
* @returns {string} JSON string
|
|
51
51
|
*/
|
|
52
52
|
toJSONString(version = 'R5') {
|
|
53
|
-
const outputObj =
|
|
53
|
+
const outputObj = namingSystemFromR5(this.jsonObj, version);
|
|
54
54
|
return JSON.stringify(outputObj);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* Converts input NamingSystem to R5 format (modifies input object for performance)
|
|
59
|
-
* @param {Object} jsonObj - The input NamingSystem object
|
|
60
|
-
* @param {string} version - Source FHIR version
|
|
61
|
-
* @returns {Object} The same object, potentially modified to R5 format
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
_convertToR5(jsonObj, version) {
|
|
65
|
-
if (version === 'R5') {
|
|
66
|
-
return jsonObj; // Already R5, no conversion needed
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (version === 'R3') {
|
|
70
|
-
// R3 to R5: Remove replacedBy field (we ignore it completely)
|
|
71
|
-
if (jsonObj.replacedBy !== undefined) {
|
|
72
|
-
delete jsonObj.replacedBy;
|
|
73
|
-
}
|
|
74
|
-
return jsonObj;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (version === 'R4') {
|
|
78
|
-
// R4 to R5: No structural conversion needed
|
|
79
|
-
// R5 is backward compatible for the structural elements we care about
|
|
80
|
-
return jsonObj;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
throw new Error(`Unsupported FHIR version: ${version}`);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Converts R5 NamingSystem to target version format (clones object first)
|
|
88
|
-
* @param {Object} r5Obj - The R5 format NamingSystem object
|
|
89
|
-
* @param {string} targetVersion - Target FHIR version
|
|
90
|
-
* @returns {Object} New object in target version format
|
|
91
|
-
* @private
|
|
92
|
-
*/
|
|
93
|
-
_convertFromR5(r5Obj, targetVersion) {
|
|
94
|
-
if (VersionUtilities.isR5Ver(targetVersion)) {
|
|
95
|
-
return r5Obj; // No conversion needed
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Clone the object to avoid modifying the original
|
|
99
|
-
const cloned = JSON.parse(JSON.stringify(r5Obj));
|
|
100
|
-
|
|
101
|
-
if (VersionUtilities.isR4Ver(targetVersion)) {
|
|
102
|
-
return this._convertR5ToR4(cloned);
|
|
103
|
-
} else if (VersionUtilities.isR3Ver(targetVersion)) {
|
|
104
|
-
return this._convertR5ToR3(cloned);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
throw new Error(`Unsupported target FHIR version: ${targetVersion}`);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Converts R5 NamingSystem to R4 format
|
|
112
|
-
* @param {Object} r5Obj - Cloned R5 NamingSystem object
|
|
113
|
-
* @returns {Object} R4 format NamingSystem
|
|
114
|
-
* @private
|
|
115
|
-
*/
|
|
116
|
-
_convertR5ToR4(r5Obj) {
|
|
117
|
-
// Remove R5-specific elements that don't exist in R4
|
|
118
|
-
if (r5Obj.versionAlgorithmString) {
|
|
119
|
-
delete r5Obj.versionAlgorithmString;
|
|
120
|
-
}
|
|
121
|
-
if (r5Obj.versionAlgorithmCoding) {
|
|
122
|
-
delete r5Obj.versionAlgorithmCoding;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return r5Obj;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Converts R5 NamingSystem to R3 format
|
|
130
|
-
* @param {Object} r5Obj - Cloned R5 NamingSystem object
|
|
131
|
-
* @returns {Object} R3 format NamingSystem
|
|
132
|
-
* @private
|
|
133
|
-
*/
|
|
134
|
-
_convertR5ToR3(r5Obj) {
|
|
135
|
-
// First apply R4 conversions
|
|
136
|
-
const r4Obj = this._convertR5ToR4(r5Obj);
|
|
137
|
-
|
|
138
|
-
// R3 doesn't have some R4/R5 fields, but we'll just let them through
|
|
139
|
-
// since most additions are backward compatible in JSON
|
|
140
|
-
|
|
141
|
-
return r4Obj;
|
|
142
|
-
}
|
|
143
57
|
|
|
144
58
|
/**
|
|
145
59
|
* Gets the FHIR version this NamingSystem was loaded from
|
|
@@ -28,9 +28,10 @@ class Issue extends Error {
|
|
|
28
28
|
code: this.cause,
|
|
29
29
|
details: {
|
|
30
30
|
text: this.message
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (this.path) {
|
|
34
|
+
res.expression = [this.path]
|
|
34
35
|
}
|
|
35
36
|
if (this.issueCode) {
|
|
36
37
|
res.details.coding = [{ system: "http://hl7.org/fhir/tools/CodeSystem/tx-issue-type", code : this.issueCode }];
|
|
@@ -82,6 +83,10 @@ class OperationOutcome {
|
|
|
82
83
|
this.jsonObj = jsonObj ? jsonObj : { "resourceType": "OperationOutcome" };
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
addIssueIfNew(newIssue) {
|
|
87
|
+
return this.addIssue(newIssue, true);
|
|
88
|
+
}
|
|
89
|
+
|
|
85
90
|
addIssue(newIssue, ifNotDuplicate = false) {
|
|
86
91
|
validateParameter(newIssue, "newIssue", Object);
|
|
87
92
|
if (ifNotDuplicate) {
|
package/tx/library/parameters.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const {getValuePrimitive, getValueDT} = require("../../library/utilities");
|
|
2
|
+
const {parametersToR5} = require("../xversion/xv-parameters");
|
|
2
3
|
|
|
3
4
|
class Parameters {
|
|
4
5
|
jsonObj;
|
|
5
6
|
|
|
6
|
-
constructor (jsonObj = null) {
|
|
7
|
-
this.jsonObj = jsonObj ? jsonObj : { "resourceType": "Parameters" };
|
|
7
|
+
constructor (jsonObj = null, fhirVersion = 'R5') {
|
|
8
|
+
this.jsonObj = parametersToR5(jsonObj ? jsonObj : { "resourceType": "Parameters" }, fhirVersion);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
addParamStr(name, value) {
|
package/tx/library/renderer.js
CHANGED
|
@@ -24,7 +24,7 @@ class Renderer {
|
|
|
24
24
|
if (arg.systemUri !== undefined && arg.version !== undefined && arg.code !== undefined && arg.display !== undefined) {
|
|
25
25
|
// It's a Coding
|
|
26
26
|
return this.displayCodedCoding(arg);
|
|
27
|
-
} else if (arg.coding !== undefined) {
|
|
27
|
+
} else if (arg.coding !== undefined || arg.text) {
|
|
28
28
|
// It's a CodeableConcept
|
|
29
29
|
return this.displayCodedCodeableConcept(arg);
|
|
30
30
|
} else if (arg.systemUri !== undefined && arg.version !== undefined) {
|
|
@@ -74,11 +74,15 @@ class Renderer {
|
|
|
74
74
|
|
|
75
75
|
displayCodedCodeableConcept(code) {
|
|
76
76
|
let result = '';
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
if (code.text && !code.coding) {
|
|
78
|
+
result = '"'+code.text+'"';
|
|
79
|
+
} else {
|
|
80
|
+
for (const c of code.coding || []) {
|
|
81
|
+
if (result) {
|
|
82
|
+
result = result + ', ';
|
|
83
|
+
}
|
|
84
|
+
result = result + this.displayCodedCoding(c);
|
|
80
85
|
}
|
|
81
|
-
result = result + this.displayCodedCoding(c);
|
|
82
86
|
}
|
|
83
87
|
return '[' + result + ']';
|
|
84
88
|
}
|
|
@@ -1280,7 +1284,7 @@ class Renderer {
|
|
|
1280
1284
|
return div_.toString();
|
|
1281
1285
|
}
|
|
1282
1286
|
|
|
1283
|
-
async renderCapabilityRest(x, rest
|
|
1287
|
+
async renderCapabilityRest(x, rest) {
|
|
1284
1288
|
x.h3().tx(`REST ${rest.mode || 'server'} Definition`);
|
|
1285
1289
|
|
|
1286
1290
|
if (rest.documentation) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const {CanonicalResource} = require("./canonical-resource");
|
|
2
|
-
const {
|
|
2
|
+
const {terminologyCapabilitiesToR5, terminologyCapabilitiesFromR5} = require("../xversion/xv-terminologyCapabilities");
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents a FHIR TerminologyCapabilities resource with version conversion support.
|
|
@@ -17,7 +17,7 @@ class TerminologyCapabilities extends CanonicalResource {
|
|
|
17
17
|
constructor(jsonObj, fhirVersion = 'R5') {
|
|
18
18
|
super(jsonObj, fhirVersion);
|
|
19
19
|
// Convert to R5 format internally (modifies input for performance)
|
|
20
|
-
this.jsonObj =
|
|
20
|
+
this.jsonObj = terminologyCapabilitiesToR5(jsonObj, fhirVersion);
|
|
21
21
|
this.validate();
|
|
22
22
|
this.id = this.jsonObj.id;
|
|
23
23
|
}
|
|
@@ -38,7 +38,7 @@ class TerminologyCapabilities extends CanonicalResource {
|
|
|
38
38
|
* @returns {string} JSON string
|
|
39
39
|
*/
|
|
40
40
|
toJSONString(version = 'R5') {
|
|
41
|
-
const outputObj =
|
|
41
|
+
const outputObj = terminologyCapabilitiesFromR5(this.jsonObj, version);
|
|
42
42
|
return JSON.stringify(outputObj);
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -51,246 +51,6 @@ class TerminologyCapabilities extends CanonicalResource {
|
|
|
51
51
|
return this._convertFromR5(this.jsonObj, version);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
/**
|
|
55
|
-
* Converts input TerminologyCapabilities to R5 format (modifies input object for performance)
|
|
56
|
-
* @param {Object} jsonObj - The input TerminologyCapabilities object
|
|
57
|
-
* @param {string} version - Source FHIR version
|
|
58
|
-
* @returns {Object} The same object, potentially modified to R5 format
|
|
59
|
-
* @private
|
|
60
|
-
*/
|
|
61
|
-
_convertToR5(jsonObj, version) {
|
|
62
|
-
if (version === 'R5') {
|
|
63
|
-
return jsonObj; // Already R5, no conversion needed
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (version === 'R4') {
|
|
67
|
-
// R4 to R5: No major structural changes needed for TerminologyCapabilities
|
|
68
|
-
return jsonObj;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (VersionUtilities.isR3Ver(version)) {
|
|
72
|
-
// R3: TerminologyCapabilities doesn't exist - it's a Parameters resource
|
|
73
|
-
// Convert from Parameters format to TerminologyCapabilities
|
|
74
|
-
return this._convertParametersToR5(jsonObj);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
throw new Error(`Unsupported FHIR version: ${version}`);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Converts R3 Parameters format to R5 TerminologyCapabilities
|
|
82
|
-
* @param {Object} params - The Parameters resource
|
|
83
|
-
* @returns {Object} TerminologyCapabilities in R5 format
|
|
84
|
-
* @private
|
|
85
|
-
*/
|
|
86
|
-
_convertParametersToR5(params) {
|
|
87
|
-
if (params.resourceType !== 'Parameters') {
|
|
88
|
-
throw new Error('R3 TerminologyCapabilities must be a Parameters resource');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const result = {
|
|
92
|
-
resourceType: 'TerminologyCapabilities',
|
|
93
|
-
id: params.id,
|
|
94
|
-
status: 'active', // Default, as Parameters doesn't carry this
|
|
95
|
-
kind: 'instance', // Default for terminology server capabilities
|
|
96
|
-
codeSystem: []
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const parameters = params.parameter || [];
|
|
100
|
-
let currentSystem = null;
|
|
101
|
-
|
|
102
|
-
for (const param of parameters) {
|
|
103
|
-
switch (param.name) {
|
|
104
|
-
case 'url':
|
|
105
|
-
result.url = param.valueUri;
|
|
106
|
-
break;
|
|
107
|
-
case 'version':
|
|
108
|
-
if (currentSystem) {
|
|
109
|
-
// This is a code system version
|
|
110
|
-
if (param.valueCode) {
|
|
111
|
-
currentSystem.version = currentSystem.version || [];
|
|
112
|
-
currentSystem.version.push({ code: param.valueCode });
|
|
113
|
-
}
|
|
114
|
-
// Empty version parameter means no specific version
|
|
115
|
-
} else {
|
|
116
|
-
// This is the TerminologyCapabilities version
|
|
117
|
-
result.version = param.valueCode || param.valueString;
|
|
118
|
-
}
|
|
119
|
-
break;
|
|
120
|
-
case 'date':
|
|
121
|
-
result.date = param.valueDateTime;
|
|
122
|
-
break;
|
|
123
|
-
case 'system':
|
|
124
|
-
// Start a new code system
|
|
125
|
-
currentSystem = { uri: param.valueUri };
|
|
126
|
-
result.codeSystem.push(currentSystem);
|
|
127
|
-
break;
|
|
128
|
-
case 'expansion.parameter':
|
|
129
|
-
result.expansion = result.expansion || { parameter: [] };
|
|
130
|
-
result.expansion.parameter.push({ name: param.valueCode });
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return result;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Converts R5 TerminologyCapabilities to target version format (clones object first)
|
|
140
|
-
* @param {Object} r5Obj - The R5 format TerminologyCapabilities object
|
|
141
|
-
* @param {string} targetVersion - Target FHIR version
|
|
142
|
-
* @returns {Object} New object in target version format
|
|
143
|
-
* @private
|
|
144
|
-
*/
|
|
145
|
-
_convertFromR5(r5Obj, targetVersion) {
|
|
146
|
-
if (VersionUtilities.isR5Ver(targetVersion)) {
|
|
147
|
-
return r5Obj; // No conversion needed
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Clone the object to avoid modifying the original
|
|
151
|
-
const cloned = JSON.parse(JSON.stringify(r5Obj));
|
|
152
|
-
|
|
153
|
-
if (VersionUtilities.isR4Ver(targetVersion)) {
|
|
154
|
-
return this._convertR5ToR4(cloned);
|
|
155
|
-
} else if (VersionUtilities.isR3Ver(targetVersion)) {
|
|
156
|
-
return this._convertR5ToR3(cloned);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
throw new Error(`Unsupported target FHIR version: ${targetVersion}`);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Converts R5 TerminologyCapabilities to R4 format
|
|
164
|
-
* @param {Object} r5Obj - Cloned R5 TerminologyCapabilities object
|
|
165
|
-
* @returns {Object} R4 format TerminologyCapabilities
|
|
166
|
-
* @private
|
|
167
|
-
*/
|
|
168
|
-
_convertR5ToR4(r5Obj) {
|
|
169
|
-
// Remove R5-specific elements
|
|
170
|
-
if (r5Obj.versionAlgorithmString) {
|
|
171
|
-
delete r5Obj.versionAlgorithmString;
|
|
172
|
-
}
|
|
173
|
-
if (r5Obj.versionAlgorithmCoding) {
|
|
174
|
-
delete r5Obj.versionAlgorithmCoding;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Convert valueCanonical to valueUri throughout the object
|
|
178
|
-
this._convertCanonicalToUri(r5Obj);
|
|
179
|
-
|
|
180
|
-
return r5Obj;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Converts R5 TerminologyCapabilities to R3 format (Parameters resource)
|
|
185
|
-
* In R3, TerminologyCapabilities didn't exist - we represent it as a Parameters resource
|
|
186
|
-
* @param {Object} r5Obj - Cloned R5 TerminologyCapabilities object
|
|
187
|
-
* @returns {Object} R3 format Parameters resource
|
|
188
|
-
* @private
|
|
189
|
-
*/
|
|
190
|
-
_convertR5ToR3(r5Obj) {
|
|
191
|
-
const params = {
|
|
192
|
-
resourceType: 'Parameters',
|
|
193
|
-
id: r5Obj.id,
|
|
194
|
-
parameter: []
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
// Add url parameter
|
|
198
|
-
if (r5Obj.url) {
|
|
199
|
-
params.parameter.push({
|
|
200
|
-
name: 'url',
|
|
201
|
-
valueUri: r5Obj.url
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Add version parameter
|
|
206
|
-
if (r5Obj.version) {
|
|
207
|
-
params.parameter.push({
|
|
208
|
-
name: 'version',
|
|
209
|
-
valueCode: r5Obj.version
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Add date parameter
|
|
214
|
-
if (r5Obj.date) {
|
|
215
|
-
params.parameter.push({
|
|
216
|
-
name: 'date',
|
|
217
|
-
valueDateTime: r5Obj.date
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// Add code systems with their versions
|
|
222
|
-
for (const codeSystem of r5Obj.codeSystem || []) {
|
|
223
|
-
// Add system parameter
|
|
224
|
-
params.parameter.push({
|
|
225
|
-
name: 'system',
|
|
226
|
-
valueUri: codeSystem.uri
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
// Add version parameter(s) for this code system
|
|
230
|
-
if (codeSystem.version && codeSystem.version.length > 0) {
|
|
231
|
-
for (const ver of codeSystem.version) {
|
|
232
|
-
if (ver.code) {
|
|
233
|
-
params.parameter.push({
|
|
234
|
-
name: 'version',
|
|
235
|
-
valueCode: ver.code
|
|
236
|
-
});
|
|
237
|
-
} else {
|
|
238
|
-
// Empty version parameter when no specific version
|
|
239
|
-
params.parameter.push({
|
|
240
|
-
name: 'version'
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
} else {
|
|
245
|
-
// No version specified for this code system
|
|
246
|
-
params.parameter.push({
|
|
247
|
-
name: 'version'
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// Add expansion parameters
|
|
253
|
-
if (r5Obj.expansion && r5Obj.expansion.parameter) {
|
|
254
|
-
for (const expParam of r5Obj.expansion.parameter) {
|
|
255
|
-
params.parameter.push({
|
|
256
|
-
name: 'expansion.parameter',
|
|
257
|
-
valueCode: expParam.name
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return params;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Recursively converts valueCanonical to valueUri in an object
|
|
267
|
-
* R3/R4 doesn't have canonical type in the same way, so valueCanonical must become valueUri
|
|
268
|
-
* @param {Object} obj - Object to convert
|
|
269
|
-
* @private
|
|
270
|
-
*/
|
|
271
|
-
_convertCanonicalToUri(obj) {
|
|
272
|
-
if (!obj || typeof obj !== 'object') {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
if (Array.isArray(obj)) {
|
|
277
|
-
obj.forEach(item => this._convertCanonicalToUri(item));
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// Convert valueCanonical to valueUri
|
|
282
|
-
if (obj.valueCanonical !== undefined) {
|
|
283
|
-
obj.valueUri = obj.valueCanonical;
|
|
284
|
-
delete obj.valueCanonical;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// Recurse into all properties
|
|
288
|
-
for (const key of Object.keys(obj)) {
|
|
289
|
-
if (typeof obj[key] === 'object') {
|
|
290
|
-
this._convertCanonicalToUri(obj[key]);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
54
|
|
|
295
55
|
/**
|
|
296
56
|
* Validates that this is a proper TerminologyCapabilities resource
|