Anatomic Site Relations

In this section, we explain how structured data for anatomic site 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:

  1. Understand what anatomic site relations are.
  2. Understand what site entities and situated entities are and how to search for them.
  3. Know how to use anatomic site 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 Anatomic Site Relations?

An anatomic site relation is a relation between a SNOMED body structure entity and entities that about a disease or condition, typically disorders, findings and morphologic abnormalities. An anatomic site relation has two arguments:

  • the site id associated with the body structure mention, and
  • the situated entity id which is the associated observation.

Let’s consider this sentence.

She does note a pruritic rash on her upper back.

For the above sentence, the NLP API extracts the subject and value entities that comprise the anatomic site relation as shown:

Anatomic site relation required and optional arguments

The site of the relation is upper back, and the terms that indicate or describe a disease state is the situated entity. In this sentence, the situated entity is pruritic rash. In addition to disorders, a situated entity may be a finding, morphologic abnormality, or qualifier entity type.

Anatomic site relations are one-to-one relations. If there are several situated entities per site, then each pair of site and situated entity will be represented by its own anatomic site relation instance.

Here are a two more examples:

The pain was well localized in her epigastric region.

In this sentence, the site entity is epigastric region which is the affected body structure. The situated entity is pain, a finding.

CT raised the concern of possible stroke with new bleed in the R external capsule.

Likewise, in the sentence above, the site entity is external capsule, and the situated entity is bleed, a morphologic abnormality.

The site entity are mapped to a subset of SNOMED concepts of semantic tag body structure.

JSON Data Model

Consider the following sentence:

The pain was well localized in her epigastric region.

An anatomic site relation is extracted from the sentence above as shown in the following JSON excerpt:

{
"relations": {
"anatomicsites": [
{
"label": "RA0",
"attributes": {
"confidence": 1
},
"args": {
"site": {
"ref": "E4",
"text": [
"epigastric region"
]
},
"situated_entity": {
"ref": "E0",
"text": [
"pain"
]
}
},
"concept_links": []
}
]
}
}

Notice the following:

  • The relations object contains an anatomicsites array. This array contains objects that are anatomic site relation instances.
  • An anatomic site relation instance has two named arguments: the site and the situated_entity. Each is a reference to an Entity.
  • Each entity reference resolves to an object in the entities and foundentities array. Key information about an entity is stored as attributes of these objects.
  • Each entity reference also resolves to a unique concept id in supported ontologies.

Anatomic Site Relation Tables

The following ER diagram, shows the relationship between the anatomicsiterelation table and the entity tables

Entity-Relation diagram showing anatomic site relation and associated entity-level tables.

From the diagram above, notice the following key points about the anatomic site relation schema:

  • The anatomicsiterelation table contains foreign key IDs for the entity table: the site_id and situated_entity_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.

Sample Queries

In this section, we provide examples of SQL queries that retrieve information about anatomic site relations. The first query shows how to work with the anatomicsiterelation table. The second query shows how to combine data retrieved about body structures and qualifiers by querying anatomic site and qualifier relations.

This section contains the following queries:

Query: Retrieve information about anatomic site relations

This query finds anatomic site relations and displays the annotated terms for its arguments. To provide context, this query also displays the sentence which contains the anatomic site relation. Note that this query only returns situated entities that are positively asserted and certain.

To find information about anatomic site relations we begin with the anatomicsiterelation table. From there various JOIN clauses are used to retrieve the attributes about the site and situated entities from the tables that store them in the NLP API’s relational database schema. These include the foundentity table.

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 site or the situated argument of the relation in the JOIN clauses. The query consist of three parts:

  1. Part 1: Retrieve the attributes of the site argument by performing an inner join between the anatomicsiterelation table site_id with the entity table id key.
  2. Part 2: Retrieve the attributes of the situated_entity argument by performing an inner join between the anatomicsiterelation table situated_entity_id with the entity table id key.
  3. Part 3: Retrieve the sentence where the anatomic site is 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.
