fhirsmith 0.3.0
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 +42 -0
- package/FHIRsmith.png +0 -0
- package/README.md +277 -0
- package/config-template.json +144 -0
- package/library/folder-setup.js +58 -0
- package/library/html-server.js +166 -0
- package/library/html.js +835 -0
- package/library/i18nsupport.js +259 -0
- package/library/languages.js +779 -0
- package/library/logger-telnet.js +205 -0
- package/library/logger.js +279 -0
- package/library/package-manager.js +876 -0
- package/library/utilities.js +196 -0
- package/library/version-utilities.js +1056 -0
- package/npmprojector/config-example.json +13 -0
- package/npmprojector/indexer.js +394 -0
- package/npmprojector/npmprojector.js +395 -0
- package/npmprojector/readme.md +174 -0
- package/npmprojector/watcher.js +335 -0
- package/package.json +119 -0
- package/packages/package-crawler.js +846 -0
- package/packages/packages-template.html +126 -0
- package/packages/packages.js +2838 -0
- package/passwords.ini +2 -0
- package/publisher/publisher-template.html +208 -0
- package/publisher/publisher.js +2167 -0
- package/publisher/task-draft.js +458 -0
- package/registry/api.js +735 -0
- package/registry/crawler.js +637 -0
- package/registry/model.js +513 -0
- package/registry/readme.md +243 -0
- package/registry/registry-data.json +121015 -0
- package/registry/registry-template.html +126 -0
- package/registry/registry.js +1395 -0
- package/registry/test-runner.js +237 -0
- package/root-template.html +124 -0
- package/server.js +524 -0
- package/shl/private-key.pem +5 -0
- package/shl/public-key.pem +18 -0
- package/shl/shl.js +1125 -0
- package/shl/vhl.js +69 -0
- package/static/FHIRsmith128.png +0 -0
- package/static/FHIRsmith16.png +0 -0
- package/static/FHIRsmith32.png +0 -0
- package/static/FHIRsmith64.png +0 -0
- package/static/assets/css/bootstrap-fhir.css +5302 -0
- package/static/assets/css/bootstrap-glyphicons.css +2 -0
- package/static/assets/css/bootstrap.css +4097 -0
- package/static/assets/css/jquery-ui.css +523 -0
- package/static/assets/css/jquery-ui.structure.css +863 -0
- package/static/assets/css/jquery-ui.structure.min.css +5 -0
- package/static/assets/css/jquery-ui.theme.css +439 -0
- package/static/assets/css/jquery-ui.theme.min.css +5 -0
- package/static/assets/css/jquery.ui.all.css +7 -0
- package/static/assets/css/modules.css +18 -0
- package/static/assets/css/project.css +367 -0
- package/static/assets/css/pygments-manni.css +66 -0
- package/static/assets/css/tags.css +74 -0
- package/static/assets/css/xml.css +2 -0
- package/static/assets/fonts/glyphiconshalflings-regular.eot +0 -0
- package/static/assets/fonts/glyphiconshalflings-regular.otf +0 -0
- package/static/assets/fonts/glyphiconshalflings-regular.svg +175 -0
- package/static/assets/fonts/glyphiconshalflings-regular.ttf +0 -0
- package/static/assets/fonts/glyphiconshalflings-regular.woff +0 -0
- package/static/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
- package/static/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- package/static/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
- package/static/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
- package/static/assets/ico/favicon.ico +0 -0
- package/static/assets/ico/favicon.png +0 -0
- package/static/assets/images/fhir-logo-www.png +0 -0
- package/static/assets/images/fhir-logo.png +0 -0
- package/static/assets/images/hl7-logo.png +0 -0
- package/static/assets/images/logo_ansinew.jpg +0 -0
- package/static/assets/images/search.png +0 -0
- package/static/assets/images/stripe.png +0 -0
- package/static/assets/images/target.png +0 -0
- package/static/assets/images/tx-registry-root.gif +0 -0
- package/static/assets/images/tx-registry.png +0 -0
- package/static/assets/images/tx-server.png +0 -0
- package/static/assets/images/tx-version.png +0 -0
- package/static/assets/js/bootstrap.min.js +6 -0
- package/static/assets/js/fhir-gw.js +259 -0
- package/static/assets/js/fhir.js +2 -0
- package/static/assets/js/html5shiv.js +8 -0
- package/static/assets/js/jcookie.js +96 -0
- package/static/assets/js/jquery-ui.min.js +6 -0
- package/static/assets/js/jquery.js +10716 -0
- package/static/assets/js/jquery.min.js +2 -0
- package/static/assets/js/jquery.ui.core.js +314 -0
- package/static/assets/js/jquery.ui.draggable.js +825 -0
- package/static/assets/js/jquery.ui.mouse.js +162 -0
- package/static/assets/js/jquery.ui.resizable.js +842 -0
- package/static/assets/js/jquery.ui.widget.js +268 -0
- package/static/assets/js/json2.js +487 -0
- package/static/assets/js/jtip.js +97 -0
- package/static/assets/js/respond.min.js +6 -0
- package/static/assets/js/statuspage.js +70 -0
- package/static/assets/js/xml.js +2 -0
- package/static/dist/js/bootstrap.js +1964 -0
- package/static/favicon.png +0 -0
- package/static/fhir.css +626 -0
- package/static/icon-fhir-16.png +0 -0
- package/static/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- package/static/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- package/static/images/ui-bg_flat_10_000000_40x100.png +0 -0
- package/static/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- package/static/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- package/static/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- package/static/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- package/static/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- package/static/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- package/static/images/ui-icons_222222_256x240.png +0 -0
- package/static/images/ui-icons_228ef1_256x240.png +0 -0
- package/static/images/ui-icons_ef8c08_256x240.png +0 -0
- package/static/images/ui-icons_ffd27a_256x240.png +0 -0
- package/static/images/ui-icons_ffffff_256x240.png +0 -0
- package/static/js/jquery.effects.blind.js +49 -0
- package/static/js/jquery.effects.bounce.js +78 -0
- package/static/js/jquery.effects.clip.js +54 -0
- package/static/js/jquery.effects.core.js +763 -0
- package/static/js/jquery.effects.drop.js +50 -0
- package/static/js/jquery.effects.explode.js +79 -0
- package/static/js/jquery.effects.fade.js +32 -0
- package/static/js/jquery.effects.fold.js +56 -0
- package/static/js/jquery.effects.highlight.js +50 -0
- package/static/js/jquery.effects.pulsate.js +51 -0
- package/static/js/jquery.effects.scale.js +178 -0
- package/static/js/jquery.effects.shake.js +57 -0
- package/static/js/jquery.effects.slide.js +50 -0
- package/static/js/jquery.effects.transfer.js +45 -0
- package/static/js/jquery.ui.accordion.js +611 -0
- package/static/js/jquery.ui.autocomplete.js +612 -0
- package/static/js/jquery.ui.button.js +416 -0
- package/static/js/jquery.ui.datepicker.js +1823 -0
- package/static/js/jquery.ui.dialog.js +878 -0
- package/static/js/jquery.ui.droppable.js +296 -0
- package/static/js/jquery.ui.position.js +252 -0
- package/static/js/jquery.ui.progressbar.js +109 -0
- package/static/js/jquery.ui.selectable.js +266 -0
- package/static/js/jquery.ui.slider.js +666 -0
- package/static/js/jquery.ui.sortable.js +1077 -0
- package/static/js/jquery.ui.tabs.js +758 -0
- package/stats.js +80 -0
- package/test-cache/vsac/vsac-valuesets.db +0 -0
- package/token/nginx_passport_setup.md +383 -0
- package/token/security_guide.md +294 -0
- package/token/token-template.html +330 -0
- package/token/token.js +1300 -0
- package/translations/Messages.properties +1510 -0
- package/translations/Messages_ar.properties +1399 -0
- package/translations/Messages_de.properties +836 -0
- package/translations/Messages_es.properties +737 -0
- package/translations/Messages_fr.properties +1 -0
- package/translations/Messages_ja.properties +893 -0
- package/translations/Messages_nl.properties +1357 -0
- package/translations/Messages_pt.properties +1302 -0
- package/translations/Messages_ru.properties +1 -0
- package/translations/Messages_uz.properties +1 -0
- package/translations/Messages_zh.properties +1 -0
- package/translations/rendering-phrases.properties +1128 -0
- package/translations/rendering-phrases_ar.properties +1091 -0
- package/translations/rendering-phrases_de.properties +6 -0
- package/translations/rendering-phrases_es.properties +6 -0
- package/translations/rendering-phrases_fr.properties +624 -0
- package/translations/rendering-phrases_ja.properties +21 -0
- package/translations/rendering-phrases_nl.properties +970 -0
- package/translations/rendering-phrases_pt.properties +1020 -0
- package/translations/rendering-phrases_ru.properties +1094 -0
- package/translations/rendering-phrases_uz.properties +1 -0
- package/translations/rendering-phrases_zh.properties +1 -0
- package/tx/README.md +418 -0
- package/tx/cm/cm-api.js +110 -0
- package/tx/cm/cm-database.js +735 -0
- package/tx/cm/cm-package.js +325 -0
- package/tx/cs/cs-api.js +789 -0
- package/tx/cs/cs-areacode.js +615 -0
- package/tx/cs/cs-country.js +1110 -0
- package/tx/cs/cs-cpt.js +785 -0
- package/tx/cs/cs-cs.js +1579 -0
- package/tx/cs/cs-currency.js +539 -0
- package/tx/cs/cs-db.js +1321 -0
- package/tx/cs/cs-hgvs.js +329 -0
- package/tx/cs/cs-lang.js +465 -0
- package/tx/cs/cs-loinc.js +1485 -0
- package/tx/cs/cs-mimetypes.js +238 -0
- package/tx/cs/cs-ndc.js +704 -0
- package/tx/cs/cs-omop.js +1025 -0
- package/tx/cs/cs-provider-api.js +43 -0
- package/tx/cs/cs-provider-list.js +37 -0
- package/tx/cs/cs-rxnorm.js +808 -0
- package/tx/cs/cs-snomed.js +1102 -0
- package/tx/cs/cs-ucum.js +514 -0
- package/tx/cs/cs-unii.js +271 -0
- package/tx/cs/cs-uri.js +218 -0
- package/tx/cs/cs-usstates.js +305 -0
- package/tx/dev.fhir.org.yml +14 -0
- package/tx/fixtures/test-cases-setup.json +18 -0
- package/tx/fixtures/test-cases.yml +16 -0
- package/tx/html/codesystem-operations.liquid +25 -0
- package/tx/html/home-metrics.liquid +247 -0
- package/tx/html/operations-form.liquid +148 -0
- package/tx/html/search-form.liquid +62 -0
- package/tx/html/tx-template.html +133 -0
- package/tx/html/valueset-operations.liquid +54 -0
- package/tx/importers/atc-to-fhir.js +316 -0
- package/tx/importers/import-loinc.module.js +1536 -0
- package/tx/importers/import-ndc.module.js +1088 -0
- package/tx/importers/import-rxnorm.module.js +898 -0
- package/tx/importers/import-sct.module.js +2457 -0
- package/tx/importers/import-unii.module.js +601 -0
- package/tx/importers/readme.md +453 -0
- package/tx/importers/subset-loinc.module.js +1081 -0
- package/tx/importers/subset-rxnorm.module.js +938 -0
- package/tx/importers/tx-import-base.js +351 -0
- package/tx/importers/tx-import-settings.js +310 -0
- package/tx/importers/tx-import.js +357 -0
- package/tx/library/canonical-resource.js +88 -0
- package/tx/library/capabilitystatement.js +292 -0
- package/tx/library/codesystem.js +774 -0
- package/tx/library/conceptmap.js +568 -0
- package/tx/library/designations.js +932 -0
- package/tx/library/errors.js +77 -0
- package/tx/library/extensions.js +117 -0
- package/tx/library/namingsystem.js +322 -0
- package/tx/library/operation-outcome.js +127 -0
- package/tx/library/parameters.js +105 -0
- package/tx/library/renderer.js +1559 -0
- package/tx/library/terminologycapabilities.js +418 -0
- package/tx/library/ucum-parsers.js +1029 -0
- package/tx/library/ucum-service.js +370 -0
- package/tx/library/ucum-types.js +1099 -0
- package/tx/library/valueset.js +543 -0
- package/tx/library.js +676 -0
- package/tx/ocl/cm-ocl.js +106 -0
- package/tx/ocl/cs-ocl.js +39 -0
- package/tx/ocl/vs-ocl.js +105 -0
- package/tx/operation-context.js +568 -0
- package/tx/params.js +613 -0
- package/tx/provider.js +403 -0
- package/tx/sct/ecl.js +1560 -0
- package/tx/sct/expressions.js +2077 -0
- package/tx/sct/structures.js +1396 -0
- package/tx/tx-html.js +1063 -0
- package/tx/tx.fhir.org.yml +39 -0
- package/tx/tx.js +927 -0
- package/tx/vs/vs-api.js +112 -0
- package/tx/vs/vs-database.js +786 -0
- package/tx/vs/vs-package.js +358 -0
- package/tx/vs/vs-vsac.js +366 -0
- package/tx/workers/batch-validate.js +129 -0
- package/tx/workers/batch.js +361 -0
- package/tx/workers/closure.js +32 -0
- package/tx/workers/expand.js +1845 -0
- package/tx/workers/lookup.js +407 -0
- package/tx/workers/metadata.js +467 -0
- package/tx/workers/operations.js +34 -0
- package/tx/workers/read.js +164 -0
- package/tx/workers/search.js +384 -0
- package/tx/workers/subsumes.js +334 -0
- package/tx/workers/translate.js +492 -0
- package/tx/workers/validate.js +2504 -0
- package/tx/workers/worker.js +904 -0
- package/tx/xml/capabilitystatement-xml.js +63 -0
- package/tx/xml/codesystem-xml.js +62 -0
- package/tx/xml/conceptmap-xml.js +65 -0
- package/tx/xml/namingsystem-xml.js +65 -0
- package/tx/xml/operationoutcome-xml.js +127 -0
- package/tx/xml/parameters-xml.js +312 -0
- package/tx/xml/terminologycapabilities-xml.js +64 -0
- package/tx/xml/valueset-xml.js +64 -0
- package/tx/xml/xml-base.js +603 -0
- package/vcl/vcl-parser.js +1098 -0
- package/vcl/vcl.js +253 -0
- package/windows-install.js +19 -0
- package/xig/xig-template.html +124 -0
- package/xig/xig.js +3049 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CapabilityStatement XML Serialization
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
const { FhirXmlBase } = require('./xml-base');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* XML support for FHIR CapabilityStatement resources
|
|
9
|
+
*/
|
|
10
|
+
class CapabilityStatementXML extends FhirXmlBase {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Element order for CapabilityStatement (FHIR requires specific order)
|
|
14
|
+
*/
|
|
15
|
+
static _elementOrder = [
|
|
16
|
+
'id', 'meta', 'implicitRules', 'language', 'text', 'contained',
|
|
17
|
+
'extension', 'modifierExtension',
|
|
18
|
+
'url', 'identifier', 'version', 'versionAlgorithmString', 'versionAlgorithmCoding',
|
|
19
|
+
'name', 'title', 'status', 'experimental', 'date', 'publisher',
|
|
20
|
+
'contact', 'description', 'useContext', 'jurisdiction', 'purpose', 'copyright',
|
|
21
|
+
'copyrightLabel', 'kind', 'instantiates', 'imports',
|
|
22
|
+
'software', 'implementation', 'fhirVersion', 'format', 'patchFormat',
|
|
23
|
+
'acceptLanguage', 'implementationGuide', 'rest', 'messaging', 'document'
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Convert CapabilityStatement JSON to XML string
|
|
28
|
+
* @param {Object} json - CapabilityStatement as JSON
|
|
29
|
+
* @param {number} fhirVersion - FHIR version (3, 4, or 5)
|
|
30
|
+
* @returns {string} XML string
|
|
31
|
+
*/
|
|
32
|
+
// eslint-disable-next-line no-unused-vars
|
|
33
|
+
static toXml(json, fhirVersion) {
|
|
34
|
+
const content = this.renderElementsInOrder(json, 1, this._elementOrder);
|
|
35
|
+
return this.wrapInRootElement('CapabilityStatement', content);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Convert XML string to CapabilityStatement JSON
|
|
40
|
+
* @param {string} xml - XML string
|
|
41
|
+
* @param {number} fhirVersion - FHIR version
|
|
42
|
+
* @returns {Object} JSON object
|
|
43
|
+
*/
|
|
44
|
+
static fromXml(xml) {
|
|
45
|
+
const element = this.parseXmlString(xml);
|
|
46
|
+
if (element.name !== 'CapabilityStatement') {
|
|
47
|
+
throw new Error(`Expected CapabilityStatement root element, got ${element.name}`);
|
|
48
|
+
}
|
|
49
|
+
return this.convertElementToFhirJson(element, 'CapabilityStatement');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Parse from a pre-parsed XML element
|
|
54
|
+
* @param {Object} element - Parsed element with {name, attributes, children}
|
|
55
|
+
* @param {number} fhirVersion - FHIR version
|
|
56
|
+
* @returns {Object} JSON object
|
|
57
|
+
*/
|
|
58
|
+
static fromXmlElement(element) {
|
|
59
|
+
return this.convertElementToFhirJson(element, 'CapabilityStatement');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = { CapabilityStatementXML };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CodeSystem XML Serialization
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
const { FhirXmlBase } = require('./xml-base');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* XML support for FHIR CodeSystem resources
|
|
9
|
+
*/
|
|
10
|
+
class CodeSystemXML extends FhirXmlBase {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Element order for CodeSystem (FHIR requires specific order)
|
|
14
|
+
*/
|
|
15
|
+
static _elementOrder = [
|
|
16
|
+
'id', 'meta', 'implicitRules', 'language', 'text', 'contained',
|
|
17
|
+
'extension', 'modifierExtension',
|
|
18
|
+
'url', 'identifier', 'version', 'versionAlgorithmString', 'versionAlgorithmCoding',
|
|
19
|
+
'name', 'title', 'status', 'experimental', 'date', 'publisher',
|
|
20
|
+
'contact', 'description', 'useContext', 'jurisdiction', 'purpose', 'copyright',
|
|
21
|
+
'copyrightLabel', 'approvalDate', 'lastReviewDate', 'effectivePeriod',
|
|
22
|
+
'caseSensitive', 'valueSet', 'hierarchyMeaning', 'compositional', 'versionNeeded',
|
|
23
|
+
'content', 'supplements', 'count', 'filter', 'property', 'concept'
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Convert CodeSystem JSON to XML string
|
|
28
|
+
* @param {Object} json - CodeSystem as JSON
|
|
29
|
+
* @param {number} fhirVersion - FHIR version (3, 4, or 5)
|
|
30
|
+
* @returns {string} XML string
|
|
31
|
+
*/
|
|
32
|
+
static toXml(json) {
|
|
33
|
+
const content = this.renderElementsInOrder(json, 1, this._elementOrder);
|
|
34
|
+
return this.wrapInRootElement('CodeSystem', content);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Convert XML string to CodeSystem JSON
|
|
39
|
+
* @param {string} xml - XML string
|
|
40
|
+
* @param {number} fhirVersion - FHIR version
|
|
41
|
+
* @returns {Object} JSON object
|
|
42
|
+
*/
|
|
43
|
+
static fromXml(xml) {
|
|
44
|
+
const element = this.parseXmlString(xml);
|
|
45
|
+
if (element.name !== 'CodeSystem') {
|
|
46
|
+
throw new Error(`Expected CodeSystem root element, got ${element.name}`);
|
|
47
|
+
}
|
|
48
|
+
return this.convertElementToFhirJson(element, 'CodeSystem');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Parse from a pre-parsed XML element
|
|
53
|
+
* @param {Object} element - Parsed element with {name, attributes, children}
|
|
54
|
+
* @param {number} fhirVersion - FHIR version
|
|
55
|
+
* @returns {Object} JSON object
|
|
56
|
+
*/
|
|
57
|
+
static fromXmlElement(element) {
|
|
58
|
+
return this.convertElementToFhirJson(element, 'CodeSystem');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = { CodeSystemXML };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ConceptMap XML Serialization
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
const { FhirXmlBase } = require('./xml-base');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* XML support for FHIR ConceptMap resources
|
|
9
|
+
*/
|
|
10
|
+
class ConceptMapXML extends FhirXmlBase {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Element order for ConceptMap (FHIR requires specific order)
|
|
14
|
+
*/
|
|
15
|
+
static _elementOrder = [
|
|
16
|
+
'id', 'meta', 'implicitRules', 'language', 'text', 'contained',
|
|
17
|
+
'extension', 'modifierExtension',
|
|
18
|
+
'url', 'identifier', 'version', 'versionAlgorithmString', 'versionAlgorithmCoding',
|
|
19
|
+
'name', 'title', 'status', 'experimental', 'date', 'publisher',
|
|
20
|
+
'contact', 'description', 'useContext', 'jurisdiction', 'purpose', 'copyright',
|
|
21
|
+
'copyrightLabel', 'approvalDate', 'lastReviewDate', 'effectivePeriod',
|
|
22
|
+
'sourceScopeUri', 'sourceScopeCanonical', 'targetScopeUri', 'targetScopeCanonical',
|
|
23
|
+
'group'
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Convert ConceptMap JSON to XML string
|
|
28
|
+
* @param {Object} json - ConceptMap as JSON
|
|
29
|
+
* @param {number} fhirVersion - FHIR version (3, 4, or 5)
|
|
30
|
+
* @returns {string} XML string
|
|
31
|
+
*/
|
|
32
|
+
// eslint-disable-next-line no-unused-vars
|
|
33
|
+
static toXml(json, fhirVersion) {
|
|
34
|
+
const content = this.renderElementsInOrder(json, 1, this._elementOrder);
|
|
35
|
+
return this.wrapInRootElement('ConceptMap', content);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Convert XML string to ConceptMap JSON
|
|
40
|
+
* @param {string} xml - XML string
|
|
41
|
+
* @param {number} fhirVersion - FHIR version
|
|
42
|
+
* @returns {Object} JSON object
|
|
43
|
+
*/
|
|
44
|
+
// eslint-disable-next-line no-unused-vars
|
|
45
|
+
static fromXml(xml, fhirVersion) {
|
|
46
|
+
const element = this.parseXmlString(xml);
|
|
47
|
+
if (element.name !== 'ConceptMap') {
|
|
48
|
+
throw new Error(`Expected ConceptMap root element, got ${element.name}`);
|
|
49
|
+
}
|
|
50
|
+
return this.convertElementToFhirJson(element, 'ConceptMap');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Parse from a pre-parsed XML element
|
|
55
|
+
* @param {Object} element - Parsed element with {name, attributes, children}
|
|
56
|
+
* @param {number} fhirVersion - FHIR version
|
|
57
|
+
* @returns {Object} JSON object
|
|
58
|
+
*/
|
|
59
|
+
// eslint-disable-next-line no-unused-vars
|
|
60
|
+
static fromXmlElement(element, fhirVersion) {
|
|
61
|
+
return this.convertElementToFhirJson(element, 'ConceptMap');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = { ConceptMapXML };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NamingSystem XML Serialization
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
const { FhirXmlBase } = require('./xml-base');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* XML support for FHIR NamingSystem resources
|
|
9
|
+
*/
|
|
10
|
+
class NamingSystemXML extends FhirXmlBase {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Element order for NamingSystem (FHIR requires specific order)
|
|
14
|
+
*/
|
|
15
|
+
static _elementOrder = [
|
|
16
|
+
'id', 'meta', 'implicitRules', 'language', 'text', 'contained',
|
|
17
|
+
'extension', 'modifierExtension',
|
|
18
|
+
'url', 'identifier', 'version', 'versionAlgorithmString', 'versionAlgorithmCoding',
|
|
19
|
+
'name', 'title', 'status', 'kind', 'experimental', 'date', 'publisher',
|
|
20
|
+
'contact', 'responsible', 'type', 'description', 'useContext', 'jurisdiction',
|
|
21
|
+
'purpose', 'copyright', 'copyrightLabel', 'approvalDate', 'lastReviewDate',
|
|
22
|
+
'effectivePeriod', 'topic', 'author', 'editor', 'reviewer', 'endorser',
|
|
23
|
+
'relatedArtifact', 'usage', 'uniqueId'
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Convert NamingSystem JSON to XML string
|
|
28
|
+
* @param {Object} json - NamingSystem as JSON
|
|
29
|
+
* @param {number} fhirVersion - FHIR version (3, 4, or 5)
|
|
30
|
+
* @returns {string} XML string
|
|
31
|
+
*/
|
|
32
|
+
// eslint-disable-next-line no-unused-vars
|
|
33
|
+
static toXml(json, fhirVersion) {
|
|
34
|
+
const content = this.renderElementsInOrder(json, 1, this._elementOrder);
|
|
35
|
+
return this.wrapInRootElement('NamingSystem', content);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Convert XML string to NamingSystem JSON
|
|
40
|
+
* @param {string} xml - XML string
|
|
41
|
+
* @param {number} fhirVersion - FHIR version
|
|
42
|
+
* @returns {Object} JSON object
|
|
43
|
+
*/
|
|
44
|
+
// eslint-disable-next-line no-unused-vars
|
|
45
|
+
static fromXml(xml, fhirVersion) {
|
|
46
|
+
const element = this.parseXmlString(xml);
|
|
47
|
+
if (element.name !== 'NamingSystem') {
|
|
48
|
+
throw new Error(`Expected NamingSystem root element, got ${element.name}`);
|
|
49
|
+
}
|
|
50
|
+
return this.convertElementToFhirJson(element, 'NamingSystem');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Parse from a pre-parsed XML element
|
|
55
|
+
* @param {Object} element - Parsed element with {name, attributes, children}
|
|
56
|
+
* @param {number} fhirVersion - FHIR version
|
|
57
|
+
* @returns {Object} JSON object
|
|
58
|
+
*/
|
|
59
|
+
// eslint-disable-next-line no-unused-vars
|
|
60
|
+
static fromXmlElement(element, fhirVersion) {
|
|
61
|
+
return this.convertElementToFhirJson(element, 'NamingSystem');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = { NamingSystemXML };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OperationOutcome XML Serialization
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
const { FhirXmlBase } = require('./xml-base');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* XML support for FHIR OperationOutcome resources
|
|
9
|
+
*/
|
|
10
|
+
class OperationOutcomeXML extends FhirXmlBase {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Element order for OperationOutcome (FHIR requires specific order)
|
|
14
|
+
*/
|
|
15
|
+
static _elementOrder = [
|
|
16
|
+
'id', 'meta', 'implicitRules', 'language', 'text', 'contained',
|
|
17
|
+
'extension', 'modifierExtension', 'issue'
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Element order for issue elements
|
|
22
|
+
*/
|
|
23
|
+
static _issueElementOrder = [
|
|
24
|
+
'severity', 'code', 'details', 'diagnostics', 'location', 'expression'
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Convert OperationOutcome JSON to XML string
|
|
29
|
+
* @param {Object} json - OperationOutcome as JSON
|
|
30
|
+
* @param {number} fhirVersion - FHIR version (3, 4, or 5)
|
|
31
|
+
* @returns {string} XML string
|
|
32
|
+
*/
|
|
33
|
+
// eslint-disable-next-line no-unused-vars
|
|
34
|
+
static toXml(json, fhirVersion) {
|
|
35
|
+
const content = this._renderOperationOutcome(json, 1);
|
|
36
|
+
return this.wrapInRootElement('OperationOutcome', content);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Render OperationOutcome with special handling for issues
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
static _renderOperationOutcome(obj, level) {
|
|
44
|
+
let xml = '';
|
|
45
|
+
|
|
46
|
+
// Process elements in order
|
|
47
|
+
for (const key of this._elementOrder) {
|
|
48
|
+
if (Object.hasOwn(obj, key) && key !== 'resourceType') {
|
|
49
|
+
if (key === 'issue') {
|
|
50
|
+
xml += this._renderIssues(obj.issue, level);
|
|
51
|
+
} else {
|
|
52
|
+
xml += this.renderElement(key, obj[key], level);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Process any remaining elements
|
|
58
|
+
for (const key of Object.keys(obj)) {
|
|
59
|
+
if (!this._elementOrder.includes(key) && key !== 'resourceType' && !key.startsWith('_')) {
|
|
60
|
+
xml += this.renderElement(key, obj[key], level);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return xml;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Render issue array with proper element ordering
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
static _renderIssues(issues, level) {
|
|
72
|
+
let xml = '';
|
|
73
|
+
if (!Array.isArray(issues)) {
|
|
74
|
+
issues = [issues];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
for (const issue of issues) {
|
|
78
|
+
xml += `${this.indent(level)}<issue>\n`;
|
|
79
|
+
|
|
80
|
+
// Render issue elements in correct order
|
|
81
|
+
for (const key of this._issueElementOrder) {
|
|
82
|
+
if (Object.hasOwn(issue, key)) {
|
|
83
|
+
xml += this.renderElement(key, issue[key], level + 1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Render any remaining elements
|
|
88
|
+
for (const key of Object.keys(issue)) {
|
|
89
|
+
if (!this._issueElementOrder.includes(key) && !key.startsWith('_')) {
|
|
90
|
+
xml += this.renderElement(key, issue[key], level + 1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
xml += `${this.indent(level)}</issue>\n`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return xml;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Convert XML string to OperationOutcome JSON
|
|
102
|
+
* @param {string} xml - XML string
|
|
103
|
+
* @param {number} fhirVersion - FHIR version
|
|
104
|
+
* @returns {Object} JSON object
|
|
105
|
+
*/
|
|
106
|
+
// eslint-disable-next-line no-unused-vars
|
|
107
|
+
static fromXml(xml, fhirVersion) {
|
|
108
|
+
const element = this.parseXmlString(xml);
|
|
109
|
+
if (element.name !== 'OperationOutcome') {
|
|
110
|
+
throw new Error(`Expected OperationOutcome root element, got ${element.name}`);
|
|
111
|
+
}
|
|
112
|
+
return this.convertElementToFhirJson(element, 'OperationOutcome');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Parse from a pre-parsed XML element
|
|
117
|
+
* @param {Object} element - Parsed element with {name, attributes, children}
|
|
118
|
+
* @param {number} fhirVersion - FHIR version
|
|
119
|
+
* @returns {Object} JSON object
|
|
120
|
+
*/
|
|
121
|
+
// eslint-disable-next-line no-unused-vars
|
|
122
|
+
static fromXmlElement(element, fhirVersion) {
|
|
123
|
+
return this.convertElementToFhirJson(element, 'OperationOutcome');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = { OperationOutcomeXML };
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Parameters XML Serialization
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
const { FhirXmlBase } = require('./xml-base');
|
|
6
|
+
|
|
7
|
+
// Forward declarations - will be loaded lazily to avoid circular dependencies
|
|
8
|
+
let CodeSystemXML, ValueSetXML, ConceptMapXML, OperationOutcomeXML;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* XML support for FHIR Parameters resources
|
|
12
|
+
*/
|
|
13
|
+
class ParametersXML extends FhirXmlBase {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Element order for Parameters (FHIR requires specific order)
|
|
17
|
+
*/
|
|
18
|
+
static _elementOrder = [
|
|
19
|
+
'id', 'meta', 'implicitRules', 'language', 'parameter'
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Lazily load resource XML classes to avoid circular dependencies
|
|
24
|
+
*/
|
|
25
|
+
static _loadResourceClasses() {
|
|
26
|
+
if (!CodeSystemXML) {
|
|
27
|
+
CodeSystemXML = require('./codesystem-xml').CodeSystemXML;
|
|
28
|
+
ValueSetXML = require('./valueset-xml').ValueSetXML;
|
|
29
|
+
ConceptMapXML = require('./conceptmap-xml').ConceptMapXML;
|
|
30
|
+
OperationOutcomeXML = require('./operationoutcome-xml').OperationOutcomeXML;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Convert Parameters JSON to XML string
|
|
36
|
+
* @param {Object} json - Parameters as JSON
|
|
37
|
+
* @param {number} fhirVersion - FHIR version (3, 4, or 5)
|
|
38
|
+
* @returns {string} XML string
|
|
39
|
+
*/
|
|
40
|
+
static toXml(json, fhirVersion) {
|
|
41
|
+
this._loadResourceClasses();
|
|
42
|
+
const content = this._renderParameters(json, 1, fhirVersion);
|
|
43
|
+
return this.wrapInRootElement('Parameters', content);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Render Parameters with special handling for parameter elements
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
static _renderParameters(obj, level, fhirVersion) {
|
|
51
|
+
let xml = '';
|
|
52
|
+
|
|
53
|
+
// Process elements in order
|
|
54
|
+
for (const key of this._elementOrder) {
|
|
55
|
+
if (Object.hasOwn(obj, key) && key !== 'resourceType') {
|
|
56
|
+
if (key === 'parameter') {
|
|
57
|
+
xml += this._renderParameterArray(obj.parameter, level, fhirVersion);
|
|
58
|
+
} else {
|
|
59
|
+
xml += this.renderElement(key, obj[key], level);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Process any remaining elements
|
|
65
|
+
for (const key of Object.keys(obj)) {
|
|
66
|
+
if (!this._elementOrder.includes(key) && key !== 'resourceType' && !key.startsWith('_')) {
|
|
67
|
+
xml += this.renderElement(key, obj[key], level);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return xml;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Render parameter array
|
|
76
|
+
* @private
|
|
77
|
+
*/
|
|
78
|
+
static _renderParameterArray(parameters, level, fhirVersion) {
|
|
79
|
+
let xml = '';
|
|
80
|
+
if (!Array.isArray(parameters)) {
|
|
81
|
+
parameters = [parameters];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
for (const param of parameters) {
|
|
85
|
+
xml += `${this.indent(level)}<parameter>\n`;
|
|
86
|
+
xml += this._renderParameter(param, level + 1, fhirVersion);
|
|
87
|
+
xml += `${this.indent(level)}</parameter>\n`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return xml;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Render a single parameter
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
static _renderParameter(param, level, fhirVersion) {
|
|
98
|
+
let xml = '';
|
|
99
|
+
|
|
100
|
+
// Parameter element order: name, value[x], resource, part
|
|
101
|
+
if (param.name !== undefined) {
|
|
102
|
+
xml += `${this.indent(level)}<name value="${this.escapeXml(param.name)}"/>\n`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Handle value[x] - find the value property
|
|
106
|
+
for (const [key, value] of Object.entries(param)) {
|
|
107
|
+
if (key.startsWith('value')) {
|
|
108
|
+
xml += this.renderElement(key, value, level);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Handle resource
|
|
114
|
+
if (param.resource) {
|
|
115
|
+
xml += `${this.indent(level)}<resource>\n`;
|
|
116
|
+
xml += this._renderResource(param.resource, level + 1, fhirVersion);
|
|
117
|
+
xml += `${this.indent(level)}</resource>\n`;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Handle nested parts
|
|
121
|
+
if (param.part) {
|
|
122
|
+
for (const part of param.part) {
|
|
123
|
+
xml += `${this.indent(level)}<part>\n`;
|
|
124
|
+
xml += this._renderParameter(part, level + 1, fhirVersion);
|
|
125
|
+
xml += `${this.indent(level)}</part>\n`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return xml;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Render an embedded resource
|
|
134
|
+
* @private
|
|
135
|
+
*/
|
|
136
|
+
static _renderResource(resource, level, fhirVersion) {
|
|
137
|
+
const resourceType = resource.resourceType;
|
|
138
|
+
if (!resourceType) {
|
|
139
|
+
return '';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Try to use dedicated XML converter
|
|
143
|
+
let fullXml;
|
|
144
|
+
try {
|
|
145
|
+
switch (resourceType) {
|
|
146
|
+
case 'CodeSystem':
|
|
147
|
+
fullXml = CodeSystemXML.toXml(resource, fhirVersion);
|
|
148
|
+
break;
|
|
149
|
+
case 'ValueSet':
|
|
150
|
+
fullXml = ValueSetXML.toXml(resource, fhirVersion);
|
|
151
|
+
break;
|
|
152
|
+
case 'ConceptMap':
|
|
153
|
+
fullXml = ConceptMapXML.toXml(resource, fhirVersion);
|
|
154
|
+
break;
|
|
155
|
+
case 'OperationOutcome':
|
|
156
|
+
fullXml = OperationOutcomeXML.toXml(resource, fhirVersion);
|
|
157
|
+
break;
|
|
158
|
+
case 'Parameters':
|
|
159
|
+
fullXml = ParametersXML.toXml(resource, fhirVersion);
|
|
160
|
+
break;
|
|
161
|
+
default:
|
|
162
|
+
// Fall back to generic rendering
|
|
163
|
+
return this._renderGenericResource(resource, level);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Remove XML declaration and re-indent
|
|
167
|
+
let fragment = fullXml.replace(/^<\?xml[^?]*\?>\s*\n?/, '');
|
|
168
|
+
|
|
169
|
+
// Add indentation to each line
|
|
170
|
+
const indent = this.indent(level);
|
|
171
|
+
fragment = fragment.split('\n').map(line => line ? indent + line : line).join('\n');
|
|
172
|
+
|
|
173
|
+
return fragment;
|
|
174
|
+
} catch (e) {
|
|
175
|
+
return this._renderGenericResource(resource, level);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Generic resource rendering fallback
|
|
181
|
+
* @private
|
|
182
|
+
*/
|
|
183
|
+
static _renderGenericResource(resource, level) {
|
|
184
|
+
let xml = '';
|
|
185
|
+
const resourceType = resource.resourceType;
|
|
186
|
+
if (resourceType) {
|
|
187
|
+
xml += `${this.indent(level)}<${resourceType} xmlns="${this.getNamespace()}">\n`;
|
|
188
|
+
for (const [key, value] of Object.entries(resource)) {
|
|
189
|
+
if (key !== 'resourceType') {
|
|
190
|
+
xml += this.renderElement(key, value, level + 1);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
xml += `${this.indent(level)}</${resourceType}>\n`;
|
|
194
|
+
}
|
|
195
|
+
return xml;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Convert XML string to Parameters JSON
|
|
200
|
+
* @param {string} xml - XML string
|
|
201
|
+
* @param {number} fhirVersion - FHIR version
|
|
202
|
+
* @returns {Object} JSON object
|
|
203
|
+
*/
|
|
204
|
+
static fromXml(xml, fhirVersion) {
|
|
205
|
+
this._loadResourceClasses();
|
|
206
|
+
const element = this.parseXmlString(xml);
|
|
207
|
+
if (element.name !== 'Parameters') {
|
|
208
|
+
throw new Error(`Expected Parameters root element, got ${element.name}`);
|
|
209
|
+
}
|
|
210
|
+
return this._parseParametersElement(element, fhirVersion);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Parse from a pre-parsed XML element
|
|
215
|
+
* @param {Object} element - Parsed element with {name, attributes, children}
|
|
216
|
+
* @param {number} fhirVersion - FHIR version
|
|
217
|
+
* @returns {Object} JSON object
|
|
218
|
+
*/
|
|
219
|
+
static fromXmlElement(element, fhirVersion) {
|
|
220
|
+
this._loadResourceClasses();
|
|
221
|
+
return this._parseParametersElement(element, fhirVersion);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Parse Parameters element
|
|
226
|
+
* @private
|
|
227
|
+
*/
|
|
228
|
+
static _parseParametersElement(element, fhirVersion) {
|
|
229
|
+
const json = { resourceType: 'Parameters' };
|
|
230
|
+
|
|
231
|
+
for (const child of element.children) {
|
|
232
|
+
if (child.name === 'id') {
|
|
233
|
+
json.id = child.attributes.value;
|
|
234
|
+
} else if (child.name === 'meta') {
|
|
235
|
+
json.meta = this.convertChildElement(child);
|
|
236
|
+
} else if (child.name === 'implicitRules') {
|
|
237
|
+
json.implicitRules = child.attributes.value;
|
|
238
|
+
} else if (child.name === 'language') {
|
|
239
|
+
json.language = child.attributes.value;
|
|
240
|
+
} else if (child.name === 'parameter') {
|
|
241
|
+
if (!json.parameter) {
|
|
242
|
+
json.parameter = [];
|
|
243
|
+
}
|
|
244
|
+
json.parameter.push(this._parseParameter(child, fhirVersion));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return json;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Parse a parameter element
|
|
253
|
+
* @private
|
|
254
|
+
*/
|
|
255
|
+
static _parseParameter(element, fhirVersion) {
|
|
256
|
+
const param = {};
|
|
257
|
+
|
|
258
|
+
for (const child of element.children) {
|
|
259
|
+
if (child.name === 'name') {
|
|
260
|
+
param.name = child.attributes.value;
|
|
261
|
+
} else if (child.name.startsWith('value')) {
|
|
262
|
+
const { value, primitiveExt } = this._convertChildElementWithExt(child);
|
|
263
|
+
if (value !== null) {
|
|
264
|
+
param[child.name] = value;
|
|
265
|
+
}
|
|
266
|
+
if (primitiveExt !== null) {
|
|
267
|
+
param['_' + child.name] = primitiveExt;
|
|
268
|
+
}
|
|
269
|
+
} else if (child.name === 'resource') {
|
|
270
|
+
param.resource = this._parseResourceElement(child, fhirVersion);
|
|
271
|
+
} else if (child.name === 'part') {
|
|
272
|
+
if (!param.part) {
|
|
273
|
+
param.part = [];
|
|
274
|
+
}
|
|
275
|
+
param.part.push(this._parseParameter(child, fhirVersion));
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return param;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Parse a resource element
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
static _parseResourceElement(element, fhirVersion) {
|
|
287
|
+
if (element.children.length > 0) {
|
|
288
|
+
const resourceElement = element.children[0];
|
|
289
|
+
const resourceType = resourceElement.name;
|
|
290
|
+
|
|
291
|
+
// Try to use dedicated parser
|
|
292
|
+
switch (resourceType) {
|
|
293
|
+
case 'CodeSystem':
|
|
294
|
+
return CodeSystemXML.fromXmlElement(resourceElement, fhirVersion);
|
|
295
|
+
case 'ValueSet':
|
|
296
|
+
return ValueSetXML.fromXmlElement(resourceElement, fhirVersion);
|
|
297
|
+
case 'ConceptMap':
|
|
298
|
+
return ConceptMapXML.fromXmlElement(resourceElement, fhirVersion);
|
|
299
|
+
case 'OperationOutcome':
|
|
300
|
+
return OperationOutcomeXML.fromXmlElement(resourceElement, fhirVersion);
|
|
301
|
+
case 'Parameters':
|
|
302
|
+
return ParametersXML.fromXmlElement(resourceElement, fhirVersion);
|
|
303
|
+
default:
|
|
304
|
+
// Generic parsing
|
|
305
|
+
return this.convertElementToFhirJson(resourceElement, resourceType);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
module.exports = { ParametersXML };
|