fhirsmith 0.7.4 → 0.7.5

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/tx/library.js CHANGED
@@ -101,6 +101,7 @@ class Library {
101
101
  this.conceptMapProviders = [];
102
102
  this.oclProviderSets = new Map();
103
103
  this.oclConfig = {};
104
+ this.ignored = new Set();
104
105
 
105
106
  // Create package manager for FHIR packages
106
107
  const packageServers = ['https://packages2.fhir.org/packages'];
@@ -161,6 +162,7 @@ class Library {
161
162
  const config = yaml.parse(yamlContent);
162
163
  this.baseUrl = config.base.url;
163
164
  this.oclConfig = config.ocl && typeof config.ocl === 'object' ? config.ocl : {};
165
+ this.ignored = new Set(Array.isArray(config.ignored) ? config.ignored : []);
164
166
 
165
167
  this.log.info('Fetching Data from '+this.baseUrl);
166
168
 
@@ -288,7 +290,7 @@ class Library {
288
290
  case 'ocl':
289
291
  await this.loadOcl(details, isDefault, mode);
290
292
  break;
291
-
293
+
292
294
  default:
293
295
  throw new Error(`Unknown source type: ${type}`);
294
296
  }
@@ -567,6 +569,17 @@ class Library {
567
569
  this.registerProvider(omopFN, omop, isDefault);
568
570
  }
569
571
 
572
+ /**
573
+ * Returns true if the given url/version should be excluded from npm/url package loading.
574
+ * Matches against the ignored list using either plain url or url#version.
575
+ */
576
+ #isIgnored(url, version) {
577
+ if (this.ignored.size === 0) return false;
578
+ if (this.ignored.has(url)) return true;
579
+ if (version && this.ignored.has(`${url}#${version}`)) return true;
580
+ return false;
581
+ }
582
+
570
583
  async loadNpm(packageManager, details, isDefault, mode, csOnly) {
571
584
  // Parse packageId and version from details (e.g., "hl7.terminology.r4#6.0.2")
572
585
  let packageId = details;
@@ -591,6 +604,10 @@ class Library {
591
604
  let csc = 0;
592
605
  for (const resource of resources) {
593
606
  const cs = new CodeSystem(await contentLoader.loadFile(resource, contentLoader.fhirVersion()));
607
+ if (this.#isIgnored(cs.url, cs.version)) {
608
+ this.log.info(`Ignoring CodeSystem ${cs.url}${cs.version ? '#' + cs.version : ''} (excluded by config)`);
609
+ continue;
610
+ }
594
611
  cs.sourcePackage = contentLoader.pid();
595
612
  cp.codeSystems.push(cs);
596
613
  csc++;
@@ -625,6 +642,10 @@ class Library {
625
642
  let csc = 0;
626
643
  for (const resource of resources) {
627
644
  const cs = new CodeSystem(await contentLoader.loadFile(resource, contentLoader.fhirVersion()));
645
+ if (this.#isIgnored(cs.url, cs.version)) {
646
+ this.log.info(`Ignoring CodeSystem ${cs.url}${cs.version ? '#' + cs.version : ''} (excluded by config)`);
647
+ continue;
648
+ }
628
649
  cs.sourcePackage = contentLoader.pid();
629
650
  cp.codeSystems.set(cs.url, cs);
630
651
  cp.codeSystems.set(cs.vurl, cs);
@@ -905,4 +926,4 @@ class Library {
905
926
 
906
927
  }
907
928
 
908
- module.exports = { Library };
929
+ module.exports = { Library };
@@ -40,3 +40,6 @@ sources:
40
40
  - npm:us.cdc.phinvads
41
41
  - npm:hl7.fhir.uv.sdc
42
42
  - internal:vsac
43
+
44
+ ignored:
45
+ - urn:iso:std:iso:3166#20210120
@@ -1389,17 +1389,22 @@ class ValueSetChecker {
1389
1389
  let hd = list.hasDisplay(this.params.workingLanguages(), null, c.display, false, DisplayCheckingStyle.CASE_INSENSITIVE)
1390
1390
  if (!hd.found) {
1391
1391
  let baseMsg;
1392
- if (hd.difference === DisplayDifference.Normalized) {
1392
+ let severity = this.dispWarning();
1393
+ if (list.userDefined) {
1394
+ baseMsg = 'Display_Name_Not_Fixed_use_Supplement';
1395
+ severity = 'information';
1396
+ } else if (hd.difference === DisplayDifference.Normalized) {
1393
1397
  baseMsg = 'Display_Name_WS_for__should_be_one_of__instead_of';
1394
1398
  } else {
1395
1399
  baseMsg = 'Display_Name_for__should_be_one_of__instead_of';
1396
1400
  }
1397
- let mid = baseMsg;
1398
1401
  let dc = list.displayCount(this.params.workingLanguages(), null, true);
1399
- let severity = this.dispWarning();
1400
- if (dc === 0) {
1401
- severity = 'warning';
1402
- dc = list.displayCount(this.params.workingLanguages(), null, false);
1402
+ let mid = baseMsg;
1403
+ if (severity !== 'information') {
1404
+ if (dc === 0) {
1405
+ severity = 'warning';
1406
+ dc = list.displayCount(this.params.workingLanguages(), null, false);
1407
+ }
1403
1408
  }
1404
1409
 
1405
1410
  let m, ds;
@@ -276,12 +276,9 @@ class TerminologyWorker {
276
276
  if (this.hasSupplement(cs, supplements)) {
277
277
  continue;
278
278
  }
279
- // Handle exact URL match (no version specified in supplements)
279
+ // Handle exact URL match (no version specified in supplements field)
280
280
  if (supplementsUrl === url) {
281
- // If we're looking for a specific version, only include if no version in supplements URL
282
- if (!version) {
283
- supplements.push(cs);
284
- }
281
+ supplements.push(cs);
285
282
  continue;
286
283
  }
287
284