fhirsmith 0.5.6 → 0.7.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +2 -0
  3. package/configurations/projector.json +21 -0
  4. package/configurations/readme.md +5 -0
  5. package/library/html-server.js +2 -1
  6. package/library/package-manager.js +37 -34
  7. package/library/utilities.js +10 -1
  8. package/library/version-utilities.js +85 -0
  9. package/package.json +1 -1
  10. package/packages/package-crawler.js +144 -52
  11. package/packages/packages.js +15 -7
  12. package/publisher/publisher.js +15 -3
  13. package/registry/api.js +173 -191
  14. package/registry/crawler.js +100 -65
  15. package/registry/model.js +14 -8
  16. package/registry/registry.js +5 -0
  17. package/root-template.html +1 -0
  18. package/server.js +113 -45
  19. package/tx/README.md +4 -4
  20. package/tx/cs/cs-api.js +18 -1
  21. package/tx/cs/cs-base.js +1 -0
  22. package/tx/cs/cs-loinc.js +5 -2
  23. package/tx/cs/cs-provider-api.js +25 -1
  24. package/tx/cs/cs-provider-list.js +2 -2
  25. package/tx/cs/cs-rxnorm.js +9 -2
  26. package/tx/cs/cs-snomed.js +17 -2
  27. package/tx/html/codesystem-operations.liquid +17 -24
  28. package/tx/html/valueset-operations.liquid +46 -52
  29. package/tx/library/canonical-resource.js +6 -1
  30. package/tx/library/codesystem.js +6 -1
  31. package/tx/library/renderer.js +81 -7
  32. package/tx/library.js +145 -13
  33. package/tx/ocl/README.md +236 -0
  34. package/tx/ocl/cache/cache-paths.cjs +32 -0
  35. package/tx/ocl/cache/cache-paths.js +2 -0
  36. package/tx/ocl/cache/cache-utils.cjs +43 -0
  37. package/tx/ocl/cache/cache-utils.js +2 -0
  38. package/tx/ocl/cm-ocl.cjs +531 -0
  39. package/tx/ocl/cm-ocl.js +1 -105
  40. package/tx/ocl/cs-ocl.cjs +1779 -0
  41. package/tx/ocl/cs-ocl.js +1 -38
  42. package/tx/ocl/fingerprint/fingerprint.cjs +67 -0
  43. package/tx/ocl/fingerprint/fingerprint.js +2 -0
  44. package/tx/ocl/http/client.cjs +31 -0
  45. package/tx/ocl/http/client.js +2 -0
  46. package/tx/ocl/http/pagination.cjs +98 -0
  47. package/tx/ocl/http/pagination.js +2 -0
  48. package/tx/ocl/jobs/background-queue.cjs +200 -0
  49. package/tx/ocl/jobs/background-queue.js +2 -0
  50. package/tx/ocl/mappers/concept-mapper.cjs +66 -0
  51. package/tx/ocl/mappers/concept-mapper.js +2 -0
  52. package/tx/ocl/model/concept-filter-context.cjs +51 -0
  53. package/tx/ocl/model/concept-filter-context.js +2 -0
  54. package/tx/ocl/shared/constants.cjs +15 -0
  55. package/tx/ocl/shared/constants.js +2 -0
  56. package/tx/ocl/shared/patches.cjs +224 -0
  57. package/tx/ocl/shared/patches.js +2 -0
  58. package/tx/ocl/vs-ocl.cjs +1848 -0
  59. package/tx/ocl/vs-ocl.js +1 -104
  60. package/tx/operation-context.js +8 -1
  61. package/tx/params.js +24 -3
  62. package/tx/provider.js +51 -2
  63. package/tx/sct/expressions.js +20 -9
  64. package/tx/tx-html.js +144 -51
  65. package/tx/tx.js +10 -2
  66. package/tx/vs/vs-vsac.js +4 -3
  67. package/tx/workers/batch-validate.js +3 -2
  68. package/tx/workers/batch.js +3 -2
  69. package/tx/workers/expand.js +125 -18
  70. package/tx/workers/lookup.js +5 -4
  71. package/tx/workers/read.js +2 -1
  72. package/tx/workers/related.js +3 -2
  73. package/tx/workers/search.js +6 -8
  74. package/tx/workers/subsumes.js +3 -2
  75. package/tx/workers/translate.js +4 -3
  76. package/tx/workers/validate.js +132 -40
  77. package/tx/workers/worker.js +1 -7
  78. package/tx/xversion/xv-terminologyCapabilities.js +1 -1
