Skip to main content

CodeSystem Operations

The terminology service provides operations to look up codes, test subsumption relationships, and manage CodeSystem resources.

$lookup

Retrieves detailed information about a code, including its display name, definition, designations (translations), and properties.

GET Request

curl 'http://localhost:9089/fhir/r4/CodeSystem/$lookup?system=http://loinc.org&code=85354-9'

Lookup by ID

curl 'http://localhost:9089/fhir/r4/CodeSystem/{id}/$lookup?code=85354-9'

POST Request

curl -X POST http://localhost:9089/fhir/r4/CodeSystem/$lookup \
-H "Content-Type: application/fhir+json" \
-d '{
"resourceType": "Parameters",
"parameter": [
{"name": "system", "valueUri": "http://loinc.org"},
{"name": "code", "valueCode": "85354-9"}
]
}'

Response

{
"resourceType": "Parameters",
"parameter": [
{"name": "name", "valueString": "LOINC"},
{"name": "display", "valueString": "Blood pressure panel with all children optional"},
{"name": "property", "part": [
{"name": "code", "valueCode": "COMPONENT"},
{"name": "value", "valueString": "Blood pressure panel"}
]},
{"name": "property", "part": [
{"name": "code", "valueCode": "STATUS"},
{"name": "value", "valueString": "ACTIVE"}
]}
]
}

Parameters

ParameterTypeDescription
systemuriThe code system URL
codecodeThe code to look up
versionstringSpecific version of the code system
codingCodingAlternative to system+code
propertycodeSpecific properties to return

$subsumes

Determines hierarchical relationships between two codes (is-a relationships). This is particularly useful for code systems with hierarchical structure such as SNOMED CT.

GET Request

curl 'http://localhost:9089/fhir/r4/CodeSystem/$subsumes?system=http://snomed.info/sct&codeA=235856003&codeB=386661006'

POST Request

curl -X POST http://localhost:9089/fhir/r4/CodeSystem/$subsumes \
-H "Content-Type: application/fhir+json" \
-d '{
"resourceType": "Parameters",
"parameter": [
{"name": "system", "valueUri": "http://snomed.info/sct"},
{"name": "codeA", "valueCode": "235856003"},
{"name": "codeB", "valueCode": "386661006"}
]
}'

Response

{
"resourceType": "Parameters",
"parameter": [
{"name": "outcome", "valueCode": "subsumes"}
]
}

Possible Outcomes

OutcomeMeaning
equivalentCodes represent the same concept
subsumesCode A subsumes (is broader than) Code B
subsumed-byCode A is subsumed by (is narrower than) Code B
not-subsumedNo hierarchical relationship

Search CodeSystems

Retrieve CodeSystems matching search criteria.

curl 'http://localhost:9089/fhir/r4/CodeSystem?name=loinc'

Returns a FHIR Bundle of matching CodeSystem resources.

Create a CodeSystem

Upload a new CodeSystem resource.

curl -X POST http://localhost:9089/fhir/r4/CodeSystem \
-H "Content-Type: application/fhir+json" \
-d '{
"resourceType": "CodeSystem",
"url": "http://example.org/CodeSystem/custom",
"name": "CustomCodeSystem",
"status": "active",
"content": "complete",
"concept": [
{"code": "active", "display": "Active", "definition": "The record is active"},
{"code": "inactive", "display": "Inactive", "definition": "The record is inactive"}
]
}'

Returns 201 Created on success.

Get CodeSystem by ID

Retrieve a specific CodeSystem by its logical ID.

curl 'http://localhost:9089/fhir/r4/CodeSystem/{id}'

Standard Code Systems

Common code systems used in FHIR:

Code SystemURIUse
LOINChttp://loinc.orgLab observations, clinical measurements
SNOMED CThttp://snomed.info/sctClinical findings, procedures
ICD-10-CMhttp://hl7.org/fhir/sid/icd-10-cmDiagnoses
RxNormhttp://www.nlm.nih.gov/research/umls/rxnormMedications
CPThttp://www.ama-assn.org/go/cptProcedures
UCUMhttp://unitsofmeasure.orgUnits of measure