Recipe: Getting started with the IBM FHIR Server and Terminology

The IBM FHIR Server Terminology module fhir-term provides a FHIR terminology service provider interface (SPI) and a default implementation that implements terminology services using CodeSystem, ValueSet, and ConceptMap resources that have been made available through the FHIR registry module fhir-registry.

This document outlines a small test environment to setup Cassandra and ElasticSearch to run the Terminology and run a simple test.

Recipe

  1. Clone the IBM FHIR Server repository and switch to the cloned repository.
git clone https://github.com/IBM/FHIR.git && cd $(basename $_ .git)
  1. Setup the examples
mvn clean install -f fhir-examples -DskipTests
  1. Edit line 68 – term/fhir-term-graph/pom.xml, change provided to compile
<dependency>
            <groupId>org.janusgraph</groupId>
            <artifactId>janusgraph-cql</artifactId>
            <scope>compile</scope>
  1. Edit line 174 – term/fhir-term-graph/pom.xml, change provided to compile
        <dependency>
            <groupId>org.janusgraph</groupId>
            <artifactId>janusgraph-es</artifactId>
            <scope>compile</scope>
        </dependency>
  1. Setup the fhir projects
mvn clean install -f fhir-parent -DskipTests
  1. Build the IBM FHIR Server
export WORKSPACE=$(pwd)
export BUILD_ID=4.11.0-SNAPSHOT
docker logout
nerdctl build fhir-install -t ibmcom/ibm-fhir-server:graph

You’ll see:

Successfully built 196dd54732a4
Successfully tagged ibmcom/ibm-fhir-server:latest
  1. Build the Graph Terminology Loader
pushd
cd ${WORKSPACE}/fhir-install/src/main/docker/ibm-fhir-term-graph-loader/
mkdir -p target/
cp ${WORKSPACE}/term/fhir-term-graph-loader/target/fhir-term-graph-loader-*-cli.jar target/
cp ${WORKSPACE}/LICENSE target/
nerdctl build --build-arg FHIR_VERSION=${BUILD_ID} -t ibmcom/ibm-fhir-term-loader:latest .
popd
  1. Download the janusgraph-cassandra-elasticsearch.properties
curl -o janusgraph-cassandra-elasticsearch.properties -L \
    https://raw.githubusercontent.com/IBM/FHIR/main/term/fhir-term-graph-loader/src/test/resources/conf/janusgraph-cassandra-elasticsearch.properties
  1. Download the fhir-server-config.json
curl -o fhir-server-config.json -L \
    https://gist.githubusercontent.com/prb112/c08613e6e21e77b92cfc0ea19c56f081/raw/a9e17bb2924b59de14bd04aa9fbbcc8ff38afb10/fhir-server-config-term.json
  1. Download the docker-compose.yml
curl -o docker-compose.yml -L \
    https://gist.githubusercontent.com/prb112/1461e66d28767ba169843bded4b0aad8/raw/a4ed5b59fd8eb430745c173536dc5ab304186c7a/docker-compose.yml
  1. Startup the cassandra container
nerdctl compose up cassandra
  1. Check the logs until you see:
fhir-cassandra |INFO  [main] 2022-02-19 00:36:18,884 CassandraDaemon.java:780 - Startup complete
  1. Startup the elasticsearch container
nerdctl compose up elasticsearch -d
  1. Check the logs for "Yellow to Green"
Cluster health status changed from [YELLOW] to [GREEN]
  1. Start the IBM FHIR Server
nerdctl compose up fhir-server -d
  1. Check the logs for smarter planet
fhir-server_1 |[2/19/22, 0:40:09:547 UTC] 00000026 FeatureManage A   CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 27.170 seconds.

You should also see the schema created:

