Skip to content

Commit 11657a0

Browse files
committed
Add SNOMED CT Equals Child Filter
Also improved the terminology service documentation.
1 parent 81f0167 commit 11657a0

File tree

8 files changed

+207
-32
lines changed

8 files changed

+207
-32
lines changed

docs/.vitepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export default defineConfig({
142142
text: 'Terminology Service',
143143
items: [
144144
{ text: 'Overview', link: '/terminology-service' },
145+
{ text: 'FHIR', link: '/terminology-service/fhir' },
145146
{ text: 'LOINC', link: '/terminology-service/loinc' },
146147
{ text: 'SNOMED CT', link: '/terminology-service/snomed-ct' },
147148
{ text: 'UCUM', link: '/terminology-service/ucum' }

docs/terminology-service.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,34 @@
33
> [!CAUTION]
44
> The terminology service is currently **beta**. Only the basic functionality, described here, is implemented.
55
6-
The terminology service is an optional feature that has to be enabled by setting `ENABLE_TERMINOLOGY_SERVICE` to `true`.
6+
> [!NOTE]
7+
> The terminology service is an optional feature that has to be enabled by setting `ENABLE_TERMINOLOGY_SERVICE` to `true`.
78
8-
## Operations
9+
## Supported Code Systems
910

10-
* [CodeSystem $validate-code](api/operation/code-system-validate-code.md)
11-
* [ValueSet $expand](api/operation/value-set-expand.md)
12-
* [ValueSet $validate-code](api/operation/value-set-validate-code.md)
11+
### FHIR Code Systems
12+
13+
[FHIR CodeSystem](terminology-service/fhir.md) resources stored in Blaze with `content` of either `complete` or `fragment` are supported.
1314

14-
## Enable LOINC
15+
### External Code Systems
1516

16-
LOINC data is build into the Blaze image. Because LOINC support needs additional memory, it has to be enabled by setting the environment variable `ENABLE_TERMINOLOGY_LOINC` to `true`.
17+
Currently the external code systems shown in the following table are supported.
1718

18-
## Enable SNOMED CT
19+
| Name | Version(s) | Notes |
20+
|-----------------------------------------------|-----------------------|-----------------------------------|
21+
| [LOINC](terminology-service/loinc.md) | 2.78 | has to be enabled |
22+
| [SNOMED CT](terminology-service/snomed-ct.md) | all versions provided | release files have to be provided |
23+
| [UCUM](terminology-service/ucum.md) | 2013.10.21 | enabled by default |
1924

20-
Because SNOMED CT has to be licensed, Blaze doesn't contain the SNOMED CT code system by default. However, by setting the environment variable `ENABLE_TERMINOLOGY_SNOMED_CT` to `true` and `SNOMED_CT_RELEASE_PATH` to a path of an official SNOMED CT release, Blaze will be able to offer terminology services on SNOMED CT. The release files are read into memory on each start of Blaze. So the release path has to be always available.
25+
## Operations
26+
27+
* [CodeSystem $validate-code](api/operation/code-system-validate-code.md)
28+
* [ValueSet $expand](api/operation/value-set-expand.md)
29+
* [ValueSet $validate-code](api/operation/value-set-validate-code.md)
2130

2231
## Graph Cache
2332

24-
For normal stored code systems, a graph will be build before operations like $validate-code are executed. Building those graph is quite expensive. I order to prevent Blaze to build a graph each time an operation is executed, a graph cache is used. The environment variable `TERMINOLOGY_SERVICE_GRAPH_CACHE_SIZE` allows to set the number of concepts, the graph cache should hold. The default is 100,000.
33+
For stored FHIR code systems, a graph will be build before operations like $validate-code are executed. Building those graph is quite expensive. I order to prevent Blaze to build a graph each time an operation is executed, a graph cache is used. The environment variable `TERMINOLOGY_SERVICE_GRAPH_CACHE_SIZE` allows to set the number of concepts, the graph cache should hold. The default is 100,000.
2534

2635
## Memory Requirements
2736

docs/terminology-service/fhir.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# FHIR Code Systems <Badge type="warning" text="unreleased"/>
2+
3+
Blaze supports all FHIR CodeSystem resources stored in Blaze with `content` of either `complete` or `fragment`.
4+
5+
## Filters
6+
7+
| Property | Operators | Values |
8+
|----------|---------------------|------------|
9+
| concept | is-a, descendent-of | code |
10+
| parent | exists | true/false |
11+
| parent | = | code |
12+
| parent | regex | *regex* |
13+
| child | exists | true/false |
14+
| child | = | code |
15+
| child | regex | *regex* |
16+
| *any* | exists | true/false |
17+
| *any* | = | *any* |
18+
| *any* | regex | *regex* |

docs/terminology-service/loinc.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# LOINC <Badge type="info" text="Feature: TERMINOLOGY_LOINC"/> <Badge type="warning" text="unreleased"/>
22

3+
> [!NOTE]
4+
> LOINC data is build into the Blaze image. Because LOINC support needs additional memory, it has to be enabled by setting the environment variable `ENABLE_TERMINOLOGY_LOINC` to `true`.
5+
36
Blaze supports the [LOINC](https://loinc.org) terminology in version 2.78.
47

58
## Copyright
69

710
This material contains content from [LOINC](http://loinc.org). LOINC is copyright © 1995-2020, Regenstrief Institute, Inc. and the Logical Observation Identifiers Names and Codes (LOINC) Committee and is available at no cost under the license at http://loinc.org/license icon. LOINC® is a registered United States trademark of Regenstrief Institute, Inc.
811

9-
## FHIR Documentation
10-
11-
[Using LOINC with FHIR](https://terminology.hl7.org/LOINC.html)
12-
1312
## Filters
1413

1514
| Property | Operators | Values |
@@ -33,3 +32,7 @@ The following implicit value sets are supported.
3332
| Name | Example |
3433
|--------------|------------------------------|
3534
| Answer Lists | http://loinc.org/vs/LL4049-4 |
35+
36+
## Resources
37+
38+
[Using LOINC with FHIR](https://terminology.hl7.org/LOINC.html)

docs/terminology-service/snomed-ct.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
# SNOMED CT <Badge type="info" text="Feature: TERMINOLOGY_SNOMED_CT"/> <Badge type="warning" text="unreleased"/>
22

3-
Blaze supports the [SNOMED CT](https://www.snomed.org) terminology in the versions provided in the release files. The environment variable `SNOMED_CT_RELEASE_PATH` has to point to a path of an official SNOMED CT release. The release files are read into memory on each start of Blaze. So the release path has to be always available.
3+
> [!NOTE]
4+
> Because SNOMED CT has to be licensed, Blaze doesn't contain the SNOMED CT code system by default. However, by setting the environment variable `ENABLE_TERMINOLOGY_SNOMED_CT` to `true` and `SNOMED_CT_RELEASE_PATH` to a path of an official SNOMED CT release, Blaze will be able to offer terminology services on SNOMED CT. The release files are read into memory on each start of Blaze. So the release path has to be always available.
5+
6+
Blaze supports the [SNOMED CT](https://www.snomed.org) terminology in the versions provided in the release files.
47

58
## Copyright
69

710
This documentation includes content from SNOMED Clinical Terms® (SNOMED CT®) is copyright of the International Health Terminology Standards Development Organisation (IHTSDO) (trading as SNOMED International). Users of Blaze must have the appropriate SNOMED CT Affiliate license - for more information access http://www.snomed.org/snomed-ct/get-snomed-ct or contact SNOMED International via email at info@snomed.org.
811

9-
## FHIR Documentation
10-
11-
[Using SNOMED CT with FHIR](https://terminology.hl7.org/SNOMEDCT.html)
12-
1312
## Filters
1413

1514
| Property | Operators | Values |
1615
|----------|---------------------|----------------|
1716
| concept | is-a, descendent-of | SNOMED CT code |
1817
| parent | = | SNOMED CT code |
18+
| child | = | SNOMED CT code |
19+
20+
## Resources
21+
22+
[Using SNOMED CT with FHIR](https://terminology.hl7.org/SNOMEDCT.html)

docs/terminology-service/ucum.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Blaze supports the [UCUM](http://unitsofmeasure.org/) terminology.
66

77
UCUM is Copyright © 1999-2013 Regenstrief Institute, Inc. and The UCUM Organization, Indianapolis, IN. All rights reserved. See [TermsOfUse](http://unitsofmeasure.org/trac//wiki/TermsOfUse) for details.
88

9-
## FHIR Documentation
9+
## Resources
1010

1111
[Using UCUM with FHIR](https://terminology.hl7.org/UCUM.html)

modules/terminology-service/src/blaze/terminology_service/local/code_system/sct/filter/equals.clj

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,50 @@
66
[blaze.terminology-service.local.code-system.sct.filter.core :as core]
77
[blaze.terminology-service.local.code-system.sct.type :refer [parse-sctid]]))
88

9-
(defn- expand-filter-equals-parent
9+
(defn- expand-filter-parent
1010
[{{:keys [child-index]} :sct/context :sct/keys [module-id version]} value]
1111
(if (nil? value)
1212
(ba/incorrect (format "Missing parent = filter value in code system `%s`." url))
1313
(if-let [code (parse-sctid value)]
1414
(context/neighbors child-index module-id version code)
1515
(ba/incorrect (format "Invalid parent = filter value `%s` in code system `%s`." value url)))))
1616

17+
(defn- expand-filter-child
18+
[{{:keys [parent-index]} :sct/context :sct/keys [module-id version]} value]
19+
(if (nil? value)
20+
(ba/incorrect (format "Missing child = filter value in code system `%s`." url))
21+
(if-let [code (parse-sctid value)]
22+
(context/neighbors parent-index module-id version code)
23+
(ba/incorrect (format "Invalid child = filter value `%s` in code system `%s`." value url)))))
24+
1725
(defmethod core/expand-filter :=
1826
[code-system {:keys [property value]}]
1927
(condp = (type/value property)
20-
"parent" (expand-filter-equals-parent code-system (type/value value))
28+
"parent" (expand-filter-parent code-system (type/value value))
29+
"child" (expand-filter-child code-system (type/value value))
2130
nil (ba/incorrect (format "Missing = filter property in code system `%s`." url))
2231
(ba/unsupported (format "Unsupported = filter property `%s` in code system `%s`." (type/value property) url))))
2332

24-
(defn- satisfies-filter
33+
(defn- satisfies-filter-parent
2534
[{{:keys [child-index]} :sct/context :sct/keys [module-id version]} value code]
2635
(if (nil? value)
2736
(ba/incorrect (format "Missing parent = filter value in code system `%s`." url))
2837
(if-let [start-code (parse-sctid value)]
2938
(contains? (context/neighbors child-index module-id version start-code) code)
3039
(ba/incorrect (format "Invalid parent = filter value `%s` in code system `%s`." value url)))))
3140

41+
(defn- satisfies-filter-child
42+
[{{:keys [parent-index]} :sct/context :sct/keys [module-id version]} value code]
43+
(if (nil? value)
44+
(ba/incorrect (format "Missing child = filter value in code system `%s`." url))
45+
(if-let [start-code (parse-sctid value)]
46+
(contains? (context/neighbors parent-index module-id version start-code) code)
47+
(ba/incorrect (format "Invalid child = filter value `%s` in code system `%s`." value url)))))
48+
3249
(defmethod core/satisfies-filter :=
3350
[code-system {:keys [property value]} code]
3451
(condp = (type/value property)
35-
"parent" (satisfies-filter code-system (type/value value) code)
52+
"parent" (satisfies-filter-parent code-system (type/value value) code)
53+
"child" (satisfies-filter-child code-system (type/value value) code)
3654
nil (ba/incorrect (format "Missing = filter property in code system `%s`." url))
3755
(ba/unsupported (format "Unsupported = filter property `%s` in code system `%s`." (type/value property) url))))

0 commit comments

Comments
 (0)