fhirsmith 0.8.5 → 0.8.6

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.
@@ -207,6 +207,7 @@ class ValueSetExpander {
207
207
  reportedSupplements = new Set();
208
208
  internalLimit = INTERNAL_DEFAULT_LIMIT;
209
209
  externalLimit = EXTERNAL_DEFAULT_LIMIT;
210
+ noDetails = false;
210
211
 
211
212
  constructor(worker, params) {
212
213
  this.worker = worker;
@@ -336,7 +337,7 @@ class ValueSetExpander {
336
337
  }
337
338
  }
338
339
 
339
- if (expansion) {
340
+ if (expansion && !this.noDetails) {
340
341
  const s = this.canonical(system, version);
341
342
  this.addParamUri(expansion, 'used-codesystem', s);
342
343
  if (cs != null) {
@@ -362,113 +363,115 @@ class ValueSetExpander {
362
363
  if (isInactive) {
363
364
  n.inactive = true;
364
365
  }
366
+ if (!this.noDetails) {
367
+ if (status && status.toLowerCase() !== 'active') {
368
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#status', 'status', "valueCode", status);
369
+ } else if (deprecated) {
370
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#status', 'status', "valueCode", 'deprecated');
371
+ }
365
372
 
366
- if (status && status.toLowerCase() !== 'active') {
367
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#status', 'status', "valueCode", status);
368
- } else if (deprecated) {
369
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#status', 'status', "valueCode", 'deprecated');
370
- }
371
-
372
- if (Extensions.has(csExtList, 'http://hl7.org/fhir/StructureDefinition/codesystem-label')) {
373
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#label', 'label', "valueString", Extensions.readString(csExtList, 'http://hl7.org/fhir/StructureDefinition/codesystem-label'));
374
- }
375
- if (Extensions.has(vsExtList, 'http://hl7.org/fhir/StructureDefinition/valueset-label')) {
376
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#label', 'label', "valueString", Extensions.readString(vsExtList, 'http://hl7.org/fhir/StructureDefinition/valueset-label'));
377
- }
373
+ if (Extensions.has(csExtList, 'http://hl7.org/fhir/StructureDefinition/codesystem-label')) {
374
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#label', 'label', "valueString", Extensions.readString(csExtList, 'http://hl7.org/fhir/StructureDefinition/codesystem-label'));
375
+ }
376
+ if (Extensions.has(vsExtList, 'http://hl7.org/fhir/StructureDefinition/valueset-label')) {
377
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#label', 'label', "valueString", Extensions.readString(vsExtList, 'http://hl7.org/fhir/StructureDefinition/valueset-label'));
378
+ }
378
379
 
379
- if (Extensions.has(csExtList, 'http://hl7.org/fhir/StructureDefinition/codesystem-conceptOrder')) {
380
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#order', 'order', "valueDecimal", Extensions.readNumber(csExtList, 'http://hl7.org/fhir/StructureDefinition/codesystem-conceptOrder', undefined));
381
- }
382
- if (Extensions.has(vsExtList, 'http://hl7.org/fhir/StructureDefinition/valueset-conceptOrder')) {
383
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#order', 'order', "valueDecimal", Extensions.readNumber(vsExtList, 'http://hl7.org/fhir/StructureDefinition/valueset-conceptOrder', undefined));
384
- }
380
+ if (Extensions.has(csExtList, 'http://hl7.org/fhir/StructureDefinition/codesystem-conceptOrder')) {
381
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#order', 'order', "valueDecimal", Extensions.readNumber(csExtList, 'http://hl7.org/fhir/StructureDefinition/codesystem-conceptOrder', undefined));
382
+ }
383
+ if (Extensions.has(vsExtList, 'http://hl7.org/fhir/StructureDefinition/valueset-conceptOrder')) {
384
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#order', 'order', "valueDecimal", Extensions.readNumber(vsExtList, 'http://hl7.org/fhir/StructureDefinition/valueset-conceptOrder', undefined));
385
+ }
385
386
 
386
- if (Extensions.has(csExtList, 'http://hl7.org/fhir/StructureDefinition/itemWeight')) {
387
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#itemWeight', 'weight', "valueDecimal", Extensions.readNumber(csExtList, 'http://hl7.org/fhir/StructureDefinition/itemWeight', undefined));
388
- }
389
- if (Extensions.has(vsExtList, 'http://hl7.org/fhir/StructureDefinition/itemWeight')) {
390
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#itemWeight', 'weight', "valueDecimal", Extensions.readNumber(vsExtList, 'http://hl7.org/fhir/StructureDefinition/itemWeight', undefined));
391
- }
387
+ if (Extensions.has(csExtList, 'http://hl7.org/fhir/StructureDefinition/itemWeight')) {
388
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#itemWeight', 'weight', "valueDecimal", Extensions.readNumber(csExtList, 'http://hl7.org/fhir/StructureDefinition/itemWeight', undefined));
389
+ }
390
+ if (Extensions.has(vsExtList, 'http://hl7.org/fhir/StructureDefinition/itemWeight')) {
391
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#itemWeight', 'weight', "valueDecimal", Extensions.readNumber(vsExtList, 'http://hl7.org/fhir/StructureDefinition/itemWeight', undefined));
392
+ }
392
393
 
393
- if (csExtList != null) {
394
- for (const ext of csExtList) {
395
- if (['http://hl7.org/fhir/StructureDefinition/coding-sctdescid', 'http://hl7.org/fhir/StructureDefinition/rendering-style',
396
- 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml', 'http://hl7.org/fhir/StructureDefinition/codesystem-alternate'].includes(ext.url)) {
397
- if (!n.extension) {n.extension = []}
398
- n.extension.push(ext);
399
- }
400
- if (['http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status'].includes(ext.url)) {
401
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#status', 'status', "valueCode", getValuePrimitive(ext));
394
+ if (csExtList != null) {
395
+ for (const ext of csExtList) {
396
+ if (['http://hl7.org/fhir/StructureDefinition/coding-sctdescid', 'http://hl7.org/fhir/StructureDefinition/rendering-style',
397
+ 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml', 'http://hl7.org/fhir/StructureDefinition/codesystem-alternate'].includes(ext.url)) {
398
+ if (!n.extension) {
399
+ n.extension = []
400
+ }
401
+ n.extension.push(ext);
402
+ }
403
+ if (['http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status'].includes(ext.url)) {
404
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#status', 'status', "valueCode", getValuePrimitive(ext));
405
+ }
402
406
  }
403
407
  }
404
- }
405
408
 
406
- if (vsExtList != null) {
407
- for (const ext of vsExtList || []) {
408
- if (['http://hl7.org/fhir/StructureDefinition/valueset-supplement', 'http://hl7.org/fhir/StructureDefinition/valueset-deprecated',
409
- 'http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status',
410
- 'http://hl7.org/fhir/StructureDefinition/valueset-concept-definition', 'http://hl7.org/fhir/StructureDefinition/coding-sctdescid',
411
- 'http://hl7.org/fhir/StructureDefinition/rendering-style', 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml'].includes(ext.url)) {
412
- if (!n.extension) {n.extension = []}
413
- n.extension.push(ext);
409
+ if (vsExtList != null) {
410
+ for (const ext of vsExtList || []) {
411
+ if (['http://hl7.org/fhir/StructureDefinition/valueset-supplement', 'http://hl7.org/fhir/StructureDefinition/valueset-deprecated',
412
+ 'http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status',
413
+ 'http://hl7.org/fhir/StructureDefinition/valueset-concept-definition', 'http://hl7.org/fhir/StructureDefinition/coding-sctdescid',
414
+ 'http://hl7.org/fhir/StructureDefinition/rendering-style', 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml'].includes(ext.url)) {
415
+ if (!n.extension) {
416
+ n.extension = []
417
+ }
418
+ n.extension.push(ext);
419
+ }
414
420
  }
415
421
  }
416
- }
417
422
 
418
- // display and designations
419
- const pref = displays.preferredDesignation(this.params.workingLanguages(), this.reportedSupplements);
420
- if (pref && pref.value) {
421
- n.display = pref.value;
422
- }
423
+ // display and designations
424
+ const pref = displays.preferredDesignation(this.params.workingLanguages(), this.reportedSupplements);
425
+ if (pref && pref.value) {
426
+ n.display = pref.value;
427
+ }
423
428
 
424
- if (this.params.includeDesignations) {
425
- for (const t of displays.designations) {
426
- if (t !== pref && this.useDesignation(t) && t.value != null && !this.redundantDisplay(n, t.language, t.use, t.value)) {
427
- if (!n.designation) {
428
- n.designation = [];
429
- }
430
- if (t.source) {
431
- this.reportedSupplements.add(t.source);
429
+ if (this.params.includeDesignations) {
430
+ for (const t of displays.designations) {
431
+ if (t !== pref && this.useDesignation(t) && t.value != null && !this.redundantDisplay(n, t.language, t.use, t.value)) {
432
+ if (!n.designation) {
433
+ n.designation = [];
434
+ }
435
+ if (t.source) {
436
+ this.reportedSupplements.add(t.source);
437
+ }
438
+ n.designation.push(t.asObject());
432
439
  }
433
- n.designation.push(t.asObject());
434
440
  }
435
441
  }
436
- }
437
442
 
438
- for (const pn of this.params.properties) {
439
- if (pn === 'definition') {
440
- if (definition) {
441
- this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#definition', pn, "valueString", definition);
442
- }
443
- } else if (pn === 'usage-count') {
444
- let counter = cs.usages().get(code);
445
- this.defineProperty(expansion, n, 'http://fhir.org/FHIRsmith/CodeSystem/concept-properties#usage-count', pn, "valueInteger", counter ? counter.count : 0);
446
- } else if (csProps != null && cs != null) {
447
- for (const cp of csProps) {
448
- if (cp.code === pn) {
449
- let vn = getValueName(cp);
450
- let v = cp[vn];
451
- this.defineProperty(expansion, n, this.getPropUrl(cs, pn, cp), pn, vn, v);
443
+ for (const pn of this.params.properties) {
444
+ if (pn === 'definition') {
445
+ if (definition) {
446
+ this.defineProperty(expansion, n, 'http://hl7.org/fhir/concept-properties#definition', pn, "valueString", definition);
447
+ }
448
+ } else if (pn === 'usage-count') {
449
+ let counter = cs.usages().get(code);
450
+ this.defineProperty(expansion, n, 'http://fhir.org/FHIRsmith/CodeSystem/concept-properties#usage-count', pn, "valueInteger", counter ? counter.count : 0);
451
+ } else if (csProps != null && cs != null) {
452
+ for (const cp of csProps) {
453
+ if (cp.code === pn) {
454
+ let vn = getValueName(cp);
455
+ let v = cp[vn];
456
+ this.defineProperty(expansion, n, this.getPropUrl(cs, pn, cp), pn, vn, v);
457
+ }
452
458
  }
453
459
  }
454
460
  }
455
461
  }
456
-
457
- if (!this.map.has(s)) {
458
- this.fullList.push(n);
459
- this.map.set(s, n);
460
- if (parent != null) {
461
- if (!parent.contains) {
462
- parent.contains = [];
463
- }
464
- parent.contains.push(n);
465
- } else {
466
- this.rootList.push(n);
462
+ this.fullList.push(n);
463
+ this.map.set(s, n);
464
+ if (parent != null && !this.noDetails) {
465
+ if (!parent.contains) {
466
+ parent.contains = [];
467
467
  }
468
+ parent.contains.push(n);
468
469
  } else {
469
- this.canBeHierarchy = false;
470
+ this.rootList.push(n);
470
471
  }
471
472
  result = n;
473
+ } else {
474
+ this.canBeHierarchy = false;
472
475
  }
473
476
  return result;
474
477
  }
@@ -777,9 +780,17 @@ class ValueSetExpander {
777
780
  const c = await cs.filterConcept(ctxt, set[0]);
778
781
  if (await this.passesFilters(cs, c, prep, set, 1)) {
779
782
  const cds = new Designations(this.worker.i18n.languageDefinitions);
780
- await this.listDisplaysFromProvider(cds, cs, c);
781
- let added = await this.includeCode(cs, null, await cs.system(), await cs.version(), await cs.code(c), await cs.isAbstract(c), await cs.isInactive(c), await cs.isDeprecated(c), await cs.getStatus(c),
782
- cds, await cs.definition(c), await cs.itemWeight(c), expansion, valueSets, await cs.extensions(c), null, await cs.properties(c), null, excludeInactive, vsSrc.url);
783
+ let added;
784
+ if (this.noDetails) {
785
+ await this.listDisplaysFromProvider(cds, cs, c);
786
+ added = await this.includeCode(cs, null, await cs.system(), await cs.version(), await cs.code(c), await cs.isAbstract(c), await cs.isInactive(c), false, null,
787
+ cds, null, null, expansion, valueSets, null, null, null, null, excludeInactive, vsSrc.url);
788
+
789
+ } else {
790
+ await this.listDisplaysFromProvider(cds, cs, c);
791
+ added = await this.includeCode(cs, null, await cs.system(), await cs.version(), await cs.code(c), await cs.isAbstract(c), await cs.isInactive(c), await cs.isDeprecated(c), await cs.getStatus(c),
792
+ cds, await cs.definition(c), await cs.itemWeight(c), expansion, valueSets, await cs.extensions(c), null, await cs.properties(c), null, excludeInactive, vsSrc.url);
793
+ }
783
794
  if (added) {
784
795
  this.addToTotal();
785
796
  }
@@ -799,15 +810,21 @@ class ValueSetExpander {
799
810
  Extensions.checkNoModifiers(cc, 'ValueSetExpander.processCodes', 'set concept reference', vsSrc.vurl);
800
811
  const cctxt = await cs.locate(cc.code, this.allAltCodes);
801
812
  if (cctxt && cctxt.context && (!this.params.activeOnly || !await cs.isInactive(cctxt.context)) && await this.passesFilters(cs, cctxt.context, prep, filters, 0)) {
802
- await this.listDisplaysFromProvider(cds, cs, cctxt.context);
803
- this.listDisplaysFromIncludeConcept(cds, cc, vsSrc);
804
- if (filter.passesDesignations(cds) || filter.passes(cc.code)) {
805
- let ov = Extensions.readString(cc, 'http://hl7.org/fhir/StructureDefinition/itemWeight');
806
- if (!ov) {
807
- ov = await cs.itemWeight(cctxt.context);
813
+ let added;
814
+ if (this.noDetails) {
815
+ added = await this.includeCode(cs, null, cs.system(), cs.version(), cc.code, await cs.isAbstract(cctxt.context), await cs.isInactive(cctxt.context), null, null, cds,
816
+ null, null, expansion, valueSets, null, null, null, null, excludeInactive, vsSrc.url);
817
+ } else {
818
+ await this.listDisplaysFromProvider(cds, cs, cctxt.context);
819
+ this.listDisplaysFromIncludeConcept(cds, cc, vsSrc);
820
+ if (filter.passesDesignations(cds) || filter.passes(cc.code)) {
821
+ let ov = Extensions.readString(cc, 'http://hl7.org/fhir/StructureDefinition/itemWeight');
822
+ if (!ov) {
823
+ ov = await cs.itemWeight(cctxt.context);
824
+ }
825
+ added = await this.includeCode(cs, null, cs.system(), cs.version(), cc.code, await cs.isAbstract(cctxt.context), await cs.isInactive(cctxt.context), await cs.isDeprecated(cctxt.context), await cs.getStatus(cctxt.context), cds,
826
+ await cs.definition(cctxt.context), ov, expansion, valueSets, await cs.extensions(cctxt.context), cc.extension, await cs.properties(cctxt.context), null, excludeInactive, vsSrc.url);
808
827
  }
809
- let added = await this.includeCode(cs, null, cs.system(), cs.version(), cc.code, await cs.isAbstract(cctxt.context), await cs.isInactive(cctxt.context), await cs.isDeprecated(cctxt.context), await cs.getStatus(cctxt.context), cds,
810
- await cs.definition(cctxt.context), ov, expansion, valueSets, await cs.extensions(cctxt.context), cc.extension, await cs.properties(cctxt.context), null, excludeInactive, vsSrc.url);
811
828
  if (added) {
812
829
  this.addToTotal();
813
830
  }
@@ -850,24 +867,33 @@ class ValueSetExpander {
850
867
  }
851
868
 
852
869
  this.worker.opContext.log('iterate filters');
870
+ const cds = new Designations(this.worker.i18n.languageDefinitions);
853
871
  while (await cs.filterMore(prep, fset[0])) {
854
872
  this.worker.deadCheck('processCodes#5');
855
873
  const c = await cs.filterConcept(prep, fset[0]);
856
874
  const ok = (!this.params.activeOnly || !await cs.isInactive(c)) && (await this.passesFilters(cs, c, prep, fset, 1));
857
875
  if (ok) {
876
+ cds.clear();
858
877
  // count++;
859
- const cds = new Designations(this.worker.i18n.languageDefinitions);
860
878
  if (this.passesImports(valueSets, cs.system(), await cs.code(c), 0)) {
861
- await this.listDisplaysFromProvider(cds, cs, c);
862
- let parent = null;
863
- if (cs.hasParents()) {
864
- parent = this.map.get(this.keyS(cs.system(), cs.version(), await cs.parent(c)));
879
+ let added;
880
+ if (this.noDetails) {
881
+ added = await this.includeCode(cs, null, await cs.system(), await cs.version(), await cs.code(c), await cs.isAbstract(c), await cs.isInactive(c),
882
+ null, null, cds, null, null,
883
+ expansion, null, null, null, null, null, excludeInactive, vsSrc.url);
884
+
865
885
  } else {
866
- this.canBeHierarchy = false;
886
+ await this.listDisplaysFromProvider(cds, cs, c);
887
+ let parent = null;
888
+ if (cs.hasParents()) {
889
+ parent = this.map.get(this.keyS(cs.system(), cs.version(), await cs.parent(c)));
890
+ } else {
891
+ this.canBeHierarchy = false;
892
+ }
893
+ added = await this.includeCode(cs, parent, await cs.system(), await cs.version(), await cs.code(c), await cs.isAbstract(c), await cs.isInactive(c),
894
+ await cs.isDeprecated(c), await cs.getStatus(c), cds, await cs.definition(c), await cs.itemWeight(c),
895
+ expansion, null, await cs.extensions(c), null, await cs.properties(c), null, excludeInactive, vsSrc.url);
867
896
  }
868
- let added = await this.includeCode(cs, parent, await cs.system(), await cs.version(), await cs.code(c), await cs.isAbstract(c), await cs.isInactive(c),
869
- await cs.isDeprecated(c), await cs.getStatus(c), cds, await cs.definition(c), await cs.itemWeight(c),
870
- expansion, null, await cs.extensions(c), null, await cs.properties(c), null, excludeInactive, vsSrc.url);
871
897
  if (added) {
872
898
  this.addToTotal();
873
899
  }
@@ -1053,9 +1079,16 @@ class ValueSetExpander {
1053
1079
  let n = null;
1054
1080
  if ((!this.params.excludeNotForUI || !await cs.isAbstract(context)) && (!this.params.activeOnly || !await cs.isInactive(context))) {
1055
1081
  const cds = new Designations(this.worker.i18n.languageDefinitions);
1056
- await this.listDisplaysFromProvider(cds, cs, context);
1057
- const t = await this.includeCode(cs, parent, await cs.system(), await cs.version(), context.code, await cs.isAbstract(context), await cs.isInactive(context), await cs.isDeprecated(context), await cs.getStatus(context), cds, await cs.definition(context),
1058
- await cs.itemWeight(context), expansion, imports, await cs.extensions(context), null, await cs.properties(context), null, excludeInactive, srcUrl);
1082
+ let t;
1083
+ if (this.noDetails) {
1084
+ t = await this.includeCode(cs, null, await cs.system(), await cs.version(), context.code, await cs.isAbstract(context), await cs.isInactive(context), null, null, null,
1085
+ null, expansion, imports, null, null, null, null, excludeInactive, srcUrl);
1086
+
1087
+ } else {
1088
+ await this.listDisplaysFromProvider(cds, cs, context);
1089
+ t = await this.includeCode(cs, parent, await cs.system(), await cs.version(), context.code, await cs.isAbstract(context), await cs.isInactive(context), await cs.isDeprecated(context), await cs.getStatus(context), cds, await cs.definition(context),
1090
+ await cs.itemWeight(context), expansion, imports, await cs.extensions(context), null, await cs.properties(context), null, excludeInactive, srcUrl);
1091
+ }
1059
1092
  if (t != null) {
1060
1093
  result++;
1061
1094
  }
@@ -1189,7 +1222,7 @@ class ValueSetExpander {
1189
1222
  return result; // just return the expansion
1190
1223
  }
1191
1224
 
1192
- if (this.params.generateNarrative) {
1225
+ if (this.params.generateNarrative && !this.noDetails) {
1193
1226
  div_ = div();
1194
1227
  table = div_.table("grid");
1195
1228
  } else {
@@ -1203,8 +1236,10 @@ class ValueSetExpander {
1203
1236
 
1204
1237
  if (this.params.limit <= 0) {
1205
1238
  this.limitCount = this.externalLimit;
1206
- } else {
1239
+ } else if (this.externalLimit) {
1207
1240
  this.limitCount = Math.min(this.params.limit, this.externalLimit);
1241
+ } else {
1242
+ this.limitCount = this.params.limit;
1208
1243
  }
1209
1244
  this.offset = this.params.offset;
1210
1245
  this.count = this.params.count;
@@ -1321,8 +1356,10 @@ class ValueSetExpander {
1321
1356
  exp.total = this.total;
1322
1357
  }
1323
1358
  list = this.fullList;
1324
- for (const c of this.fullList) {
1325
- c.contains = undefined;
1359
+ if (!this.noDetails) {
1360
+ for (const c of this.fullList) {
1361
+ c.contains = undefined;
1362
+ }
1326
1363
  }
1327
1364
  if (table != null) {
1328
1365
  div_.addTag('p').setAttribute('style', 'color: Navy').tx('Because of the way that this value set is defined, not all the possible codes can be listed in advance');
@@ -107,10 +107,11 @@ class MetadataHandler {
107
107
  * @returns {Object} CapabilityStatement resource
108
108
  */
109
109
  buildCapabilityStatement(endpoint) {
110
+
110
111
  const now = new Date().toISOString();
111
112
  const fhirVersion = this.mapFhirVersion(endpoint.fhirVersion);
112
113
  const baseUrl = this.config.baseUrl || `https://${this.host}${endpoint.path}`;
113
- const serverVersion = this.config.serverVersion || '1.0.0';
114
+ const serverVersion = this.config.serverVersion;
114
115
 
115
116
  return {
116
117
  resourceType: 'CapabilityStatement',
@@ -124,7 +125,7 @@ class MetadataHandler {
124
125
  },
125
126
  {
126
127
  'url' : 'value',
127
- 'valueCode' : '1.8.0'
128
+ 'valueCode' : this.config.txVersion
128
129
  },
129
130
  {
130
131
  'extension' : [
@@ -80,6 +80,7 @@ class ReadWorker extends TerminologyWorker {
80
80
  async handleCodeSystem(req, res, id) {
81
81
  let cs = this.provider.getCodeSystemById(this.opContext, id);
82
82
  if (cs != null) {
83
+ req.sourcePackage = cs.sourcePackage;
83
84
  return res.json(cs.jsonObj);
84
85
  }
85
86
 
@@ -145,6 +146,7 @@ class ReadWorker extends TerminologyWorker {
145
146
  this.deadCheck('handleValueSet-loop');
146
147
  const vs = await vsp.fetchValueSetById(id);
147
148
  if (vs) {
149
+ req.sourcePackage = vs.sourcePackage;
148
150
  return res.json(vs.jsonObj);
149
151
  }
150
152
  }
@@ -165,9 +167,10 @@ class ReadWorker extends TerminologyWorker {
165
167
  // Iterate through valueSetProviders in order
166
168
  for (const cmsp of this.provider.conceptMapProviders) {
167
169
  this.deadCheck('handleConceptMap-loop');
168
- const vs = await cmsp.fetchConceptMapById(id);
169
- if (vs) {
170
- return res.json(vs.jsonObj);
170
+ const cm = await cmsp.fetchConceptMapById(id);
171
+ if (cm) {
172
+ req.sourcePackage = cm.sourcePackage;
173
+ return res.json(cm.jsonObj);
171
174
  }
172
175
  }
173
176