fhirsmith 0.9.2 → 0.9.3

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.
@@ -351,7 +351,7 @@ class ValueSetChecker {
351
351
  let s = this.worker.pinValueSet(u);
352
352
  this.worker.deadCheck('prepareConceptSet');
353
353
  if (!this.others.has(s)) {
354
- let other = await this.worker.findValueSet(s, '');
354
+ let other = await this.worker.findValueSet(s, '', vs);
355
355
  if (other === null) {
356
356
  throw new Issue('error', 'not-found', null, 'Unable_to_resolve_value_Set_', this.worker.i18n.translate('Unable_to_resolve_value_Set_', this.params.HTTPLanguages, [s]), 'not-found', 422);
357
357
  }
@@ -472,7 +472,7 @@ class ValueSetChecker {
472
472
  this.worker.opContext.addNote(this.valueSet, 'Didn\'t find CodeSystem "' + this.worker.renderer.displayCoded(system, version) + '"', this.indentCount);
473
473
  result = null;
474
474
  cause.value = 'not-found';
475
- let vss = await this.worker.findValueSet(system, '');
475
+ let vss = await this.worker.findValueSet(system, '', null);
476
476
  if (vss !== null) {
477
477
  vss = null;
478
478
  let msg = this.worker.i18n.translate('Terminology_TX_System_ValueSet2', this.params.HTTPLanguages, [system]);
@@ -1154,7 +1154,7 @@ class ValueSetChecker {
1154
1154
  }
1155
1155
  let prov = await this.worker.findCodeSystem(ws, c.version, this.params, ['complete', 'fragment'], op,true, true, false, this.worker.requiredSupplements);
1156
1156
  if (prov === null) {
1157
- let vss = await this.worker.findValueSet(ws, '');
1157
+ let vss = await this.worker.findValueSet(ws, '', null);
1158
1158
  if (vss !== null) {
1159
1159
  vss = null;
1160
1160
  let m = this.worker.i18n.translate('Terminology_TX_System_ValueSet2', this.params.HTTPLanguages, [ws]);
@@ -1538,9 +1538,6 @@ class ValueSetChecker {
1538
1538
 
1539
1539
  async checkConceptSet(path, role, cs, cset, code, displays, vs, message, inactive, normalForm, vstatus, op, vcc, messages) {
1540
1540
  this.worker.opContext.addNote(vs, 'check code ' + role + ' ' + this.worker.renderer.displayValueSetInclude(cset) + ' at ' + path, this.indentCount);
1541
- if (role !== 'not in') {
1542
- inactive.value = false;
1543
- }
1544
1541
  let result = false;
1545
1542
  if (!cset.concept && !cset.filter) {
1546
1543
  let loc = await cs.locate(code);
@@ -1683,7 +1680,7 @@ class ValueSetChecker {
1683
1680
  if (!fc.value) {
1684
1681
  throw new Issue('error', 'invalid', null, 'UNABLE_TO_HANDLE_SYSTEM_FILTER_WITH_NO_VALUE', this.worker.i18n.translate('UNABLE_TO_HANDLE_SYSTEM_FILTER_WITH_NO_VALUE', this.params.HTTPLanguages, [cs.system(), fc.property, fc.op]));
1685
1682
  }
1686
- await cs.filter(prep, fc.property, fc.op, fc.value);
1683
+ await cs.filter(prep, false, fc.property, fc.op, fc.value);
1687
1684
  // if (f === null) {
1688
1685
  // throw new Issue('error', 'not-supported', null, 'FILTER_NOT_UNDERSTOOD', this.worker.i18n.translate('FILTER_NOT_UNDERSTOOD', this.params.HTTPLanguages, [fc.property, fc.op, fc.value, vs.vurl, cs.system()]) + ' (2)', 'vs-invalid');
1689
1686
  // }
@@ -2232,7 +2229,7 @@ class ValidateWorker extends TerminologyWorker {
2232
2229
  if (csp) {
2233
2230
  return csp;
2234
2231
  } else {
2235
- let vs = await this.findValueSet(url, version);
2232
+ let vs = await this.findValueSet(url, version, null);
2236
2233
  if (vs) {
2237
2234
  let msg = this.i18n.translate('Terminology_TX_System_ValueSet2', txParams.HTTPLanguages, [url]);
2238
2235
  throw new Issue('error', 'invalid', path, 'Terminology_TX_System_ValueSet2', msg, 'invalid-data');
@@ -2448,22 +2445,22 @@ class ValidateWorker extends TerminologyWorker {
2448
2445
  return defaultValue;
2449
2446
  }
2450
2447
 
2451
- /**
2452
- * Find a ValueSet by URL
2453
- * @param {string} url - ValueSet URL
2454
- * @param {string} [version] - ValueSet version
2455
- * @returns {Object|null} ValueSet resource or null
2456
- */
2457
- async findValueSet(url, version = null) {
2458
- // First check additional resources
2459
- const found = this.findInAdditionalResources(url, version || '', 'ValueSet', false);
2460
- if (found) {
2461
- return found;
2462
- }
2463
-
2464
- // Then check provider
2465
- return await this.provider.findValueSet(this.opContext, url, version);
2466
- }
2448
+ // /**
2449
+ // * Find a ValueSet by URL
2450
+ // * @param {string} url - ValueSet URL
2451
+ // * @param {string} [version] - ValueSet version
2452
+ // * @returns {Object|null} ValueSet resource or null
2453
+ // */
2454
+ // async findValueSet(url, version = null) {
2455
+ // // First check additional resources
2456
+ // const found = this.findInAdditionalResources(url, version || '', 'ValueSet', false);
2457
+ // if (found) {
2458
+ // return found;
2459
+ // }
2460
+ //
2461
+ // // Then check provider
2462
+ // return await this.provider.findValueSet(this.opContext, url, version);
2463
+ // }
2467
2464
 
2468
2465
  /**
2469
2466
  * Get display text for a code (stub implementation for doValidationCS)
@@ -340,10 +340,25 @@ class TerminologyWorker {
340
340
  * @param {string} version - ValueSet version (optional, overrides URL version)
341
341
  * @returns {ValueSet|null} Found ValueSet or null
342
342
  */
343
- async findValueSet(url, version = '') {
343
+ async findValueSet(url, version, source = '') {
344
344
  if (!url) {
345
345
  return null;
346
346
  }
347
+ if (url.startsWith("#")) {
348
+ if (source) {
349
+ if (source.jsonObj) {
350
+ source = source.jsonObj;
351
+ }
352
+ for (const contained of source.contained || []) {
353
+ if (contained.id === url.substring(1)) {
354
+ const ret = this.wrapRawResource(contained);
355
+ ret.isContained = true;
356
+ return ret;
357
+ }
358
+ }
359
+ }
360
+ return null;
361
+ }
347
362
 
348
363
  // Parse URL|version format
349
364
  let effectiveUrl = url;