Measurement Relations
In this section, we explain how structured data for measurement relations is represented in the NLP API JSON output and in the Output Database schema. We also provide sample queries to illustrate the key aspects of the data schema.
After reading this page, we hope you will:
- Understand what measurement relations are.
- Understand what measurement value entities are and how they can be found.
- Know how to query measurement relations.
The content in this section builds on the concepts and data models explained in earlier sections (see Entity-level Tables, and Document-level Tables)
What are Measurement Relations?
Measurements are ubiquitous in medical reports. The NLP API detects measurement relations in all sections of Clinical reports, and in the FINDINGS and IMPRESSIONS section of Radiology reports. A measurement relation has two arguments: the subject of the measurement, and the measurement value.
Let’s consider this sentence.
For the above sentence, the NLP API extracts the subject and value entities that comprise the measurement relation as shown:

The NLP API identifies the subject of the measurement (sodium level), and the measurement value (140 mEq/L) including measurement unit. The NLP API recognizes units of measure supported by the Unified Code for Units of Measure (UCUM) standard including units of measurement for multi-dimensional measurements. The following are some examples of sentences from which measurement relations will be extracted:
The NLP API currently provides some support for the detection of measurement values that are unit-less. At the time of writing of this document, we have only enabled unitless measurement extraction for a limited number of lab tests, but we have plans to support a larger number of lab tests. If you are planning to utilize this feature in your NLP data extraction pipeline, we recommend that you contact us to discuss your requirements.
The following are examples of measurements commonly found in clinical notes:
Measurement Values
Measurement values are extracted as part of the measurement-relations feature when it is enabled. Note, however, that measurement values can also be extracted independently of the measurement relations by enabling the entity-measurement-unit feature during processing. The entity type of a measurement value can be used to query for measurement values independently of their association with measurement relations.
Measurement values, for example 140 mEq/L or 1.2 x 2.1 x 1.8 cm when found are extracted by the NLP API as regular entities. However, measurement value entities have an additional attribute: the measurement-unit attribute. This attribute stores the units of measurement associated with the measured value. See Measurement Units.
Measurement value entities are always associated with these following entity types (semantic type classification):
- emtelligent ontology:
measurement- medcin ontology:
measurement
You can find measurement value entities by querying for entities with the above entity types. To understand how entities relate to entity types, see Entity-level Tables.
JSON Data Model
Consider the following sentence:
A measurement relation will be extracted from the sentence above as shown in the following JSON excerpt:
Notice the following:
- The
relationsobject contains ameasurementsarray. This array contains an object representing a measurement relation instance. - A measurement relation instance has two named arguments: the
subjectand thevalue. Each is a reference to an Entity - Each entity reference resolves to an object in the
entitiesarray. Key information about the entity is stored in itsattributesmember.
The the next JSON excerpt shows the JSON output for the patient entity
For brevity, only the entity (E0) representing the measurement value is shown. Notice that measurement values may have units associated with them. This information is captured in the measurement_units attribute and is stored as an array of strings, or null if no units were found. Measurement units are discussed in detail in the next section.
Measurement Units
Measurement value entities may have additional attributes which other entities do not: the measurement_unit. The units of measurement that are present will be extracted and stored in this attribute. The measurement unit attribute values can be the following:
nullif no units are provided- an array of strings containing one element. For example, the NLP API extracts a single unit of measurement,
mEq/Lfrom the measurement value entity140 mEq/L. - an array of strings containing multiple elements. The NLP API can extract multiple units of measurement when they are explicitly mentioned. For example, from the measurement value term
1.2 cm x 2.1 cm x 1.8 cm, the measurement_unit attribute value is['cm', 'cm', 'cm'].
It should be noted that for multi-dimensional measurement values, only the units explicitly stated are captured in the measurement unit attribute. For example, the measurement value written as 1.2 x 2.1 cm x 1.8 cm, will be extracted as ['cm', 'cm'].
Measurement Relation Tables
The following ER diagram, shows the relationship between the measurementrelation table and related entity tables, in particular the foundentitymeasurementunit table.

