Imagelink Summary

Synopsis

This query finds all imagelink relations extracted by the NLP API, showing the annotated terms for the image reference and findings.

SQL statements to retrieve filename and patient id are provided but commented out.

Processing Requirements

This query assumes that at least the following emtellipro-db-client processing options were enabled:

  • --feature imagelink-relations
  • --store-sections-and-sentences

Clinical Context

Cross-sectional medical imaging studies such as MRI and CT may contain hundreds to thousands of images, which according to the DICOM standard, are organized into one or more series that contain one or more images. When a radiologist dictates the study, to aid in finding the lesion in question by the reader of the report, they may dictate the series number and image number of the lesion using varying notation methods. An example of this would be “There is a 5 mm nodule in the right lower lobe (4:3).” to indicate that the nodule is present on image 3 of series 4, or they may more explicitly state an image location as “There is a 1.2 cm hemangioma in Segment IVa of the liver on (Series 601, Image 29)”.

The NLP API identifies these Imagelink relations between the pathology (or finding) being described and the series/image annotation and returns them as a relation. The query below can be used to retrieve the finding and image reference from radiology reports.

SQL query

SELECT image_e.document_id AS doc_id,
imagelinkrelation.id AS imagerelation_id,
-- regexp_replace(d.filename, '.*/', '') AS filename,
-- dm.subject_id AS subject_id,
image_fe.text AS image_reference_term,
STRING_AGG(finding_fe.text, ', ') AS image_finding_terms
FROM imagelinkrelation
-- Joins to retrieve entity text for 'Image FINDING' foundentity
JOIN imagelinkrelationimagefinding image_finding
ON image_finding.imagelink_id = imagelinkrelation.id
JOIN entity finding_e
ON finding_e.id = image_finding.entity_id
JOIN foundentity finding_fe
ON finding_fe.id = finding_e.entity_id AND finding_e.type_ = 'found'
-- Joins to retrieve entity text for 'Image REFERENCE'
JOIN imagelinkrelationreference image_ref
ON image_ref.imagelink_id = imagelinkrelation.id
JOIN entity image_e
ON image_e.id = image_ref.entity_id
JOIN foundentity image_fe
ON image_fe.id = image_e.entity_id AND image_e.type_ = 'found'
-- Joins to retrieve document filename
-- JOIN document d ON image_fe.document_id = d.id
-- Joins to retrieve subject id from documentmetadata (if populated)
-- JOIN documentmetadata dm ON d.id = dm.document_id
-- GROUP BY imagelinkrelation.id, regexp_replace(d.filename, '.*/', '') AS filename, dm.subject_id, image_fe.txt
GROUP BY image_e.document_id, imagelinkrelation.id, image_fe.text
ORDER BY imagelinkrelation.id;
doc_idimagerelation_idimage_reference_termimage_finding_terms
61series 3, image 53umbilical hernia
62series 3, image 104rectal wall thickening
103series 68 image 29lateral cervical nodes
104series 68 image 290.6cm
105series 68 image 290.9cm
106series 68 image 20lateral cervical node
107series 68 image 200.7 cm
108series 68 image 15nodes
109series 68 image 15lateral cervical nodal chain
1010series 68 image 150.5cm

Next steps

After previewing the data extracted by imagelink relations, you may want to limit the result set to the imaging results for certain findings only. You can do this in a number of ways:

  1. Using SQL pattern-matching operators (i.e. LIKE and ILIKE) to find specific words in the annotated text.
  2. Using a concept-based approach where you search for finding entities that are mapped to a specific concept ID e.g. for a specific anatomical feature, or morphological abnormalities. This example shows how to search for specific concepts, see Sleep Apnea.
  3. Using a concept hierarchy search. This type of query searches for a parent and all its children concepts using Snomed CT. Examples of this approach, are found here.
  4. For the most general search, you may also choose to search for a specific entity type.