fhirsmith 0.6.0 → 0.7.1

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 (64) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +15 -4
  3. package/configurations/projector.json +21 -0
  4. package/configurations/readme.md +6 -0
  5. package/library/package-manager.js +0 -2
  6. package/library/version-utilities.js +85 -0
  7. package/package.json +1 -1
  8. package/packages/package-crawler.js +44 -9
  9. package/packages/packages.js +1 -0
  10. package/registry/crawler.js +35 -14
  11. package/registry/registry.js +3 -0
  12. package/server.js +4 -0
  13. package/tx/README.md +4 -4
  14. package/tx/cs/cs-loinc.js +5 -2
  15. package/tx/cs/cs-provider-api.js +25 -1
  16. package/tx/cs/cs-provider-list.js +2 -2
  17. package/tx/html/conceptmap-operations.liquid +19 -0
  18. package/tx/library/canonical-resource.js +6 -1
  19. package/tx/library/renderer.js +571 -2
  20. package/tx/library.js +127 -10
  21. package/tx/ocl/README.md +236 -0
  22. package/tx/ocl/cache/cache-paths.cjs +32 -0
  23. package/tx/ocl/cache/cache-paths.js +2 -0
  24. package/tx/ocl/cache/cache-utils.cjs +43 -0
  25. package/tx/ocl/cache/cache-utils.js +2 -0
  26. package/tx/ocl/cm-ocl.cjs +531 -0
  27. package/tx/ocl/cm-ocl.js +1 -105
  28. package/tx/ocl/cs-ocl.cjs +1779 -0
  29. package/tx/ocl/cs-ocl.js +1 -38
  30. package/tx/ocl/fingerprint/fingerprint.cjs +67 -0
  31. package/tx/ocl/fingerprint/fingerprint.js +2 -0
  32. package/tx/ocl/http/client.cjs +31 -0
  33. package/tx/ocl/http/client.js +2 -0
  34. package/tx/ocl/http/pagination.cjs +98 -0
  35. package/tx/ocl/http/pagination.js +2 -0
  36. package/tx/ocl/jobs/background-queue.cjs +200 -0
  37. package/tx/ocl/jobs/background-queue.js +2 -0
  38. package/tx/ocl/mappers/concept-mapper.cjs +66 -0
  39. package/tx/ocl/mappers/concept-mapper.js +2 -0
  40. package/tx/ocl/model/concept-filter-context.cjs +51 -0
  41. package/tx/ocl/model/concept-filter-context.js +2 -0
  42. package/tx/ocl/shared/constants.cjs +15 -0
  43. package/tx/ocl/shared/constants.js +2 -0
  44. package/tx/ocl/shared/patches.cjs +224 -0
  45. package/tx/ocl/shared/patches.js +2 -0
  46. package/tx/ocl/vs-ocl.cjs +1848 -0
  47. package/tx/ocl/vs-ocl.js +1 -104
  48. package/tx/operation-context.js +8 -1
  49. package/tx/params.js +24 -3
  50. package/tx/provider.js +47 -0
  51. package/tx/tx-html.js +49 -4
  52. package/tx/tx.js +8 -0
  53. package/tx/vs/vs-vsac.js +4 -3
  54. package/tx/workers/batch-validate.js +3 -2
  55. package/tx/workers/batch.js +3 -2
  56. package/tx/workers/expand.js +64 -9
  57. package/tx/workers/lookup.js +5 -4
  58. package/tx/workers/read.js +25 -9
  59. package/tx/workers/related.js +3 -2
  60. package/tx/workers/search.js +40 -10
  61. package/tx/workers/subsumes.js +3 -2
  62. package/tx/workers/translate.js +4 -3
  63. package/tx/workers/validate.js +143 -46
  64. package/tx/workers/worker.js +1 -7
package/tx/README.md CHANGED
@@ -33,22 +33,22 @@ Add the `tx` section to your `config.json`:
33
33
  "endpoints": [
34
34
  {
35
35
  "path": "/tx/r5",
36
- "fhirVersion": 5,
36
+ "fhirVersion": "5.0",
37
37
  "context": null
38
38
  },
39
39
  {
40
40
  "path": "/tx/r4",
41
- "fhirVersion": 4,
41
+ "fhirVersion": "4.0",
42
42
  "context": null
43
43
  },
44
44
  {
45
45
  "path": "/tx/r3",
46
- "fhirVersion": 3,
46
+ "fhirVersion": "3.0",
47
47
  "context": null
48
48
  },
49
49
  {
50
50
  "path": "/tx/r4/demo",
51
- "fhirVersion": 4,
51
+ "fhirVersion": "4.0",
52
52
  "context": "demo"
53
53
  }
54
54
  ]