From the diagram above, notice the following key points about the measurement relation schema:
- The measurementrelation table contains foreign key IDs for the entity table for the measurement subject and the measurement value: subject_id and value_id keys respectively.
- By joining these keys with the primary key of the entity table, you can retrieve information stored in entity-related tables such as associated concepts, entity types and location for the entity. See Entity-level Tables.
- Data about the measurement value’s units is stored in the foundentitymeasurementunit table.
- The foundentity table has a one-to-many relation to the foundentitymeasurementunit table. As discussed in previous sections, this allows the NLP API to capture the units for multi-dimensional values.
- Notice also that polarity and uncertainty attributes are tracked for entities, both the subject and the value entities. Polarity and uncertainty are not attributes of the measurement relation itself.
Not all measurement values have units. For example, some tests provide results as ratios. To return all values, when using the foundentitymeasurementunit table, you must perform a LEFT join rather than a regular inner join.
Sample Queries
In this section, we present examples of SQL queries that retrieve information about measurements that NLP API has extracted from your reports. The first three queries show how to work with the measurementrelation table, while the fourth is a practical example that combines a concept search with measurement relations to find mentions of a specific diagnostic test (e.g. forced ejection fraction volume) and corresponding results when present.
This section contains the following queries:
- Query: Find measurement values
- Query: List measurement relations showing subject, values and units
- Query: List measurement relations with no units
- Query: Find all FEV1 scores, their values and units
Query: Find measurement values
In the sample query below, we are looking for any entity that is a measurement value. To do this we simply query for measurement value entities using the foundentity table, where the found entity has an entity type of measurement value and entity type ontology is emtelligent.
Notice, however, that we also apply a window function to concatenate the measurement units from the foundentitymeasurementunit table into a comma-delimited string. This is necessary because one measurement value entity may be associated with multiple units.
This query is not very useful because it does not tell us what was measured. To extract this information about the subject (the entity being measured), we need to use measurement relations. The next sample query shows how to query measurement relations to retrieve the subject and the value of the measurement.
Query: List measurement relations showing subject, values and units
This query finds measurement relations and displays the annotated terms for the subject and value arguments, and some of their attributes. To provide context, this query also displays the sentence which contains the measurement relation.
To find information about measurement relations we begin with the measurementrelations table. From there various JOIN clauses are used to retrieve the attributes about the subject and value entities from the tables that store them in the NLP API’s relational database schema. These include: the foundentity and foundentitymeasurementunit tables.
Because this query touches a large number of tables, it may appear to be complex. However, it is quite straight-forward. The key is to ensure you keep track of whether you are retrieving entity information for the subject or the value of the measurement relation in each JOIN clause. The query consist of three parts:
- Part 1: Retrieve the attributes of the subject argument by performing an inner join between the measurementrelation table
subject_idwith the entity tableidkey. - Part 2: Retrieve the attributes of the value argument by performing an inner join between the measurementrelation table
value_idwith the entity tableidkey. When retrieving attributes for the measurement value argument, we perform a left join with the foundentitymeasurementunit table to retrieve the value’s units in addition to the other foundentity-related tables. - Part 3: Retrieve the sentence where the measurement subject was found by joining with the foundentitylocation table which then allows us to access the location and document tables. For more information about document-related attributes see Document-level Tables. Note: in the results table, the sentence is redacted for privacy reasons.
Query: List measurement relations with no units
In this query, we want to retrieve measurement relations whose measurement values have no units.
This query is essentially the same as the previous query. For each measurement relation, we retrieve and display the subject and value arguments, their attributes and the sentence where the measurement relation was found. However, to return only those measurement relations where the measurement is ‘unit-less’, we make two changes:
- We perform a left join on the foundentitymeasurementunit table and the foundentity table.
- In the WHERE clause, we filter for rows where the text column of the foundentitymeasurementunit table (which stores the unit of measurement) is
null.
Tip: You may find more results in Clinical reports which typically have more measurement values with implied units, than in reports such as Radiology and Pathology reports. Because the query below JOINs with the document table, you can easily filter for the type of report to include by adding a logical condition to the WHERE clause: for example, document.category = 'Clinical'.
Query: Find all FEV1 scores, their values and units
Forced expired (or expiratory) volume in one second, is also commonly referred to as FEV1, is a measurement obtained during spirometry/pulmonary function testing. The SNOMED concept for this measurement is
251944000 |Forced expired volume in one second/forced vital capacity ratio (observable entity)|and59328004 |Forced expired volume in 1 second (observable entity)|. The measurement value for FEV1 scores is typically given as a percentage or in litres.In this query, we want to retrieve all occurrences of FEV1 related terms. If the measurement values and/or units are provided, we want to extract them also. If no measurement values are provided e.g.
FEV1 score is normal, we want to return a row in the result set displaying NULL for values and units when they are not given.This query is composed of 2 CTEs:
- The first CTE,
FEV1_mentions, performs a simple concept query to find the foundentities associated with this term.- The second CTE,
FEV1_values, retrieves values from the measurementrelation table and units from foundentitymeasurementunit table. Note that a measurement value may have several units, hence a string aggregation function is used.In the final select statement, we combine the results of both CTEs using a LEFT JOIN to ensure that FEV1 mentions with no accompanying measurement units is retained in the results.
Utility SQL Queries
Below are some helpful data exploration queries for measurement relations.

