fhirsmith 0.8.2 → 0.8.4

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.
@@ -252,6 +252,7 @@ class TerminologyWorker {
252
252
  loadSupplements(url, version = '', statedSupplements) {
253
253
  const supplements = [];
254
254
 
255
+ supplements.push(...this.provider.loadSupplements(url, version, statedSupplements));
255
256
  // todo: look in provider for supplements
256
257
 
257
258
  if (!this.additionalResources) {
@@ -306,7 +307,7 @@ class TerminologyWorker {
306
307
  * @param {CodeSystemProvider} cs - Code system provider
307
308
  * @param {Object} src - Source element (for extensions)
308
309
  */
309
- checkSupplements(cs, src, requiredSupplements, usedSupplements = null) {
310
+ checkSupplements(cs, src, requiredSupplements, usedSupplements = null, reportedSupplements = null) {
310
311
  // Check for required supplements in extensions
311
312
  if (src && src.extension) {
312
313
  const supplementExtensions = src.extension.filter(x => x.url == 'http://hl7.org/fhir/StructureDefinition/valueset-supplement');
@@ -318,7 +319,12 @@ class TerminologyWorker {
318
319
  }
319
320
  }
320
321
 
321
- // Note required supplements that are satisfied
322
+ if (reportedSupplements) {
323
+ for (let s of cs.listSupplements(true)) {
324
+ reportedSupplements.add(s);
325
+ }
326
+ }
327
+ // Note required supplements that are satisfied - and might be version independent
322
328
  if (usedSupplements) {
323
329
  for (const s of requiredSupplements) {
324
330
  if (cs.hasSupplement(s)) {
@@ -9,11 +9,11 @@ const {VersionUtilities} = require("../../library/version-utilities");
9
9
  */
10
10
 
11
11
  function codeSystemToR5(jsonObj, version) {
12
- if (version === 'R5') {
12
+ if (VersionUtilities.isR5Ver(version)) {
13
13
  return jsonObj; // Already R5, no conversion needed
14
14
  }
15
15
 
16
- if (version === 'R3') {
16
+ if (VersionUtilities.isR3Ver(version)) {
17
17
  // R3 to R5: Convert identifier from single object to array
18
18
  if (jsonObj.identifier && !Array.isArray(jsonObj.identifier)) {
19
19
  jsonObj.identifier = [jsonObj.identifier];
@@ -21,7 +21,7 @@ function codeSystemToR5(jsonObj, version) {
21
21
  return jsonObj;
22
22
  }
23
23
 
24
- if (version === 'R4') {
24
+ if (VersionUtilities.isR4Ver(version)) {
25
25
  // R4 to R5: identifier is already an array, no conversion needed
26
26
  return jsonObj;
27
27
  }
@@ -17,10 +17,10 @@ function parametersToR5(jsonObj, sourceVersion) {
17
17
  }
18
18
  }
19
19
 
20
- const {convertResourceFromR5} = require("./xv-resource");
20
+ const {convertResourceToR5} = require("./xv-resource");
21
21
  for (let p of jsonObj.parameter) {
22
22
  if (p.resource) {
23
- p.resource = convertResourceFromR5(p.resource, sourceVersion);
23
+ p.resource = convertResourceToR5(p.resource, sourceVersion);
24
24
  }
25
25
  }
26
26
  return jsonObj;
@@ -203,8 +203,7 @@ function convertContainsPropertyR5ToR4(containsList) {
203
203
  */
204
204
  function isR5OnlyFilterOperator(operator) {
205
205
  const r5OnlyOperators = [
206
- 'generalizes', // Added in R5
207
- // Add other R5-only operators as they're identified
206
+ 'child-of', ' descendent-leaf' // Added in R5
208
207
  ];
209
208
  return r5OnlyOperators.includes(operator);
210
209
  }