package/tx/cs/cs-loinc.js CHANGED
@@ -203,9 +203,12 @@ class LoincServices extends BaseCSServices {
203
203
  // Use language-aware display logic
204
204
  if (this.opContext.langs && !this.opContext.langs.isEnglishOrNothing()) {
205
205
  const displays = await this.#getDisplaysForContext(ctxt, this.opContext.langs);
206
+ const requestedLanguages = Array.isArray(this.opContext.langs.languages)
207
+ ? this.opContext.langs.languages
208
+ : (Array.isArray(this.opContext.langs.langs) ? this.opContext.langs.langs : []);
206
209
 
207
210
  // Try to find exact language match
208
- for (const lang of this.opContext.langs.langs) {
211
+ for (const lang of requestedLanguages) {
209
212
  for (const display of displays) {
210
213
  if (lang.matches(display.language, true)) {
211
214
  return display.value;
@@ -214,7 +217,7 @@ class LoincServices extends BaseCSServices {
214
217
  }
215
218
 
216
219
  // Try partial language match
217
- for (const lang of this.opContext.langs.langs) {
220
+ for (const lang of requestedLanguages) {
218
221
  for (const display of displays) {
219
222
  if (lang.matches(display.language, false)) {
220
223
  return display.value;
@@ -20,7 +20,13 @@ class AbstractCodeSystemProvider {
20
20
  }
21
21
 
22
22
  /**
23
- * Returns the list of CodeSystems this provider provides
23
+ * Returns the list of CodeSystems this provider provides. This is called once at start up.
24
+ * The code systems should be fully loaded; lazy loading code systems is not considered good
25
+ * for engineering.
26
+ *
27
+ *
28
+ * Note that unlike value sets, which are accessed from the provider on the fly, code systems
29
+ * are all preloaded into the kernel (e.g. provider) at start up
24
30
  *
25
31
  * @param {string} fhirVersion - The FHIRVersion in scope - if relevant (there's always a stated version, though R5 is always used)
26
32
  * @param {string} context - The client's stated context - if provided.
@@ -32,6 +38,24 @@ class AbstractCodeSystemProvider {
32
38
  throw new Error('listCodeSystems must be implemented by AbstractCodeSystemProvider subclass');
33
39
  }
34
40
 
41
+ /**
42
+ * This is called once a minute to update the code system list that the provider maintains.
43
+ *
44
+ * return an object that has three Map<String, CodeSystem>: {added, changed, deleted}
45
+ *
46
+ * these use the same key as the
47
+ *
48
+ * code systems are identified by url and version
49
+ *
50
+ * @param fhirVersion
51
+ * @param context
52
+ * @returns {Promise<null>}
53
+ */
54
+ // eslint-disable-next-line no-unused-vars
55
+ async getCodeSystemChanges(fhirVersion, context){
56
+ return null;
57
+ }
58
+
35
59
  async close() {
36
60
 
37
61
  }
@@ -7,7 +7,7 @@ class ListCodeSystemProvider extends AbstractCodeSystemProvider {
7
7
  /**
8
8
  * {Map<String, CodeSystem>} A list of code system factories that contains all the preloaded native code systems
9
9
  */
10
- codeSystems = new Map();
10
+ codeSystems = [];
11
11
 
12
12
  /**
13
13
  * ensure that the ids on the code systems are unique, if they are
@@ -17,7 +17,7 @@ class ListCodeSystemProvider extends AbstractCodeSystemProvider {
17
17
  */
18
18
  // eslint-disable-next-line no-unused-vars
19
19
  assignIds(ids) {
20
- for (const cs of this.codeSystems.values()) {
20
+ for (const cs of this.codeSystems) {
21
21
  if (!cs.id || ids.has("CodeSystem/"+cs.id)) {
22
22
  cs.id = ""+ids.size;
23
23
  }
@@ -0,0 +1,19 @@
1
+
2
+ <div class="operation-form" style="margin-bottom: 15px;">
3
+ <strong>Translate</strong>
4
+ <form method="get" action="$translate" style="margin-left: 10px; margin-top: 5px;">
5
+ <input type="hidden" name="url" value="{{ url }}"/>
6
+ <table class="grid" cellpadding="0" cellspacing="0">
7
+ <tr>
8
+ <td>System:</td><td><select name="sourceSystem">{{ sources }}</select></td>
9
+ </tr>
10
+ <tr>
11
+ <td>Code:</td><td><select name="sourceCode">{{ codes }}</select></td>
12
+ </tr>
13
+ <tr>
14
+ <td>Target:</td><td><select name="targetSystem">{{ targets }}</select></td>
15
+ </tr>
16
+ </table>
17
+ <button type="submit" class="btn btn-sm btn-primary">Translate</button>
18
+ </form>
19
+ </div>
@@ -111,7 +111,12 @@ class CanonicalResource {
111
111
  const fmt = this.versionAlgorithm() || other.versionAlgorithm() || this.guessVersionAlgorithmFromVersion(this.version);
112
112
  switch (fmt) {
113
113
  case 'semver':
114
- return VersionUtilities.isThisOrLater(other.version, this.version, VersionPrecision.PATCH);
114
+ try {
115
+ return VersionUtilities.isThisOrLater(other.version, this.version, VersionPrecision.PATCH);
116
+ } catch (error) {
117
+ // other is not semver. Not much we can do
118
+ return false;
119
+ }
115
120
  case 'date':
116
121
  return this.dateIsMoreRecent(this.version, other.version);
117
122
  case 'integer':