fhirsmith 0.4.2 → 0.5.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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/library/cron-utilities.js +136 -0
- package/library/html-server.js +13 -29
- package/library/html.js +3 -8
- package/library/languages.js +160 -37
- package/library/package-manager.js +48 -1
- package/library/utilities.js +100 -19
- package/package.json +2 -2
- package/packages/package-crawler.js +6 -1
- package/packages/packages.js +38 -54
- package/publisher/publisher.js +19 -27
- package/registry/api.js +11 -10
- package/registry/crawler.js +31 -29
- package/registry/model.js +5 -26
- package/registry/registry.js +32 -41
- package/server.js +53 -5
- package/shl/shl.js +0 -18
- package/static/assets/js/statuspage.js +1 -9
- package/stats.js +39 -1
- package/token/token.js +14 -9
- package/translations/Messages.properties +2 -1
- package/tx/README.md +17 -6
- package/tx/cs/cs-api.js +19 -1
- package/tx/cs/cs-base.js +77 -0
- package/tx/cs/cs-country.js +46 -0
- package/tx/cs/cs-cpt.js +9 -5
- package/tx/cs/cs-cs.js +27 -13
- package/tx/cs/cs-lang.js +60 -22
- package/tx/cs/cs-loinc.js +69 -98
- package/tx/cs/cs-mimetypes.js +4 -0
- package/tx/cs/cs-ndc.js +6 -0
- package/tx/cs/cs-omop.js +16 -15
- package/tx/cs/cs-rxnorm.js +23 -1
- package/tx/cs/cs-snomed.js +283 -40
- package/tx/cs/cs-ucum.js +90 -70
- package/tx/importers/import-sct.module.js +371 -35
- package/tx/importers/readme.md +117 -7
- package/tx/library/bundle.js +5 -0
- package/tx/library/capabilitystatement.js +3 -142
- package/tx/library/codesystem.js +19 -173
- package/tx/library/conceptmap.js +4 -218
- package/tx/library/designations.js +14 -1
- package/tx/library/extensions.js +7 -0
- package/tx/library/namingsystem.js +3 -89
- package/tx/library/operation-outcome.js +8 -3
- package/tx/library/parameters.js +3 -2
- package/tx/library/renderer.js +10 -6
- package/tx/library/terminologycapabilities.js +3 -243
- package/tx/library/valueset.js +3 -235
- package/tx/library.js +100 -13
- package/tx/operation-context.js +23 -4
- package/tx/params.js +35 -38
- package/tx/provider.js +6 -5
- package/tx/sct/expressions.js +12 -3
- package/tx/tx-html.js +80 -89
- package/tx/tx.fhir.org.yml +6 -5
- package/tx/tx.js +163 -13
- package/tx/vs/vs-database.js +56 -39
- package/tx/vs/vs-package.js +21 -2
- package/tx/vs/vs-vsac.js +175 -39
- package/tx/workers/batch-validate.js +2 -0
- package/tx/workers/batch.js +2 -0
- package/tx/workers/expand.js +132 -112
- package/tx/workers/lookup.js +33 -14
- package/tx/workers/metadata.js +2 -2
- package/tx/workers/read.js +3 -2
- package/tx/workers/related.js +574 -0
- package/tx/workers/search.js +46 -9
- package/tx/workers/subsumes.js +13 -3
- package/tx/workers/translate.js +7 -3
- package/tx/workers/validate.js +258 -285
- package/tx/workers/worker.js +43 -39
- package/tx/xml/bundle-xml.js +237 -0
- package/tx/xml/xml-base.js +215 -64
- package/tx/xversion/xv-bundle.js +71 -0
- package/tx/xversion/xv-capabiliityStatement.js +137 -0
- package/tx/xversion/xv-codesystem.js +169 -0
- package/tx/xversion/xv-conceptmap.js +224 -0
- package/tx/xversion/xv-namingsystem.js +88 -0
- package/tx/xversion/xv-operationoutcome.js +27 -0
- package/tx/xversion/xv-parameters.js +87 -0
- package/tx/xversion/xv-resource.js +45 -0
- package/tx/xversion/xv-terminologyCapabilities.js +214 -0
- package/tx/xversion/xv-valueset.js +234 -0
- package/utilities/dev-proxy-server.js +126 -0
- package/utilities/explode-results.js +58 -0
- package/utilities/split-by-system.js +198 -0
- package/utilities/vsac-cs-fetcher.js +0 -0
- package/{windows-install.js → utilities/windows-install.js} +2 -0
- package/vcl/vcl.js +0 -18
- package/xig/xig.js +108 -99
package/tx/params.js
CHANGED
|
@@ -34,6 +34,8 @@ class TxParameters {
|
|
|
34
34
|
limit = -1;
|
|
35
35
|
offset = -1;
|
|
36
36
|
validating = false;
|
|
37
|
+
abstractOk = true; // note true!
|
|
38
|
+
inferSystem = false;
|
|
37
39
|
|
|
38
40
|
constructor(languages, i18n, validating) {
|
|
39
41
|
validateParameter(languages, 'languages', LanguageDefinitions);
|
|
@@ -45,6 +47,7 @@ class TxParameters {
|
|
|
45
47
|
this.FVersionRules = [];
|
|
46
48
|
this.FProperties = [];
|
|
47
49
|
this.FDesignations = [];
|
|
50
|
+
this.supplements = new Set;
|
|
48
51
|
this.FGenerateNarrative = true;
|
|
49
52
|
|
|
50
53
|
this.FHTTPLanguages = null;
|
|
@@ -54,13 +57,11 @@ class TxParameters {
|
|
|
54
57
|
|
|
55
58
|
this.FActiveOnly = false;
|
|
56
59
|
this.FExcludeNested = false;
|
|
57
|
-
this.FLimitedExpansion = false;
|
|
58
60
|
this.FExcludeNotForUI = false;
|
|
59
61
|
this.FExcludePostCoordinated = false;
|
|
60
62
|
this.FIncludeDesignations = false;
|
|
61
63
|
this.FIncludeDefinition = false;
|
|
62
64
|
this.FDefaultToLatestVersion = false;
|
|
63
|
-
this.FIncompleteOK = false;
|
|
64
65
|
this.FDisplayWarning = false;
|
|
65
66
|
this.FMembershipOnly = false;
|
|
66
67
|
this.FDiagnostics = false;
|
|
@@ -68,13 +69,11 @@ class TxParameters {
|
|
|
68
69
|
this.hasActiveOnly = false;
|
|
69
70
|
this.hasExcludeNested = false;
|
|
70
71
|
this.hasGenerateNarrative = false;
|
|
71
|
-
this.hasLimitedExpansion = false;
|
|
72
72
|
this.hasExcludeNotForUI = false;
|
|
73
73
|
this.hasExcludePostCoordinated = false;
|
|
74
74
|
this.hasIncludeDesignations = false;
|
|
75
75
|
this.hasIncludeDefinition = false;
|
|
76
76
|
this.hasDefaultToLatestVersion = false;
|
|
77
|
-
this.hasIncompleteOK = false;
|
|
78
77
|
this.hasDisplayWarning = false;
|
|
79
78
|
this.hasMembershipOnly = false;
|
|
80
79
|
}
|
|
@@ -85,6 +84,12 @@ class TxParameters {
|
|
|
85
84
|
if (!params.parameter) {
|
|
86
85
|
return;
|
|
87
86
|
}
|
|
87
|
+
if (!this.hasHTTPLanguages && this.hasParam(params, "__Content-Language")) {
|
|
88
|
+
this.HTTPLanguages = Languages.fromAcceptLanguage(this.paramstr(params, "__Content-Language"), this.languageDefinitions, !this.validating);
|
|
89
|
+
}
|
|
90
|
+
if (!this.hasHTTPLanguages && this.hasParam(params, "__Accept-Language")) {
|
|
91
|
+
this.HTTPLanguages = Languages.fromAcceptLanguage(this.paramstr(params, "__Accept-Language"), this.languageDefinitions, !this.validating);
|
|
92
|
+
}
|
|
88
93
|
|
|
89
94
|
for (let p of params.parameter) {
|
|
90
95
|
switch (p.name) {
|
|
@@ -118,7 +123,7 @@ class TxParameters {
|
|
|
118
123
|
try {
|
|
119
124
|
this.DisplayLanguages = Languages.fromAcceptLanguage(getValuePrimitive(p), this.languageDefinitions, !this.validating);
|
|
120
125
|
} catch (error) {
|
|
121
|
-
throw new Issue("error", "processing", null, 'INVALID_DISPLAY_NAME', this.i18n.translate('INVALID_DISPLAY_NAME', this.HTTPLanguages, getValuePrimitive(p))).handleAsOO(400);
|
|
126
|
+
throw new Issue("error", "processing", null, 'INVALID_DISPLAY_NAME', this.i18n.translate('INVALID_DISPLAY_NAME', this.HTTPLanguages, [getValuePrimitive(p)]), "invalid-display").handleAsOO(400);
|
|
122
127
|
}
|
|
123
128
|
break;
|
|
124
129
|
}
|
|
@@ -198,6 +203,7 @@ class TxParameters {
|
|
|
198
203
|
if (value && (value.resourceType === 'Parameters' || value.resourceType === 'ExpansionProfile')) {
|
|
199
204
|
this.readParams(value);
|
|
200
205
|
}
|
|
206
|
+
break;
|
|
201
207
|
}
|
|
202
208
|
// eslint-disable-next-line no-fallthrough
|
|
203
209
|
case 'term': // jQuery support
|
|
@@ -218,15 +224,30 @@ class TxParameters {
|
|
|
218
224
|
this.limit = Utilities.parseIntOrDefault(getValuePrimitive(p), -1);
|
|
219
225
|
break;
|
|
220
226
|
}
|
|
227
|
+
|
|
228
|
+
case 'useSupplement' : {
|
|
229
|
+
this.supplements.add(getValuePrimitive(p));
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
case 'abstract': {
|
|
234
|
+
if (getValuePrimitive(p) == true) {
|
|
235
|
+
this.abstractOk = true;
|
|
236
|
+
} else if (getValuePrimitive(p) == false) {
|
|
237
|
+
this.abstractOk = false;
|
|
238
|
+
}
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
case 'inferSystem': {
|
|
242
|
+
if (getValuePrimitive(p) == true) this.inferSystem = true;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
case "exclude-system": {
|
|
246
|
+
throw new Issue('error', 'not-supported', null, null, "The parameter 'exclude-system' is not supported by this system", null, 400);
|
|
247
|
+
}
|
|
221
248
|
}
|
|
222
249
|
}
|
|
223
250
|
|
|
224
|
-
if (!this.hasHTTPLanguages && this.hasParam(params, "__Content-Language")) {
|
|
225
|
-
this.HTTPLanguages = Languages.fromAcceptLanguage(this.paramstr(params, "__Content-Language"), this.languageDefinitions, !this.validating);
|
|
226
|
-
}
|
|
227
|
-
if (!this.hasHTTPLanguages && this.hasParam(params, "__Accept-Language")) {
|
|
228
|
-
this.HTTPLanguages = Languages.fromAcceptLanguage(this.paramstr(params, "__Accept-Language"), this.languageDefinitions, !this.validating);
|
|
229
|
-
}
|
|
230
251
|
}
|
|
231
252
|
|
|
232
253
|
paramstr(params, name) {
|
|
@@ -298,15 +319,6 @@ class TxParameters {
|
|
|
298
319
|
this.hasGenerateNarrative = true;
|
|
299
320
|
}
|
|
300
321
|
|
|
301
|
-
get limitedExpansion() {
|
|
302
|
-
return this.FLimitedExpansion;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
set limitedExpansion(value) {
|
|
306
|
-
this.FLimitedExpansion = value;
|
|
307
|
-
this.hasLimitedExpansion = true;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
322
|
get excludeNotForUI() {
|
|
311
323
|
return this.FExcludeNotForUI;
|
|
312
324
|
}
|
|
@@ -352,15 +364,6 @@ class TxParameters {
|
|
|
352
364
|
this.hasDefaultToLatestVersion = true;
|
|
353
365
|
}
|
|
354
366
|
|
|
355
|
-
get incompleteOK() {
|
|
356
|
-
return this.FIncompleteOK;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
set incompleteOK(value) {
|
|
360
|
-
this.FIncompleteOK = value;
|
|
361
|
-
this.hasIncompleteOK = true;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
367
|
get displayWarning() {
|
|
365
368
|
return this.FDisplayWarning;
|
|
366
369
|
}
|
|
@@ -489,14 +492,12 @@ class TxParameters {
|
|
|
489
492
|
b('active-only', this.FActiveOnly);
|
|
490
493
|
b('exclude-nested', this.FExcludeNested);
|
|
491
494
|
b('generate-narrative', this.FGenerateNarrative);
|
|
492
|
-
b('limited-expansion', this.FLimitedExpansion);
|
|
493
495
|
b('for-ui', this.FExcludeNotForUI);
|
|
494
496
|
b('exclude-post-coordinated', this.FExcludePostCoordinated);
|
|
495
497
|
b('include-designations', this.FIncludeDesignations);
|
|
496
498
|
b('include-definition', this.FIncludeDefinition);
|
|
497
499
|
b('membership-only', this.FMembershipOnly);
|
|
498
500
|
b('default-to-latest', this.FDefaultToLatestVersion);
|
|
499
|
-
b('incomplete-ok', this.FIncompleteOK);
|
|
500
501
|
b('display-warning', this.FDisplayWarning);
|
|
501
502
|
|
|
502
503
|
return result;
|
|
@@ -521,10 +522,10 @@ class TxParameters {
|
|
|
521
522
|
|
|
522
523
|
let s = '|'+this.count+'|'+this.limit+'|'+this.offset+
|
|
523
524
|
this.FUid + '|' + b(this.FMembershipOnly) + '|' + this.FProperties.join(',') + '|' +
|
|
524
|
-
b(this.FActiveOnly) + b(this.
|
|
525
|
+
b(this.FActiveOnly) + b(this.FDisplayWarning) + b(this.FExcludeNested) + b(this.FGenerateNarrative) + b(this.FExcludeNotForUI) + b(this.FExcludePostCoordinated) +
|
|
525
526
|
b(this.FIncludeDesignations) + b(this.FIncludeDefinition) + b(this.hasActiveOnly) + b(this.hasExcludeNested) + b(this.hasGenerateNarrative) +
|
|
526
|
-
b(this.
|
|
527
|
-
b(this.hasIncludeDefinition) + b(this.hasDefaultToLatestVersion) + b(this.
|
|
527
|
+
b(this.hasExcludeNotForUI) + b(this.hasExcludePostCoordinated) + b(this.hasIncludeDesignations) +
|
|
528
|
+
b(this.hasIncludeDefinition) + b(this.hasDefaultToLatestVersion) + b(this.hasDisplayWarning) + b(this.hasExcludeNotForUI) + b(this.hasMembershipOnly) + b(this.FDefaultToLatestVersion);
|
|
528
529
|
|
|
529
530
|
if (this.hasHTTPLanguages) {
|
|
530
531
|
s = s + this.FHTTPLanguages.asString(true) + '|';
|
|
@@ -565,7 +566,6 @@ class TxParameters {
|
|
|
565
566
|
this.FActiveOnly = other.FActiveOnly;
|
|
566
567
|
this.FExcludeNested = other.FExcludeNested;
|
|
567
568
|
this.FGenerateNarrative = other.FGenerateNarrative;
|
|
568
|
-
this.FLimitedExpansion = other.FLimitedExpansion;
|
|
569
569
|
this.FExcludeNotForUI = other.FExcludeNotForUI;
|
|
570
570
|
this.FExcludePostCoordinated = other.FExcludePostCoordinated;
|
|
571
571
|
this.FIncludeDesignations = other.FIncludeDesignations;
|
|
@@ -573,19 +573,16 @@ class TxParameters {
|
|
|
573
573
|
this.FUid = other.FUid;
|
|
574
574
|
this.FMembershipOnly = other.FMembershipOnly;
|
|
575
575
|
this.FDefaultToLatestVersion = other.FDefaultToLatestVersion;
|
|
576
|
-
this.FIncompleteOK = other.FIncompleteOK;
|
|
577
576
|
this.FDisplayWarning = other.FDisplayWarning;
|
|
578
577
|
this.FDiagnostics = other.FDiagnostics;
|
|
579
578
|
this.hasActiveOnly = other.hasActiveOnly;
|
|
580
579
|
this.hasExcludeNested = other.hasExcludeNested;
|
|
581
580
|
this.hasGenerateNarrative = other.hasGenerateNarrative;
|
|
582
|
-
this.hasLimitedExpansion = other.hasLimitedExpansion;
|
|
583
581
|
this.hasExcludeNotForUI = other.hasExcludeNotForUI;
|
|
584
582
|
this.hasExcludePostCoordinated = other.hasExcludePostCoordinated;
|
|
585
583
|
this.hasIncludeDesignations = other.hasIncludeDesignations;
|
|
586
584
|
this.hasIncludeDefinition = other.hasIncludeDefinition;
|
|
587
585
|
this.hasDefaultToLatestVersion = other.hasDefaultToLatestVersion;
|
|
588
|
-
this.hasIncompleteOK = other.hasIncompleteOK;
|
|
589
586
|
this.hasMembershipOnly = other.hasMembershipOnly;
|
|
590
587
|
this.hasDisplayWarning = other.hasDisplayWarning;
|
|
591
588
|
|
package/tx/provider.js
CHANGED
|
@@ -135,6 +135,7 @@ class Provider {
|
|
|
135
135
|
const resources = await contentLoader.getResourcesByType("CodeSystem");
|
|
136
136
|
for (const resource of resources) {
|
|
137
137
|
const cs = new CodeSystem(await contentLoader.loadFile(resource, contentLoader.fhirVersion()));
|
|
138
|
+
cs.sourcePackage = contentLoader.pid();
|
|
138
139
|
this.codeSystems.set(cs.url, cs);
|
|
139
140
|
this.codeSystems.set(cs.vurl, cs);
|
|
140
141
|
}
|
|
@@ -224,7 +225,7 @@ class Provider {
|
|
|
224
225
|
async listCodeSystemVersions(url) {
|
|
225
226
|
let result = new Set();
|
|
226
227
|
for (let cs of this.codeSystems.values()) {
|
|
227
|
-
if (cs.url == url) {
|
|
228
|
+
if (cs.url == url && cs.version) {
|
|
228
229
|
result.add(cs.version);
|
|
229
230
|
}
|
|
230
231
|
}
|
|
@@ -363,16 +364,16 @@ class Provider {
|
|
|
363
364
|
factory = this.codeSystemFactories.get(vurlMM);
|
|
364
365
|
}
|
|
365
366
|
if (factory != null) {
|
|
366
|
-
const csp = factory.build(opContext, []);
|
|
367
|
-
const c = csp.locate(code);
|
|
367
|
+
const csp = await factory.build(opContext, []);
|
|
368
|
+
const c = csp ? csp.locate(code) : null;
|
|
368
369
|
if (c) {
|
|
369
|
-
if (factory.
|
|
370
|
+
if (factory.iteratable()) {
|
|
370
371
|
return {
|
|
371
372
|
link: this.path + "/CodeSystem/x-" + factory.id(),
|
|
372
373
|
description: csp.display(c)
|
|
373
374
|
}
|
|
374
375
|
} else {
|
|
375
|
-
const link =
|
|
376
|
+
const link = factory.codeLink(c);
|
|
376
377
|
if (link) {
|
|
377
378
|
return {
|
|
378
379
|
link: link,
|
package/tx/sct/expressions.js
CHANGED
|
@@ -770,7 +770,7 @@ class SnomedExpressionParser {
|
|
|
770
770
|
*/
|
|
771
771
|
rule(test, message) {
|
|
772
772
|
if (!test) {
|
|
773
|
-
throw new Error(message + ' at character ' + this.cursor);
|
|
773
|
+
throw new Error(message + ' at character ' + (this.cursor+1));
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
776
|
|
|
@@ -1469,7 +1469,7 @@ class SnomedExpressionServices {
|
|
|
1469
1469
|
/**
|
|
1470
1470
|
* Validate concept reference
|
|
1471
1471
|
*/
|
|
1472
|
-
checkConcept(concept) {
|
|
1472
|
+
checkConcept(concept, limit) {
|
|
1473
1473
|
if (concept.code) {
|
|
1474
1474
|
const conceptId = BigInt(concept.code);
|
|
1475
1475
|
const result = this.concepts.findConcept(conceptId);
|
|
@@ -1480,6 +1480,15 @@ class SnomedExpressionServices {
|
|
|
1480
1480
|
throw new Error(`Concept ${concept.code} not found`);
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
1483
|
+
if (limit && concept.reference) {
|
|
1484
|
+
// if a limit is specified, then the concept has to be a specialization of that.
|
|
1485
|
+
let parentRef = this.concepts.findConcept(limit);
|
|
1486
|
+
let descendentsRef = this.concepts.getAllDesc(parentRef.index);
|
|
1487
|
+
const descendants = this.refs.getReferences(descendentsRef);
|
|
1488
|
+
if (descendants && !descendants.includes(concept.reference)) {
|
|
1489
|
+
throw new Error(`Concept ${concept.code} is not valid in this context (must be a ${limit})`);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1483
1492
|
|
|
1484
1493
|
// Validate description if provided
|
|
1485
1494
|
if (concept.reference !== NO_REFERENCE && concept.description) {
|
|
@@ -1606,7 +1615,7 @@ class SnomedExpressionServices {
|
|
|
1606
1615
|
* Validate refinement
|
|
1607
1616
|
*/
|
|
1608
1617
|
checkRefinement(refinement) {
|
|
1609
|
-
this.checkConcept(refinement.name);
|
|
1618
|
+
this.checkConcept(refinement.name, '410662002');
|
|
1610
1619
|
this.checkExpression(refinement.value);
|
|
1611
1620
|
}
|
|
1612
1621
|
|