Get and Test Concept Subtypes and Supertypes
4.5 Get and Test Concept Subtypes and Supertypes
Overview
The inferred definition of each concept includes a set of one or more subtype relationships relationships.
A subtype relationship is a relationship that asserts that a concept is a subtype of another concept.
Subtype relationships are represented by relationship type 116680003 | is a| .
A subtype relationship asserts that a concept conforms to all the defining characteristics the supertype concept but also has at least one feature or refinement that distinguishes it from that concept.
Subtype relationships are transitive. Each individual subtype relationship links a concept to a supertype parent concept. That concept will also have one or more subtype relationships to its own supertype parents.
These transitive chains of subtype relationships link every active concept to a set of supertype ancestors and eventually to the | SNOMED CT root concept| .
The meaning of a concept subsumes the meaning of its subtype children and descendants. Therefore, service that test or traverse subtype relationships are essential for effective meaning-based reporting and analysis.
Requirements and Options
Display of the SNOMED CT hierarchy requires access to the direct supertype parents and subtype children of a specified concept.
Effective use of SNOMED CT for retrieval, analysis and constrained data entry requires rapid identification of concepts that are supertype ancestors or subtype descendants of a specified concept.
The requirements listed in the table below include services that return the full set of children, parents, descendants or ancestors of a concept. However, other requirements can be more efficiently met by testing for a transitive subtype or supertype relationship between a specified concept and a set of one or more candidate concepts.
Services Required
Get subtype children of a concept
conceptId
Optionally, language or dialect code
Set of conceptIds of all concepts with a direct 116680003 | is a | relationship to the specified concept.
Optionally additional information such as the fully specified name or preferred term of each concept in the set.
Get supertype parents of a concept
conceptId
Optionally, language or dialect code
Set of conceptIds of all concepts with a direct 116680003 | is a | relationship to the specified concept.
Optionally additional information such as the fully specified name or preferred term of each concept in the set.
Get subtype descendants of a concept
conceptId
Optionally, language or dialect code
Set of conceptIds of all concepts with a direct or transitive 116680003 | is a | relationship to the specified concept.
Optionally additional information such as the fully specified name or preferred term of each concept in the set.
Get supertype ancestors of a concept
conceptId
Optionally, language or dialect code
Set of conceptIds of all concepts with a direct or transitive 116680003 | is a | relationship from the specified concept.
Optionally additional information such as the fully specified name or preferred term of each concept in the set.
Test subsumption between two concepts 3
Predicate.conceptId
Candidate.conceptId
If Candidate concept is a subtype descendant of the predicate concept: TRUE
Otherwise: FALSE
Test a set of concepts for subsumption 3
Predicate.conceptId
Set of candidate.conceptIds
Set of conceptIds of all concepts in the candidate set that have a direct or transitive 116680003 | is a | relationship from the specified concept.
Interdependencies
Required By
Depends On
Service Examples
The Snowstorm and FHIR examples are presented in plain text and URL encoded versions. Always use the "Encoded URL" when testing the example service requests. The plain text version is included to aid readability but using this version in a service request may result in errors. These errors result from characters that have to be encoded as they are not permitted in a URL (see IETF RFC1738).
Snowstorm API
Get subtype children of a concept
GET [snowstorm]/browser/[branch]/concepts/[conceptId]/children
for example
GET [snowstorm]/browser/MAIN/2020-01-31/concepts/80146002/children
Encoded URL
GET [snowstorm]/browser/MAIN%2F2020-01-31/concepts/80146002/children
Returns a JSON representation of data about each of the child concepts.
The data returned for each concept includes:
All concept release file data
The preferred term and fully specified name.
Also returns the total number of child concepts.
Get supertype parents of a concept
GET [snowstorm]/browser/[branch]/concepts/[conceptId]/parents
for example
GET [snowstorm]/browser/MAIN/2020-01-31/concepts/80146002/parents
Encoded URL
GET [snowstorm]/browser/MAIN%2F2020-01-31/concepts/80146002/parents
Returns a JSON representation of data about each of the parent concepts.
The data returned for each concept includes:
All concept release file data
The preferred term and fully specified name.
Also returns the total number of parent concepts.
Get subtype descendants of a concept
GET [snowstorm]/[branch]/concepts/[conceptId]/descendants
for example
GET [snowstorm]/MAIN/2020-01-31/concepts/80146002/descendants?limit=50&offset=0
Encoded URL
GET [snowstorm]/MAIN%2F2020-01-31/concepts/80146002/descendants?limit=50&offset=0
Returns a JSON representation of data about each of the descendant concepts.
The data returned for each concept includes:
All concept release file data
The preferred term and fully specified name.
Also returns the total number of descendant concepts.
As some concepts have very large numbers of descendants, this service is paged. Requests parameters include:
limit to restrict the number of descendants returned (default 50).
offset to specify the start in the results (in multiples of the limit).
Get supertype ancestors of a concept
GET [snowstorm]/browser/[branch]/concepts/[conceptId]/ancestors
for example
GET [snowstorm]/browser/MAIN/2020-01-31/concepts/80146002/ancestors
Encoded URL
GET [snowstorm]/browser/MAIN%2F2020-01-31/concepts/80146002/ancestors
Returns a JSON representation of data about each of the ancestor concepts.
The data returned for each concept includes:
All concept release file data
The preferred term and fully specified name.
Also returns the total number of ancestor concepts.
Test subsumption between two concepts
Snowstorm does not provide a specific service for this test, but the test can be accomplished using the Get Concepts service (see Validate and Apply Expression Constraints) with a combination of an expression constraint to represent the subsumption requirement and a list of concept identifiers.
GET [snowstorm]/MAIN/2020-01-31/concepts?ecl=<[predicateSupertypeId]&conceptIds=[candidateSubtypeId]
For example
GET [snowstorm]/MAIN/2020-01-31/concepts?ecl=<404684003&conceptIds=703264005
Encoded URL
GET [snowstorm]/MAIN%2F2020-01-31/concepts?ecl=%3C404684003&conceptIds=703264005
Returns a JSON object with contents that depend on whether the candidate concept is a subtype of the predicate concept:
If it is a subtype descendant the returned object contains:
The property total with value 1; and
An item array that contains data about the candidate concept (as it is the only concept that is both a subtype of the predicate and equal to the candidate concept).
If it is not a subtype descendant the returned object contains:
The property total with value 0.
Test a set of concepts for subsumption
Snowstorm does not provide a specific service for this test but the technique used in the row above can be used with all the candidate concept identifiers included in the comma separated list.
GET [snowstorm]/MAIN/2020-01-31/concepts?ecl=<[predicateSupertypeId]&conceptIds=[candidateSubtypeIdList]
For example
GET [snowstorm]/MAIN/2020-01-31/concepts?ecl=<404684003&conceptIds=703264005,307581005,195967001
Encoded URL
GET [snowstorm]/MAIN%2F2020-01-31/concepts?ecl=%3C404684003&conceptIds=703264005%2C307581005%2C195967001
Returns a JSON representation of the candidate concepts that are subtypes descendants of the predicate concept.
If one or more of the predicate concepts are subtypes of the candidate concept the returned object contains:
The property total with value equal to the number of candidate concepts that are subtypes of the predicate concept; and
For each candidate concept that is a subtype of the predicate concept a an item array that contain data about that candidate concept .
If none of the candidate subtypes are a subtype descendants the returned object contains:
The property total with value 0.
As some expression constraints are matched by large numbers of concept, this service is paged. Requests parameters include:
limit to restrict the number of concepts returned (default 50).
offset to specify the start in the results (in multiples of the limit).
FHIR API
Get subtype children of a concept
FHIR does not provide a specific operation for this service, but the SNOMED CT Expression Constraint Language supports that retrieval of the direct children of SNOMED CT concept, and can thus be used to enable this service through the ValueSet/$expand operation.
GET [fhir]/ValueSet/$expand?url=[editionURI/versionURI]?fhir_vs=ecl/<![predicateSupertypeId]&count=10
for example:
GET [fhir]/ValueSet/$expand?url=http://snomed.info/sct?fhir_vs=ecl/<!26322001&count=10
Returns a JSON representation of data about each of the subtype children concepts.
The data returned for each concept includes:
code: the code for each subtype child
display: the preferred term for subtype child
Also returns the total number of children concepts.
As some concepts have very large numbers of children, this service is paged. Requests parameters include:
count to restrict the number of children returned.
offset to specify the start in the results (in multiples of the limit).
Get supertype parents of a concept
FHIR does not provide a specific operation for this service, but the SNOMED CT Expression Constraint Language supports that retrieval of the direct parents of SNOMED CT concept, and can thus be used to enable this service through the ValueSet/$expand operation.
GET [fhir]/ValueSet/$expand?url=[editionURI/versionURI]?fhir_vs=ecl/>![predicateSubtypeId]&count=10
for example:
GET [fhir]/ValueSet/$expand?url=[editionURI/versionURI]?fhir_vs=ecl/>!26322001&count=10
Returns a JSON representation of data about each of the parent concepts.
The data returned for each concept includes:
code: the code for each parent
display: the preferred term for each parent
Also returns the total number of parent concepts.
As some concepts have very large numbers of parents, this service is paged. Requests parameters include:
count to restrict the number of parents returned.
offset to specify the start in the results (in multiples of the limit).
Get subtype descendants of a concept
Option 1)
GET [fhir]/ValueSet/$expand?url=[editionURI/versionURI]?fhir_vs=isa/[predicateSupertypeId]&count=10
for example:
GET [fhir]/ValueSet/$expand?url=http://snomed.info/sct?fhir_vs=isa/27624003&count=10
Option 2)
GET [fhir]/ValueSet/$expand?url=[editionURI/versionURI]?fhir_vs=ecl/[predicateSupertypeId]&count=10
GET [fhir]/ValueSet/$expand?url=[editionURI/versionURI]?fhir_vs=ecl/<26322001&count=10
Returns a JSON representation of data about each of the descendant concepts.
The data returned for each concept includes:
code: the code for each descendant
display: the preferred term for each descendant
Also returns the total number of descendant concepts.
As some concepts have very large numbers of descendants, this service is paged. Requests parameters include:
count to restrict the number of descendants returned.
offset to specify the start in the results (in multiples of the limit).
Get supertype ancestors of a concept
FHIR does not provide a specific operation for this service, but the SNOMED CT Expression Constraint Language supports that retrieval of the ancestors of SNOMED CT concept, and can thus be used to enable this service through the ValueSet/$expand operation.
GET [fhir]/ValueSet/$expand?url=[editionURI/versionURI]?fhir_vs=ecl/>[predicateSubtypeId]&count=10
for example:
GET [fhir]/ValueSet/$expand?url=[editionURI/versionURI]?fhir_vs=ecl/>26322001&count=10
Returns a JSON representation of data about each of the ancestor concepts.
The data returned for each concept includes:
code: the code for each descendant
display: the preferred term for each descendant
Also returns the total number of descendant concepts.
As some concepts have very large numbers of ancestors, this service is paged. Requests parameters include:
count to restrict the number of descendants returned.
offset to specify the start in the results (in multiples of the limit).
Test subsumption between two concepts
GET [fhir]/CodeSystem/$subsumes?system=[systemURI]&version=[versionURI]&codeA=[conceptId]&codeB=[conceptId]
for example:
GET [fhir]/CodeSystem/$subsumes?system=http://snomed.info/sct&version=http://snomed.info/sct/900000000000207008/version/20200131&codeA=307355007&codeB=118940003
Returns a JSON representation of information about the subsumption relation between the two concepts:
subsumed-by indicates that the concept provided as the value for codeA is a subtype of the concept provided as the value for codeB
subsumes indicates that the concept provided as the value for codeA is a supertype of the concept provided as the value for codeB
not-subsumed indicates that there is no subsumption relationship between the concepts provided as values for codeA and codeB
MySQL Example Database
Get subtype children of a concept
SELECT id,term FROM snap_rel_child_fsn WHERE conceptId=[conceptId]
for example
SELECT id,term FROM snap_rel_child_fsn WHERE conceptId=80146002
Returns rows containing the id and term for each subtype child of the specified concept.
The query shown return the fully specified name as the term for each concept
Replace the view suffix _fsn with _pref to return the preferred term for each concept
Get supertype parents of a concept
SELECT id,term FROM snap_rel_parent_fsn WHERE conceptId=[conceptId]
for example
SELECT id,term FROM snap_rel_parent_fsn WHERE conceptId=80146002
Returns rows containing the id and term for each supertype parent of the specified concept.
The query shown return the fully specified name as the term for each concept
Replace the view suffix _fsn with _pref to return the preferred term for each conce
Get subtype descendants of a concept
SELECT id,term FROM snap_tc_descendant_pref WHERE conceptId=[conceptId]
for example
SELECT id,term FROM snap_tc_descendant_pref
WHERE conceptId=80146002
Returns rows containing the id and term for each subtype descendant of the specified concept.
The query shown return the preferred term for each concept
Replace the view suffix _pref with _fsn to return the fully specified name for each concept
Get supertype ancestors of a concept
SELECT id,term FROM snap_tc_ancestor_pref
WHERE conceptId=[conceptId]
for example
SELECT id,term FROM snap_tc_ancestor_pref
WHERE conceptId=80146002
Returns rows containing the id and term for each supertype ancestor of the specified concept.
The query shown return the preferred term for each concept
Replace the view suffix _pref with _fsn to return the fully specified name for each concept
Test subsumption between two concepts
SELECT count(supertypeId) FROM snap_transclose
WHERE supertypeId=[predicateConceptId]
AND subtypeId=[candidateConceptId] WHERE conceptId=80146002
for example
SELECT count(supertypeId) FROM snap_transclose
WHERE supertypeId=80146002 AND subtypeId=6025007
Returns 1 if the candidate concept is a subtype of the supertype concept.
Test a set of concept for subsumption
Different approaches can be used depending on the specific requirement. As with the options for
Use the get descendants service to generate the list of descendants of the predicate concept and use this list as part of a query for records containing subtypes of that concept;
Individually, apply the test for subsumption between two concepts to each candidate concept;
Extend the ECL query to include all the candidate concepts as illustrated below.
WHERE supertypeId=80146002 AND subtypeId=602500
Option 3 will return the ids of concepts in the bracketed list that are subtypes descendants of the predicate concept.
Notes
The services in this table that list subtype and supertype concepts are a subset of the services required to implement expression constraints (see see [4.7 Validate and Apply Expression Constraints" style="width: 100%;">). Therefore, it is recommended that the Expression Constraint Language syntax is used when requesting these services.
Language and/or dialect should be specified if the service returns terms associated with referenced concepts.
The subsumption test services are marked as recommended rather than required because they can be implemented by the client application using the results of the get subtype descendants and/or get supertype ancestors services.
In the Snowstorm service requests [snowstorm] should be replaced by the URL to the Snowstorm server endpoint.
Data in the definitionStatusId and active columns is represented as symbolic names rather than the boolean and SCTID data types used in release file columns.
In the FHIR service requests [fhir] should be replaced by the URL to the FHIR terminology server endpoint. FHIR® is a registered trademarks of HL7 (www.hl7.org).
The SNOMED CT MySQL example database is not designed as a terminology server and is not intended for use in a live system . It is referenced in this guide as an illustration that some readers may find helpful. For more information about the SNOMED CT example database see the SNOMED CT - SQL Practical Guide. For instructions on how to build the example database refer to Appendix A: Building the SNOMED CT Example Database.
Last updated