fhir-server |[2/19/22, 1:20:11:487 UTC] 00000027 FHIRTermGraph I   Creating schema...
fhir-server |[2/19/22, 1:20:13:840 UTC] 00000027 FHIRTermGraph I   
fhir-server |------------------------------------------------------------------------------------------------
fhir-server |Vertex Label Name              | Partitioned | Static                                             |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |CodeSystem                     | false       | false                                              |
fhir-server |Concept                        | false       | false                                              |
fhir-server |Designation                    | false       | false                                              |
fhir-server |Property_                      | false       | false                                              |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |Edge Label Name                | Directed    | Unidirected | Multiplicity                         |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |isa                            | true        | false       | MULTI                                |
fhir-server |concept                        | true        | false       | MULTI                                |
fhir-server |designation                    | true        | false       | MULTI                                |
fhir-server |property_                      | true        | false       | MULTI                                |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |Property Key Name              | Cardinality | Data Type                                          |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |valueCode                      | SINGLE      | class java.lang.String                             |
fhir-server |display                        | SINGLE      | class java.lang.String                             |
fhir-server |version                        | SINGLE      | class java.lang.String                             |
fhir-server |code                           | SINGLE      | class java.lang.String                             |
fhir-server |codeLowerCase                  | SINGLE      | class java.lang.String                             |
fhir-server |url                            | SINGLE      | class java.lang.String                             |
fhir-server |value                          | SINGLE      | class java.lang.String                             |
fhir-server |valueBoolean                   | SINGLE      | class java.lang.Boolean                            |
fhir-server |valueDateTimeLong              | SINGLE      | class java.lang.Long                               |
fhir-server |valueDecimal                   | SINGLE      | class java.lang.Double                             |
fhir-server |valueInteger                   | SINGLE      | class java.lang.Integer                            |
fhir-server |valueString                    | SINGLE      | class java.lang.String                             |
fhir-server |count                          | SINGLE      | class java.lang.Integer                            |
fhir-server |group                          | SINGLE      | class java.lang.String                             |
fhir-server |language                       | SINGLE      | class java.lang.String                             |
fhir-server |system                         | SINGLE      | class java.lang.String                             |
fhir-server |use                            | SINGLE      | class java.lang.String                             |
fhir-server |valueDateTime                  | SINGLE      | class java.lang.String                             |
fhir-server |valueDecimalString             | SINGLE      | class java.lang.String                             |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |Graph Index (Vertex)           | Type        | Unique    | Backing        | Key:           Status |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |byUrl                          | Composite   | false     | internalindex  | url:          ENABLED |
fhir-server |byCode                         | Composite   | false     | internalindex  | code:         ENABLED |
fhir-server |byCodeLowerCase                | Composite   | false     | internalindex  | codeLowerCase:    ENABLED |
fhir-server |byDisplay                      | Composite   | false     | internalindex  | display:      ENABLED |
fhir-server |byUrlAndVersion                | Composite   | false     | internalindex  | url:          ENABLED |
fhir-server |                               |             |           |                | version:      ENABLED |
fhir-server |byValue                        | Composite   | false     | internalindex  | value:        ENABLED |
fhir-server |byValueBoolean                 | Composite   | false     | internalindex  | valueBoolean:    ENABLED |
fhir-server |byValueCode                    | Composite   | false     | internalindex  | valueCode:    ENABLED |
fhir-server |byValueDateTimeLong            | Composite   | false     | internalindex  | valueDateTimeLong:    ENABLED |
fhir-server |byValueDecimal                 | Composite   | false     | internalindex  | valueDecimal:    ENABLED |
fhir-server |byValueInteger                 | Composite   | false     | internalindex  | valueInteger:    ENABLED |
fhir-server |byValueString                  | Composite   | false     | internalindex  | valueString:    ENABLED |
fhir-server |vertices                       | Mixed       | false     | search         | display:      ENABLED |
fhir-server |                               |             |           |                | value:        ENABLED |
fhir-server |                               |             |           |                | valueCode:    ENABLED |
fhir-server |                               |             |           |                | valueString:    ENABLED |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |Graph Index (Edge)             | Type        | Unique    | Backing        | Key:           Status |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |Relation Index (VCI)           | Type        | Direction | Sort Key       | Order    |     Status |
fhir-server |---------------------------------------------------------------------------------------------------
fhir-server |
fhir-server |[2/19/22, 1:20:15:061 UTC] 00000071 Clock         I com.datastax.oss.driver.internal.core.time.Clock getInstance Using native clock for microsecond precision
fhir-server |[2/19/22, 1:20:15:132 UTC] 00000027 ExecutorServi I org.janusgraph.diskstorage.configuration.ExecutorServiceBuilder buildFixedExecutorService Initiated fixed thread pool of size 10
fhir-server |[2/19/22, 1:20:15:197 UTC] 00000027 UniqueInstanc I org.janusgraph.graphdb.idmanagement.UniqueInstanceIdRetriever getOrGenerateUniqueInstanceId Generated unique-instance-id=0a04031316-fhir2
fhir-server |[2/19/22, 1:20:15:256 UTC] 00000084 Clock         I com.datastax.oss.driver.internal.core.time.Clock getInstance Using native clock for microsecond precision
fhir-server |[2/19/22, 1:20:15:331 UTC] 00000027 ExecutorServi I org.janusgraph.diskstorage.configuration.ExecutorServiceBuilder buildFixedExecutorService Initiated fixed thread pool of size 10
fhir-server |[2/19/22, 1:20:15:332 UTC] 00000027 Backend       I org.janusgraph.diskstorage.Backend getIndexes Configuring index [search]
fhir-server |[2/19/22, 1:20:15:373 UTC] 00000027 ExecutorServi I org.janusgraph.diskstorage.configuration.ExecutorServiceBuilder buildFixedExecutorService Initiated fixed thread pool of size 4
fhir-server |[2/19/22, 1:20:15:541 UTC] 00000027 KCVSLog       I org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller initializeTimepoint Loaded unidentified ReadMarker start time 2022-02-19T01:20:15.541046Z into org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller@2c491de4
  1. Check the Capabilities endpoint, it should respond with a wealth of input
curl --request GET \
  --url https://localhost:9443/fhir-server/api/v4/metadata \
  --header 'Content-Type: application/fhir+json' \
  --header 'X-FHIR-TENANT-ID: default' \
  -k -o /dev/null -I
  1. Copy over the Jar file term/fhir-term-graph-loader/target/fhir-term-graph-loader-4.11.0-SNAPSHOT-cli.jar

  2. Loading the Data for your specific use-case.

  • CodeSystem
java -jar fhir-term-graph-loader-4.11.0-SNAPSHOT-cli.jar -config ./janusgraph-cassandra-elasticsearch.properties -file CodeSystem.json

Also -url

  • Snomed
java -jar fhir-term-graph-loader-4.11.0-SNAPSHOT-cli.jar -config ./janusgraph-cassandra-elasticsearch.properties \
    -base snomed/ \
    -concept concept.cpt \
    -relation relation.rt \
    -desc desc.file \
    -lang lang.file
  • UMLS
java -jar fhir-term-graph-loader-4.11.0-SNAPSHOT-cli.jar -config ./janusgraph-cassandra-elasticsearch.properties

I don’t actually execute these commands in this blog as it is licensed content.

  1. Execute the queries for the terminology system.

There are some ancillary tasks you should do when done:

A. Shutdown the Containers when you are done.

nerdctl compose down 

B. List current moby images.

nerdctl images

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.