Requirement
The SNOMED CT subtype polyhierarchy is an important resource which allows retrieval of all the concepts that are subtypes of a specified concept. The full hierarchy is represented by subtype (is a) relationships between each concept and its proximal supertypes. Therefore, to determine is whether a concept is a subtype of another concept a chain of these subtypes must be followed. It is possible to follow these chain in a relational database environment but the queries to achieve this are complex and often perform poorly.
Solution
Fortunately, there is a well-understood way to simplify and speed up the testing process. This requires the creation of a resource known as a transitive closure table. A transitive closure table includes direct relationships between every concept and all of it subtypes and supertypes. This makes it possible to test whether a concept is a subtype of another concept looking for a single row in that table. Similarly it makes it easy to access all the subtypes (or supertypes) of concept with a query on a single table.
Creating a Transitive Closure File
SNOMED International provide a Perl script that reads the snapshot relationships file. By processing this file, it rapidly generates the transitive closure of all the subtype relationships and then saves this as file. The result a two column file (subtypeId and supertypeId) containing more than 6.5 million rows. This transitive closure file can then be read into a database table in the same way the release files.
Using a Transitive Closure File
By using the transitive closure table very simple queries can:
- Test is concept A is a subtype of concept B
- List all supertypes of concept A
- List all subtype of concept A.
Computing Proximal Primitive Supertypes
The transitive closure can also be used to determine which supertype concept or concepts are essential to the definition of a concept. These concepts are known as the proximal primitive supertypes of a concept. Proximal primitive supertype relationships can be computed as follows.
- Use the transitive closure table to get the set of all concepts that are supertypes of concept A
- Call this set: Set-B
- Create a subset of Set-B containing only those concepts with definitionsStatusId=900000000000074008|primitive|
- Call this Set-C
- Create a subset of Set-C containing only those concepts that have no subtypes that are also in Set C
- The resulting set represents the primitive supertypes of Concept-A.
Feedback