Learning ECL with examples

This article will guide you through SNOMED CT's Expression Constraint Language (ECL) using practical examples.

What is SNOMED CT?

SNOMED CT is a comprehensive clinical terminology used in a variety of clinical settings. It plays a key role in the electronic health record (EHR) systems, clinical decision support, and other healthcare applications.

The SNOMED CT concepts are organized in a polyhierarchy in which a concept can have multiple parents. In addition to the parent-child relationships, SNOMED CT concepts can have attributes and relationships to other concepts.

What is ECL?

ECL, or Expression Constraint Language, allows you to logically (intensionally) define subsets of SNOMED CT concepts (value sets) based on their attributes and relationships. ECL queries act as a filter that, when applied to the full SNOMED CT terminology, only returns the concepts that match the defined criteria.

ECL syntax

You can find the full description of ECL and its syntax in the official SNOMED CT documentation. In practice, it's probably enough to be familiar with the basic operators and common patterns listed below.

Example 1: Finding all types of pneumonia

Here's an example of an ECL expression that returns all types of pneumonia:

<< 233604007 |Pneumonia (disorder)|

The expression constraint above returns all descendants of pneumonia, including the direct and indirect children of pneumonia and pneumonia itself.

Example 2: Finding all diseases of the ear

Here's an example of an ECL expression that returns all diseases of the ear:

<< 64572001 |Disease (disorder)| :
363698007 |Finding site| = << 117590005 |Ear structure (body structure)|

The example above uses the : operator to filter the concepts based on their attributes (finding site).

Example 3: Finding all diseases of the ear, nose, and throat

The following ECL expression returns all diseases of the ear, nose, and throat:

<< 64572001 |Disease (disorder)| :
363698007 |Finding site| = (<< 117590005 |Ear structure (body structure)| OR << 45206002 |Nasal structure (body structure)| OR << 49928004 |Structure of anterior portion of neck (body structure)|)

In the nested expression above, the OR operator is used to combine multiple finding sites. Adding the OR operator between ECL expressions technically returns the union of the results.

See also

Made by Anton Vasetenkov.

If you want to say hi, you can reach me on LinkedIn or via email. If you like my work, you can support me by buying me a coffee.