Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Now that we have our instance up and running, the next step is to understand how to communicate with it. Fortunately, Snow Owl provides very comprehensive and powerful APIs to interact with your instance.
Among the few things that can be done with the API are as follows:
Check your instance health, status, and statistics
Administer your instance data
Perform CRUD (Create, Read, Update, and Delete) and search operations against your terminologies
Execute advanced search operations such as paging, sorting, filtering, scripting, aggregations, and many others
Let’s start with a basic health check, which we can use to see how our instance is doing. We’ll be using curl
to do this but you can use any tool that allows you to make HTTP/REST calls. Let’s assume that we are still on the same node where we started Snow Owl on and open another command shell window.
We will be using Snow Owl's Core API to check its status. You can run the following command by clicking the "Copy" link on the right side and pasting it into a terminal.
And the response:
We can see the installed version along with available repositories, their overall health (eg. "snomed"
with health "GREEN"
), associated indices and status (eg. "snomed-relationship"
with status "GREEN"
).
Repository indices store content for any number of code systems that share the same data structure and API, in the case of "snomed"
the International Edition of SNOMED CT and its extensions.
Whenever we ask for repository status, we either get GREEN
, YELLOW
, or RED
and an optional diagnosis
message.
GREEN
- everything is good (repository is fully functional)
YELLOW
- some data or functionality is not available, or diagnostic operation is in progress (repository is partially functional)
RED
- diagnostic operation required in order to continue (repository is not functional)
Let's import an RF2 release in SNAPSHOT
mode so that we can further explore the available SNOMED CT APIs! To do so, use the appropriate request from the as follows (the second SNOMEDCT
in the request path represents the code system identifier):
Curl will display the entire interaction between it and the server, including many request and response headers. We are interested in these two (response) rows in particular:
The first one indicates that the file was uploaded successfully and a resource has been created to track import progress, while the second row indicates the location of this resource.
Depending on the size and type of the RF2 package, hardware and Snow Owl configuration, RF2 imports might take hours to complete. Official SNAPSHOT distributions can be imported in less than 30 minutes by allocating 6 GB of heap size to Snow Owl and configuring it to use a solid state disk for the data directory.
The process itself is asynchronous and its status can be checked by periodically sending a GET request to the location indicated by the response header:
The expected response while the import is running:
Upon completion, you should receive a different response which lists component identifiers visited during the import as well as any defects encountered in uploaded release files:
Now that we have a code system, let's take a look at its content! We can list concepts using either the SNOMED CT API tailored to this tooling, or the FHIR API for a representation that is uniform across different kinds of code systems. For the sake of simplicity, we will use the former in this example.
To list all available concepts in a code system, use the following command (just as with importing, the second SNOMEDCT
in the request path represents the code system identifier):
The expected response is:
The concept list is empty, indicating that we haven't imported anything into Snow Owl - yet.
Now let's take a peek at our code systems:
The response:
...it sure looks empty! This is expected, as Snow Owl does not contain any predefined code system metadata out of the box. We can create the first code system with the following request:
Use of SNOMED CT is subject to additional conditions not listed here, and the full copyright notice has been shortened for brevity in the request above. Please see https://www.snomed.org/snomed-ct/get-snomed for details.
The request body includes:
The code system identifier "SNOMEDCT"
Various pieces of metadata offering a human-readable title, ownership and contact information, code system status, URL and OID for identification, etc.
The tooling identifier "snomed"
that points to the repository that will store content
Additional code system settings stored as key-value pairs
If everything goes well, the command will run without any errors (the server returns a "204 No Content" response). We can double-check that code system metadata has been registered correctly with the following request:
The expected response is:
In addition to the submitted values, you will find that additional administrative properties also appear in the output. One example is branchPath
which specifies the working branch of the code system within the repository.