SELECT
situated_fe.text as term,
situated_c.description as concept,
site_fe.text as bodystructure_term,
site_c.description as bodystructure_concept,
sloc.text
FROM anatomicsiterelation asr
-- get information about site entity
JOIN entity site_e ON asr.site_id = site_e.id AND site_e.type_ = 'found'
JOIN foundentity site_fe ON site_e.entity_id = site_fe.id
JOIN foundentityconcept site_fec ON site_fe.id = site_fec.found_entity_id
JOIN concept site_c
ON site_fec.concept_id = site_c.concept_id and site_fec.concept_ontology = site_c.ontology AND
site_c.ontology = 'snomed'
-- get information about *situated* entity
JOIN entity situated_e ON asr.situated_entity_id = situated_e.id AND situated_e.type_ = 'found'
JOIN foundentity situated_fe ON situated_e.entity_id = situated_fe.id
JOIN foundentityconcept situated_fec ON situated_fe.id = situated_fec.found_entity_id
JOIN concept situated_c
ON situated_fec.concept_id = situated_c.concept_id and situated_fec.concept_ontology = situated_c.ontology AND
situated_c.ontology = 'snomed'
-- retrieve sentence
JOIN foundentitylocation fel ON site_fe.id = fel.found_entity_id
JOIN location loc ON fel.location_id = loc.id AND loc.type_ = 'sentence'
JOIN sentencelocation sloc ON loc.location_id = sloc.id
WHERE situated_fe.polarity = 'asserted' AND situated_fe.uncertainty = 'uncertain'
LIMIT 5;
termconceptbodystructure_termbodystructure_concepttext
AnemiaAnemia (disorder)LungsBoth lungs (body structure)• Chest X-RAY 2 views | Lungs are not clear, cannot rule out Anemia.
architectural distortionMammographic architectural distortion of breast (finding)breastBreast structure (body structure)New ill-defined density with possible architectural distortion in the right medial breast on screening mammogram of 01/02/2022.
arthritisArthritis (disorder)first CMC jointCarpometacarpal joint structure of thumb (body structure)She has some pain in her right first CMC joint, which she thinks could be arthritis.
ascitesAscites (disorder)loops of bowelIntestinal structure (body structure)The overall impression was that the centrally located loops of bowel are suggestive of ascites.
ascitesAscites (disorder)loops of bowelIntestinal structure (body structure)Centrally located loops of bowel are suggestive of ascites - for clinical correlation.

Query: Find anatomic site and qualifiers for disorders

In the sample query below, we provide a more complex query that finds all SNOMED disorders, and retrieves associated qualifier and anatomic site information. To do this, we first find all disorder entities from the foundentity table, where the found entity has an entity type of disorder, then we perform joins with two relation tables: the qualifierrelation and anatomicsiterelation tables. For readability, we will write two CTEs (common table expressions) to query for anatomic sites and qualifiers respectively.

Because not all disorder mentions have qualifiers or anatomic site information, we must be careful to use LEFT JOINs.

To return fewer rows, we limit the query results as follows:

  • return positively asserted and certain disorder mentions
  • return qualifiers of type status and size/severity, as these are more pertinent for disorder concepts.
  • return only those disorder mentions which have an anatomic site relation (i.e. which are associated with a body structure site entity).
