Uploading CodeSystems

In most cases, it is useful to upload your own CodeSystems for use in HDR FHIR Repository. This might mean uploading external Terminologies such as LOINC/SNOMED or loading custom terminologies such as local CodeSystems defined for organizational specific use.

Uploading External Terminologies

HDR FHIR has the ability to upload several standard terminology code systems like LOINC/SNOMED using their native distribution formats. This is done using the $upload-external-code-system operation on the CodeSystem Resource and can be invoked using the HDR FHIR command line utility. Refer to the FHIR Command-Line Utility chapter in this guide.

Table 14-1 External CodeSystem Formats

CodeSystem URL File Format
LOINC http://loinc.org LOINC Complete Download ZIP
SNOMED CT http://snomed.info/sct RF2 Distribution in ZIP

Uploading Custom Terminologies Using CSV Files

HDR FHIR has the ability to upload custom local CodeSystem using the supported CSV file formats. This is done using the $upload-external-code-system operation on the CodeSystem Resource and can be invoked directly using the REST operation.

To upload terminology via the REST endpoint, perform an HTTP POST to the following URL:

http://<HOST_NAME>:<PORT>/oracle-fhir-server/fhir/CodeSystem/$upload-external-code-system

The request body for this operation is a Parameters resource with the following parts:

Table 14-2 Parameters

Parameter Description
system This parameter should have a uri value containing the CodeSystem URI.
file This parameter should have an attachment value containing the value of the file (encoded in Base64) in Attachment.data and the filename in Attachment.url.
contentType Specifies the payload type (should be text/csv, application/zip etc.).
data Contains the raw Base64 encoded payload.
url Used by the upload processor to determine the type of file being uploaded (e.g. concepts.csv vs hierarchy.csv). See the CSV input Files below for descriptions of the files to upload.

Example: CSV Files Content

CODE,DISPLAY

CHEM,Chemistry
HB,Hemoglobin
NEUT,Neutrophils

MICRO,Microbiology
C&S,Culture and Sensitivity

Example: Request Body

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "system",
      "valueUri": "http://example.com/csv"
    },
    {
      "name": "file",
      "valueAttachment": {
        "contentType": "text/csv",
        "data": "Q09ERSxESVNQTEFZCgpDSEVNLENoZW1pc3RyeQpIQixIZW1vZ2xvYmluCk5FVVQsTmV1dHJvcGhpbHMKCk1JQ1JPLE1pY3JvYmlvbG9neQpDJlMsQ3VsdHVyZSBhbmQgU2Vuc2l0aXZpdHkK",
        "url": "file:/concepts.csv"
      }
    },
    {
      "name": "file",
      "valueAttachment": {
        "contentType": "text/csv",
        "data": "UEFSRU5ULENISUxECgpDSEVNLEhCCkNIRU0sTkVVVAoKTUlDUk8sQyZTCg==",
        "url": "file:/hierarchy.csv"
      }
    }
  ]
}