package/tx/vs/vs-vsac.js CHANGED
@@ -4,6 +4,7 @@ const { AbstractValueSetProvider } = require('./vs-api');
4
4
  const { ValueSetDatabase } = require('./vs-database');
5
5
  const { VersionUtilities } = require('../../library/version-utilities');
6
6
  const folders = require('../../library/folder-setup');
7
+ const {debugLog} = require("../operation-context");
7
8
 
8
9
  /**
9
10
  * VSAC (Value Set Authority Center) ValueSet provider
@@ -178,7 +179,7 @@ class VSACValueSetProvider extends AbstractValueSetProvider {
178
179
  await this.processContentAndHistory(q, tracking, this.queue.length);
179
180
  } catch (error) {
180
181
  this.requeue.push(q)
181
- console.log(error);
182
+ debugLog(error);
182
183
  this.stats.task('VSAC Sync', error.message);
183
184
  }
184
185
  // `running (${totalFetched} fetched, ${totalNew} new)`)
@@ -190,7 +191,7 @@ class VSACValueSetProvider extends AbstractValueSetProvider {
190
191
  try {
191
192
  await this.processContentAndHistory(q, tracking, this.requeue.length);
192
193
  } catch (error) {
193
- console.log(error);
194
+ debugLog(error);
194
195
  this.stats.task('VSAC Sync', error.message);
195
196
  }
196
197
  // `running (${totalFetched} fetched, ${totalNew} new)`)
@@ -201,7 +202,7 @@ class VSACValueSetProvider extends AbstractValueSetProvider {
201
202
  await this._reloadMap();
202
203
  console.log(`VSAC refresh completed. Total: ${tracking.totalFetched} ValueSets, Deleted: ${tracking.deletedCount}`);
203
204
  } catch (error) {
204
- console.log(error, 'Error during VSAC refresh:');
205
+ debugLog(error, 'Error during VSAC refresh:');
205
206
  this.stats.task('VSAC Sync', `Error (${error.message})`);
206
207
  throw error;
207
208
  } finally {
@@ -15,6 +15,7 @@ const { TerminologyWorker } = require('./worker');
15
15
  const {OperationOutcome, Issue} = require("../library/operation-outcome");
16
16
  const {Parameters} = require("../library/parameters");
17
17
  const {ValidateWorker} = require("./validate");
18
+ const {debugLog} = require("../operation-context");
18
19
 
19
20
  class BatchValidateWorker extends TerminologyWorker {
20
21
 
@@ -82,7 +83,7 @@ class BatchValidateWorker extends TerminologyWorker {
82
83
  output.push({name: "validation", resource : p});
83
84
  } catch (error) {
84
85
  this.log.error(error);
85
- this.debugLog(error);
86
+ debugLog(error);
86
87
  if (error instanceof Issue) {
87
88
  let op = new OperationOutcome();
88
89
  op.addIssue(error);
@@ -98,7 +99,7 @@ class BatchValidateWorker extends TerminologyWorker {
98
99
  return res.json(result);
99
100
  } catch (error) {
100
101
  this.log.error(error);
101
- this.debugLog(error);
102
+ debugLog(error);
102
103
  return res.status(error.statusCode || 500).json(this.operationOutcome(
103
104
  'error', error.issueCode || 'exception', error.message));
104
105
  }
@@ -6,6 +6,7 @@
6
6
 
7
7
  const { TerminologyWorker } = require('./worker');
8
8
  const { Issue, OperationOutcome } = require('../library/operation-outcome');
9
+ const {debugLog} = require("../operation-context");
9
10
 
10
11
  class BatchWorker extends TerminologyWorker {
11
12
  /**
@@ -40,7 +41,7 @@ class BatchWorker extends TerminologyWorker {
40
41
  await this.handleBatch(req, res);
41
42
  } catch (error) {
42
43
  this.log.error(error);
43
- this.debugLog(error);
44
+ debugLog(error);
44
45
  if (error instanceof Issue) {
45
46
  const oo = new OperationOutcome();
46
47
  oo.addIssue(error);
@@ -160,7 +161,7 @@ class BatchWorker extends TerminologyWorker {
160
161
 
161
162
  } catch (error) {
162
163
  this.log.error(error);
163
- this.debugLog(error);
164
+ debugLog(error);
164
165
  const statusCode = error.statusCode || 500;
165
166
  const issueCode = error.issueCode || 'exception';
166
167
 
@@ -18,6 +18,7 @@ const {Issue, OperationOutcome} = require("../library/operation-outcome");
18
18
  const crypto = require('crypto');
19
19
  const ValueSet = require("../library/valueset");
20
20
  const {VersionUtilities} = require("../../library/version-utilities");
21
+ const {debugLog} = require("../operation-context");
21
22
 
22
23
  // Expansion limits (from Pascal constants)
23
24
  const EXTERNAL_DEFAULT_LIMIT = 1000;
@@ -197,6 +198,7 @@ class ValueSetCounter {
197
198
  class ValueSetExpander {
198
199
  worker;
199
200
  params;
201
+ doingVersion = true;
200
202
  excludedSystems = new Set();
201
203
  excluded = new Set();
202
204
  hasExclusions = false;
@@ -495,7 +497,8 @@ class ValueSetExpander {
495
497
  }
496
498
  }
497
499
 
498
- this.excluded.add(system + '|' + version + '#' + code);
500
+ let key = (this.doingVersion && !this.params.versionsMatch ? system + '|' + version : system) + '#' + code
501
+ this.excluded.add(key);
499
502
  }
500
503
 
501
504
  async checkCanExpandValueSet(uri, version) {
@@ -922,8 +925,20 @@ class ValueSetExpander {
922
925
  if (!cset.concept && !cset.filter) {
923
926
  this.worker.opContext.log('handle system');
924
927
  if (!cset.valueSet) {
925
- // excluding a whole system - we don't list the codes in this case
926
- this.excludedSystems.add(cset.system + (cset.version ? '|'+cset.version : ''));
928
+ if (!this.excludeSpecialCase) {
929
+ // excluding a whole system - we don't list the codes in this case
930
+ this.excludedSystems.add(cset.system + (this.doingVersion && cset.version ? '|' + cset.version : ''));
931
+ } else {
932
+ const iter = await cs.iteratorAll();
933
+ if (iter) {
934
+ let c = await cs.nextContext(iter);
935
+ while (c) {
936
+ this.worker.deadCheck('processCodes#3aa');
937
+ this.excludeCode(cs, cs.system(), cs.version(), await cs.code(c), expansion, valueSets, vsSrc.url);
938
+ c = await cs.nextContext(iter);
939
+ }
940
+ }
941
+ }
927
942
  } else {
928
943
  if (cs.isNotClosed(filter)) {
929
944
  if (cs.specialEnumeration()) {
@@ -1081,6 +1096,7 @@ class ValueSetExpander {
1081
1096
  async handleCompose(source, filter, expansion, notClosed, vsInfo) {
1082
1097
  this.worker.opContext.log('compose #1');
1083
1098
 
1099
+ this.doingVersion = false;
1084
1100
  const ts = new Map();
1085
1101
  for (const c of source.jsonObj.compose.include || []) {
1086
1102
  this.worker.deadCheck('handleCompose#2');
@@ -1097,6 +1113,8 @@ class ValueSetExpander {
1097
1113
  if (vsInfo.handleByCS) {
1098
1114
  await this.processCodes("ValueSet.compose", source, source.jsonObj.compose, filter, expansion, this.excludeInactives(source), notClosed, vsInfo);
1099
1115
  } else {
1116
+ this.checkForExclusionVersionSpecialCase(source, expansion);
1117
+
1100
1118
  let i = 0;
1101
1119
  for (const c of source.jsonObj.compose.exclude || []) {
1102
1120
  this.worker.deadCheck('handleCompose#4');
@@ -1104,7 +1122,14 @@ class ValueSetExpander {
1104
1122
  }
1105
1123
 
1106
1124
  i = 0;
1107
- for (const c of source.jsonObj.compose.include || []) {
1125
+ const includes = [...(source.jsonObj.compose.include || [])];
1126
+ includes.sort((a, b) => {
1127
+ if (a.system === b.system && a.version && b.version) {
1128
+ return -VersionUtilities.compareVersionsGeneral(a.version, b.version);
1129
+ }
1130
+ return 0;
1131
+ });
1132
+ for (const c of includes) {
1108
1133
  this.worker.deadCheck('handleCompose#5');
1109
1134
  await this.includeCodes(c, "ValueSet.compose.include[" + i + "]", source, source.jsonObj.compose, filter, expansion, this.excludeInactives(source), notClosed);
1110
1135
  i++;
@@ -1197,6 +1222,9 @@ class ValueSetExpander {
1197
1222
  if (this.params.hasExcludeNested) {
1198
1223
  this.addParamBool(exp, 'excludeNested', this.params.excludeNested);
1199
1224
  }
1225
+ if (this.params.versionsMatch) {
1226
+ this.addParamBool(exp, 'versionsMatch', this.params.versionsMatch);
1227
+ }
1200
1228
  if (this.params.hasActiveOnly) {
1201
1229
  this.addParamBool(exp, 'activeOnly', this.params.activeOnly);
1202
1230
  }
@@ -1388,17 +1416,28 @@ class ValueSetExpander {
1388
1416
  }
1389
1417
 
1390
1418
  checkCanonicalStatus(exp, vurl, status, standardsStatus, experimental, source) {
1419
+ let sourceStatus = source ? source.status : undefined;
1420
+ let sourceStandardsStatus= source ? Extensions.readString(source, 'http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status') : undefined;
1391
1421
  if (standardsStatus == 'deprecated') {
1392
- this.addParamUri(exp, 'warning-deprecated', vurl);
1422
+ if (sourceStandardsStatus != 'deprecated') {
1423
+ this.addParamUri(exp, 'warning-deprecated', vurl);
1424
+ }
1393
1425
  } else if (standardsStatus == 'withdrawn') {
1394
- this.addParamUri(exp, 'warning-withdrawn', vurl);
1426
+ if (sourceStandardsStatus != 'withdrawn') {
1427
+ this.addParamUri(exp, 'warning-withdrawn', vurl);
1428
+ }
1395
1429
  } else if (status == 'retired') {
1396
- this.addParamUri(exp, 'warning-retired', vurl);
1397
- } else if (experimental && !source.experimental) {
1398
- this.addParamUri(exp, 'warning-experimental', vurl)
1399
- } else if (((status == 'draft') || (standardsStatus == 'draft')) &&
1400
- !((source.status == 'draft') || (Extensions.readString(source, 'http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status') == 'draft'))) {
1401
- this.addParamUri(exp, 'warning-draft', vurl)
1430
+ if (sourceStatus != 'retired') {
1431
+ this.addParamUri(exp, 'warning-retired', vurl);
1432
+ }
1433
+ } else if (experimental) {
1434
+ if (!source.experimental) {
1435
+ this.addParamUri(exp, 'warning-experimental', vurl);
1436
+ }
1437
+ } else if (((status == 'draft') || (standardsStatus == 'draft'))) {
1438
+ if (!((source.status == 'draft') || (Extensions.readString(source, 'http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status') == 'draft'))) {
1439
+ this.addParamUri(exp, 'warning-draft', vurl)
1440
+ }
1402
1441
  }
1403
1442
  }
1404
1443
 
@@ -1470,14 +1509,16 @@ class ValueSetExpander {
1470
1509
  if (this.excludedSystems.has(system)) {
1471
1510
  return true;
1472
1511
  }
1473
- if (this.excludedSystems.has(system+'|'+version)) {
1512
+ let key = this.doingVersion && !this.params.versionsMatch? system+'|'+version : system;
1513
+ if (this.excludedSystems.has(key)) {
1474
1514
  return true;
1475
1515
  }
1476
- return this.excluded.has(system+'|'+version+'#'+code);
1516
+ key = (this.doingVersion && !this.params.versionsMatch ? system+'|'+version : system)+'#'+code;
1517
+ return this.excluded.has(key);
1477
1518
  }
1478
1519
 
1479
1520
  keyS(system, version, code) {
1480
- return system+"~"+(this.doingVersion ? version+"~" : "")+code;
1521
+ return system+"~"+(this.doingVersion && !this.params.versionsMatch ? version+"~" : "")+code;
1481
1522
  }
1482
1523
 
1483
1524
  keyC(contains) {
@@ -1625,6 +1666,31 @@ class ValueSetExpander {
1625
1666
  }
1626
1667
  return null;
1627
1668
  }
1669
+
1670
+
1671
+ // special case: excluding a different version from the include
1672
+ checkForExclusionVersionSpecialCase(source, exp) {
1673
+ if (!this.params.hasVersionsMatch) {
1674
+
1675
+
1676
+ const includes = source.jsonObj.compose.include || [];
1677
+ const excludes = source.jsonObj.compose.exclude || [];
1678
+
1679
+ if (includes.length > 0 && excludes.length > 0) {
1680
+ const system = includes[0].system;
1681
+ const allSameSystem = includes.every(i => i.system === system && i.version)
1682
+ && excludes.every(e => e.system === system && e.version);
1683
+ const noOverlap = !includes.some(i => excludes.some(e => e.version === i.version));
1684
+
1685
+ if (allSameSystem && noOverlap) {
1686
+ this.params.versionsMatch = true;
1687
+ this.excludeSpecialCase = true;
1688
+ this.addParamBool(exp, 'versionsMatch', this.params.versionsMatch);
1689
+
1690
+ }
1691
+ }
1692
+ }
1693
+ }
1628
1694
  }
1629
1695
 
1630
1696
  class ExpandWorker extends TerminologyWorker {
@@ -1665,7 +1731,7 @@ class ExpandWorker extends TerminologyWorker {
1665
1731
  await this.handleTypeLevelExpand(req, res);
1666
1732
  } catch (error) {
1667
1733
  this.log.error(error);
1668
- this.debugLog(error);
1734
+ debugLog(error);
1669
1735
  req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
1670
1736
  const statusCode = error.statusCode || 500;
1671
1737
  if (error instanceof Issue) {
@@ -1700,7 +1766,7 @@ class ExpandWorker extends TerminologyWorker {
1700
1766
  await this.handleInstanceLevelExpand(req, res);
1701
1767
  } catch (error) {
1702
1768
  this.log.error(error);
1703
- this.debugLog(error);
1769
+ debugLog(error);
1704
1770
  req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
1705
1771
  const statusCode = error.statusCode || 500;
1706
1772
  const issueCode = error.issueCode || 'exception';
@@ -1797,7 +1863,48 @@ class ExpandWorker extends TerminologyWorker {
1797
1863
  req.logInfo = this.usedSources.join("|")+txp.logInfo();
1798
1864
  return res.json(result);
1799
1865
  }
1800
-
1866
+
1867
+ /**
1868
+ * Handle type-level expand: /ValueSet/$expand
1869
+ * ValueSet identified by url, or provided directly in body
1870
+ */
1871
+ async handleInternalExpand(valueSet, req) {
1872
+ this.deadCheck('expand-internal');
1873
+
1874
+ if (!valueSet.jsonObj) {
1875
+ valueSet = new ValueSet(valueSet);
1876
+ }
1877
+ // Determine how the request is structured
1878
+ let params = null;
1879
+ this.seeSourceVS(valueSet);
1880
+
1881
+ if (req.method === 'POST' && req.body) {
1882
+ if (req.body.resourceType === 'ValueSet') {
1883
+ params = this.queryToParameters(req.query);
1884
+ } else if (req.body.resourceType === 'Parameters') {
1885
+ // Body is a Parameters resource
1886
+ params = req.body;
1887
+ } else {
1888
+ // Assume form body - convert to Parameters
1889
+ params = this.formToParameters(req.body, req.query);
1890
+ }
1891
+ } else {
1892
+ // GET request - convert query to Parameters
1893
+ params = this.queryToParameters(req.query);
1894
+ }
1895
+ this.addHttpParams(req, params);
1896
+
1897
+ // Handle tx-resource and cache-id parameters
1898
+ this.setupAdditionalResources(params);
1899
+ const logExtraOutput = this.findParameter(params, 'logExtraOutput');
1900
+
1901
+ let txp = new TxParameters(this.opContext.i18n.languageDefinitions, this.opContext.i18n, false);
1902
+ txp.readParams(params);
1903
+
1904
+ // Perform the expansion
1905
+ return await this.doExpand(valueSet, txp, logExtraOutput);
1906
+ }
1907
+
1801
1908
  /**
1802
1909
  * Handle instance-level expand: /ValueSet/{id}/$expand
1803
1910
  * ValueSet identified by resource ID
@@ -13,6 +13,7 @@ const { Designations} = require("../library/designations");
13
13
  const {TxParameters} = require("../params");
14
14
  const {Parameters} = require("../library/parameters");
15
15
  const {Issue, OperationOutcome} = require("../library/operation-outcome");
16
+ const {debugLog} = require("../operation-context");
16
17
 
17
18
  class LookupWorker extends TerminologyWorker {
18
19
  /**
@@ -45,7 +46,7 @@ class LookupWorker extends TerminologyWorker {
45
46
  await this.handleTypeLevelLookup(req, res);
46
47
  } catch (error) {
47
48
  this.log.error(error);
48
- this.debugLog(error);
49
+ debugLog(error);
49
50
  req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
50
51
  const statusCode = error.statusCode || 500;
51
52
  const issueCode = error.issueCode || 'exception';
@@ -72,7 +73,7 @@ class LookupWorker extends TerminologyWorker {
72
73
  await this.handleInstanceLevelLookup(req, res);
73
74
  } catch (error) {
74
75
  this.log.error(error);
75
- this.debugLog(error);
76
+ debugLog(error);
76
77
  req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
77
78
  const issueCode = error.issueCode || 'exception';
78
79
  return res.status(400).json({
@@ -159,7 +160,7 @@ class LookupWorker extends TerminologyWorker {
159
160
  return res.status(200).json(result);
160
161
  } catch (error) {
161
162
  this.log.error(error);
162
- this.debugLog(error);
163
+ debugLog(error);
163
164
  req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
164
165
  if (error instanceof Issue) {
165
166
  let oo = new OperationOutcome();
@@ -223,7 +224,7 @@ class LookupWorker extends TerminologyWorker {
223
224
  return res.status(200).json(result);
224
225
  } catch (error) {
225
226
  this.log.error(error);
226
- this.debugLog(error);
227
+ debugLog(error);
227
228
  req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
228
229
  if (error instanceof Issue) {
229
230
  let oo = new OperationOutcome();
@@ -5,6 +5,7 @@
5
5
  //
6
6
 
7
7
  const { TerminologyWorker } = require('./worker');
8
+ const {debugLog} = require("../operation-context");
8
9
 
9
10
  class ReadWorker extends TerminologyWorker {
10
11
  /**
@@ -67,7 +68,7 @@ class ReadWorker extends TerminologyWorker {
67
68
  }
68
69
  } catch (error) {
69
70
  this.log.error(error);
70
- this.debugLog(error);
71
+ debugLog(error);
71
72
  req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
72
73
  return res.status(500).json({
73
74
  resourceType: 'OperationOutcome',
@@ -16,6 +16,7 @@ const ValueSet = require("../library/valueset");
16
16
  const {ValueSetExpander} = require("./expand");
17
17
  const {SearchFilterText} = require("../library/designations");
18
18
  const {ArrayMatcher} = require("../../library/utilities");
19
+ const {debugLog} = require("../operation-context");
19
20
 
20
21
 
21
22
  class RelatedWorker extends TerminologyWorker {
@@ -49,7 +50,7 @@ class RelatedWorker extends TerminologyWorker {
49
50
  await this.handleTypeLevelRelated(req, res);
50
51
  } catch (error) {
51
52
  this.log.error(error);
52
- this.debugLog(error);
53
+ debugLog(error);
53
54
  req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
54
55
  const statusCode = error.statusCode || 500;
55
56
  if (error instanceof Issue) {
@@ -84,7 +85,7 @@ class RelatedWorker extends TerminologyWorker {
84
85
  await this.handleInstanceLevelRelated(req, res);
85
86
  } catch (error) {
86
87
  this.log.error(error);
87
- this.debugLog(error);
88
+ debugLog(error);
88
89
  req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
89
90
  const statusCode = error.statusCode || 500;
90
91
  const issueCode = error.issueCode || 'exception';
@@ -7,6 +7,7 @@
7
7
 
8
8
  const { TerminologyWorker } = require('./worker');
9
9
  const {Utilities} = require("../../library/utilities");
10
+ const {debugLog} = require("../operation-context");
10
11
 
11
12
  class SearchWorker extends TerminologyWorker {
12
13
  /**
@@ -114,7 +115,7 @@ class SearchWorker extends TerminologyWorker {
114
115
 
115
116
  } catch (error) {
116
117
  this.log.error(error);
117
- this.debugLog(error);
118
+ debugLog(error);
118
119
  req.logInfo = "error "+(error.msgId || error.className);
119
120
  return res.status(500).json({
120
121
  resourceType: 'OperationOutcome',
@@ -137,7 +138,7 @@ class SearchWorker extends TerminologyWorker {
137
138
  const searchParams = {};
138
139
  for (const [key, value] of Object.entries(params)) {
139
140
  if (!key.startsWith('_') && value && SearchWorker.ALLOWED_PARAMS.includes(key)) {
140
- searchParams[key] = value.toLowerCase();
141
+ searchParams[key] = key == 'url' ? value : value.toLowerCase();
141
142
  }
142
143
  }
143
144
 
@@ -146,6 +147,7 @@ class SearchWorker extends TerminologyWorker {
146
147
 
147
148
  for (const [key, cs] of this.provider.codeSystems) {
148
149
  this.deadCheck('searchCodeSystems');
150
+
149
151
  if (key == cs.vurl) {
150
152
  const json = cs.jsonObj;
151
153
 
@@ -157,10 +159,6 @@ class SearchWorker extends TerminologyWorker {
157
159
  // Check each search parameter for partial match
158
160
  let isMatch = true;
159
161
  for (const [param, searchValue] of Object.entries(searchParams)) {
160
- // 'system' doesn't do anything for CodeSystem search
161
- if (param === 'system') {
162
- continue;
163
- }
164
162
 
165
163
  // Map content-mode to content property
166
164
  const jsonProp = param === 'content-mode' ? 'content' : param;
@@ -177,9 +175,9 @@ class SearchWorker extends TerminologyWorker {
177
175
  isMatch = false;
178
176
  break;
179
177
  }
180
- } else if (param === 'url') { // exact match
178
+ } else if (param === 'url' || param === 'system') { // exact match
181
179
  const propValue = json.url;
182
- if (propValue != searchValue) {
180
+ if (propValue !== searchValue) {
183
181
  isMatch = false;
184
182
  break;
185
183
  }
@@ -12,6 +12,7 @@ const { FhirCodeSystemProvider } = require('../cs/cs-cs');
12
12
  const {TxParameters} = require("../params");
13
13
  const {Parameters} = require("../library/parameters");
14
14
  const {Issue, OperationOutcome} = require("../library/operation-outcome");
15
+ const {debugLog} = require("../operation-context");
15
16
  class SubsumesWorker extends TerminologyWorker {
16
17
  /**
17
18
  * @param {OperationContext} opContext - Operation context
@@ -43,7 +44,7 @@ class SubsumesWorker extends TerminologyWorker {
43
44
  await this.handleTypeLevelSubsumes(req, res);
44
45
  } catch (error) {
45
46
  this.log.error(error);
46
- this.debugLog(error);
47
+ debugLog(error);
47
48
  req.logInfo = "error "+(error.msgId || error.className);
48
49
  if (error instanceof Issue) {
49
50
  let oo = new OperationOutcome();
@@ -67,7 +68,7 @@ class SubsumesWorker extends TerminologyWorker {
67
68
  await this.handleInstanceLevelSubsumes(req, res);
68
69
  } catch (error) {
69
70
  this.log.error(error);
70
- this.debugLog(error);
71
+ debugLog(error);
71
72
  if (error instanceof Issue) {
72
73
  let oo = new OperationOutcome();
73
74
  oo.addIssue(error);
@@ -12,6 +12,7 @@ const { TxParameters } = require('../params');
12
12
  const { Parameters } = require('../library/parameters');
13
13
  const { Issue, OperationOutcome } = require('../library/operation-outcome');
14
14
  const {ConceptMap} = require("../library/conceptmap");
15
+ const {debugLog} = require("../operation-context");
15
16
 
16
17
  class TranslateWorker extends TerminologyWorker {
17
18
  /**
@@ -44,7 +45,7 @@ class TranslateWorker extends TerminologyWorker {
44
45
  await this.handleTypeLevelTranslate(req, res);
45
46
  } catch (error) {
46
47
  this.log.error(error);
47
- this.debugLog(error);
48
+ debugLog(error);
48
49
  if (error instanceof Issue) {
49
50
  const oo = new OperationOutcome();
50
51
  oo.addIssue(error);
@@ -67,7 +68,7 @@ class TranslateWorker extends TerminologyWorker {
67
68
  await this.handleInstanceLevelTranslate(req, res);
68
69
  } catch (error) {
69
70
  this.log.error(error);
70
- this.debugLog(error);
71
+ debugLog(error);
71
72
  if (error instanceof Issue) {
72
73
  const oo = new OperationOutcome();
73
74
  oo.addIssue(error);
@@ -410,7 +411,7 @@ class TranslateWorker extends TerminologyWorker {
410
411
  }
411
412
  } catch (error) {
412
413
  this.log.error(error);
413
- this.debugLog(error);
414
+ debugLog(error);
414
415
  result.push({
415
416
  name: 'result',
416
417
  valueBoolean: false