toFHIR Features: Terminology Service
In the complex landscape of healthcare data, ensuring that different systems can communicate with each other is a significant challenge. Medical terminologies, with their vast and varied vocabularies, often become a barrier to data exchange. This is where terminology services become essential. In this blog post, we will explore the powerful terminology service feature within the toFHIR tool, demonstrating how it simplifies the handling of complex terminologies and code conversions in Electronic Health Record (EHR) ecosystems.
The Challenge of Medical Terminologies
EHR systems are rich with clinical information, but this data is often recorded using different terminologies and coding systems. For example, one system might use a local code to represent a specific lab test, while another uses a standardized code from a system like SNOMED CT. To make sense of this data and ensure it can be used for analytics, research, or clinical decision support, these different codes need to be mapped to a common standard.
Introducing the toFHIR Terminology Service
The toFHIR tool offers a comprehensive built-in terminology service designed to tackle these challenges head-on. It provides a centralized platform for managing and converting medical terminologies — data from various sources is accurately and consistently transformed into the FHIR standard.
Terminology service offers its solutions through two main definitions:
- Concept Map: A concept map defines the relationships between source codes (local terms) and target codes (standardized codes). It allows for the mapping of local terminologies to standardized ones, such as SNOMED CT.
- Code System: A code system is a collection of codes that represent concepts in a specific domain. It provides a way to resolve local identifiers to their corresponding human-readable descriptions.
Concept Map Use Case: Mapping Provider Order Types to SNOMED
Imagine we have a dataset of care provider orders from a data source such as
MIMIC POE (Provider Order Entry). This dataset contains an
order_type
column with various order types represented by
local, non-standardized terms like "General Care," "Nutrition," and "Blood
Bank". To map the POE
dataset into HL7 FHIR ServiceRequest resources, we need to convert local order
types into
standardized SNOMED CT codes. Directly mapping these varied values to SNOMED CT
would be
cumbersome and error-prone.
Here’s how the toFHIR terminology service makes this possible:
Creating a New Terminology Service: The first step is to create a “Terminology Service” that encapsulates all the Concept Maps and Code Systems.
Creating a Concept Map:
Next step is to create a "Concept Map," which defines the relationships
between the source and target codes. In this case, the source codes are our
local order_type
terms, and the target codes are the corresponding SNOMED CT codes.
Defining the Mapping: For each order_type
in our
source data, we specify the equivalent SNOMED CT code. For example:
- "General Care" maps to SNOMED CT code 7922000
- "Nutrition" maps to SNOMED CT code 182922004
- "Blood Bank" maps to SNOMED CT code 59524001

Applying the Mapping in toFHIR:
Once the concept map is defined, we can use it in our data transformation logic.
The toFHIR tool provides a powerful function
called translateToCoding
that takes the source code,
the source system, and the concept map URL as input and returns the
corresponding target code.
By using this function, we can dynamically translate the local
order_type
terms into their standardized SNOMED CT equivalents,
ensuring that our FHIR resources are compliant and interoperable.

translateToCoding
Usage
Code System Use Case: Resolving Laboratory Item IDs
One of the datasets in MIMIC is “labevents” table representing
laboratory measurements sourced from patient derived specimens. In this data,
specific tests are often identified by a numeric “itemid”
.
While this ID is unique within the source system, it doesn’t provide any
descriptive information about the test itself.
With the toFHIR terminology service, we can easily resolve these
itemids to their corresponding display names, making the data more
understandable and useful.
Creating a Code System: Within the same terminology service, we create a "Code System" that lists all the itemids and their human-readable descriptions. For example:
- itemid 50931 corresponds to "Glucose"
- itemid 50861 corresponds to "Alanine Aminotransferase (ALT)"

Applying the Mapping in toFHIR:
The toFHIR tool provides another useful function called
lookupDisplay
. This function takes the itemid
,
the code system URL,
and the desired display column as input and returns the corresponding text.

lookupDisplay
UsageBy incorporating this function into our mapping, we can enrich our FHIR resources with the descriptive names of the lab tests, adding valuable context to the data.

Conclusion
The toFHIR terminology service is a powerful and flexible tool that simplifies
the complex task of managing and converting medical terminologies. By providing
a centralized platform for creating concept maps and code systems, and offering
intuitive functions like translateToCoding
and
lookupDisplay
, toFHIR empowers
users to transform their legacy data into standardized, interoperable FHIR
resources with ease.
Whether you are dealing with admissions, medications, provider orders, lab results, or any other type of clinical data, the toFHIR terminology service can help you unlock the full potential of your healthcare information.