WITH anatomic_sites AS (SELECT situated_fe.id as situated_fe_id,
site_fe.text as bodystructure_term,
site_c.description as bodystructure_concept
FROM anatomicsiterelation asr
JOIN entity site_e ON asr.site_id = site_e.id AND site_e.type_ = 'found'
JOIN foundentity site_fe ON site_e.entity_id = site_fe.id
JOIN foundentityconcept site_fec ON site_fe.id = site_fec.found_entity_id
JOIN concept site_c
ON site_fec.concept_id = site_c.concept_id and
site_fec.concept_ontology = site_c.ontology AND
site_c.ontology = 'snomed'
JOIN entity situated_e
ON asr.situated_entity_id = situated_e.id AND situated_e.type_ = 'found'
JOIN foundentity situated_fe ON situated_e.entity_id = situated_fe.id
JOIN foundentityconcept situated_fec ON situated_fe.id = situated_fec.found_entity_id
JOIN concept situated_c
ON situated_fec.concept_id = situated_c.concept_id and
situated_fec.concept_ontology = situated_c.ontology AND
situated_c.ontology = 'snomed'),
qualifiers AS (SELECT qualified_fe.id as qualifier_subject_fe_id,
qr.qualifier_type,
qualifier_fe.text as qualifier_term,
qualifier_c.description as qualifier_concept
FROM qualifierrelation qr
JOIN entity qualified_e ON qr.qualifies_id = qualified_e.id AND qualified_e.type_ = 'found'
JOIN foundentity qualified_fe ON qualified_e.entity_id = qualified_fe.id
JOIN entity qualifier_e ON qr.qualifier_id = qualifier_e.id AND qualifier_e.type_ = 'found'
JOIN foundentity qualifier_fe ON qualifier_e.entity_id = qualifier_fe.id
JOIN foundentityconcept qualifier_fec ON qualifier_fe.id = qualifier_fec.found_entity_id
JOIN concept qualifier_c ON qualifier_fec.concept_id = qualifier_c.concept_id and
qualifier_fec.concept_ontology = qualifier_c.ontology AND
qualifier_c.ontology = 'snomed'
)
SELECT fe.text as disorder_term, c.description as disorder_concept,
a_site.bodystructure_term, a_site.bodystructure_concept,
qual.qualifier_term,
sloc.text as sentence
FROM foundentity fe
JOIN foundentityconcept fec ON fe.id = fec.found_entity_id
JOIN foundentitytype fet ON fe.id = fet.found_entity_id
JOIN concept c ON fec.concept_id = c.concept_id and fec.concept_ontology = c.ontology AND c.ontology = 'snomed'
JOIN foundentitylocation fel ON fe.id = fel.found_entity_id
JOIN location loc ON fel.location_id = loc.id AND loc.type_ = 'sentence'
JOIN sentencelocation sloc ON loc.location_id = sloc.id
LEFT JOIN anatomic_sites a_site ON fe.id = a_site.situated_fe_id
LEFT JOIN qualifiers qual ON fe.id = qual.qualifier_subject_fe_id
WHERE fet.ontology = 'snomed'
AND fet.type_name = 'disorder'
AND qualifier_type IN ( 'size/severity', 'status' )
AND a_site.bodystructure_term IS NOT NULL
AND fe.polarity = 'asserted' AND fe.uncertainty = 'certain'
LIMIT 5;
disorder_termdisorder_conceptbodystructure_termbodystructure_conceptqualifier_termsentence
actinic degenerationSolar degeneration (disorder)dermisDermis structure (body structure)markedThere is marked actinic degeneration of collagen in the dermis and a mild chronic inflammatory infiltrate.
adenocarcinoma of the colonPrimary adenocarcinoma of colon (disorder)lymph nodesStructure of lymph node (body structure)high gradeShe had surgery and was found to have a high grade adenocarcinoma of the colon with 4 out of 15 lymph nodes positive.
arachnoid cystArachnoid cyst (disorder)middle cranial fossaEntire middle fossa of cranial cavity (body structure)smallIncidental note is made of a small arachnoid cyst within the anterior left middle cranial fossa.
arthrosisArthropathy (disorder)patellofemoral compartmentStructure of patellofemoral joint (body structure)high-gradeThere is arthrosis, with high-grade changes in the patellofemoral compartment, particularly along the midline patellar ridge and lateral facet.
arthrosisArthropathy (disorder)lateral facetStructure of lateral articular facet of patella (body structure)high-gradeThere is arthrosis, with high-grade changes in the patellofemoral compartment, particularly along the midline patellar ridge and lateral facet.

Utility SQL Queries

Below are some helpful queries for exploring anatomic site relations.

-- Find the number of anatomic site relations in the data
SELECT count(*) from anatomicsiterelation;
-- Find distinct body structure concepts in anatomic site relations
SELECT DISTINCT site_c.concept_id, site_c.description
FROM anatomicsiterelation asr
JOIN entity site_e ON asr.site_id = site_e.id AND site_e.type_ = 'found'
JOIN foundentity site_fe ON site_e.entity_id = site_fe.id
JOIN foundentityconcept site_fec ON site_fe.id = site_fec.found_entity_id
JOIN concept site_c
ON site_fec.concept_id = site_c.concept_id and site_fec.concept_ontology = site_c.ontology AND
site_c.ontology = 'snomed'
ORDER BY site_c.description;