Search



Page tree

  

Composite description views enable access to appropriate individual descriptions or sets of descriptions in a specific language or dialect. There are two sets of composite description views.  Views in the first of these sets are designed to facilitate selecting descriptions associated with one or more identified concepts. Views in the other set are designed to enable searching descriptions to find concepts.

Views that Facilitate Selecting Concept Descriptions

For each snapshot view the SNOMED CT example database includes four views designed for selecting specific sets of descriptions for one or more specified concepts. The characteristics of each of these views are shown in  Table 4.8.2-1 and a general template for the SQL definitions of these views is shown in  Template 4.8.2-1. To create each of the views named in the table, the placeholders for {typeId} and {acceptabilityId} need to be replaced with values in the Specific Settings column of the table. 

Example 4.8.2-1 demonstrates the use of these views to show all the active descriptions of a specified concept that are acceptable or preferred according to the language reference set referenced by the configuration file.

Table 4.8.2-1: Composite Description Views for Selecting Concept Descriptions

Name1

DescriptionSpecific Settings
{typeId} { acceptabilityId }

snap_fsn

This view selects the fully specified name of a concept (identified by conceptId)

= 900000000000003001= 900000000000548007

snap_pref

This view selects the preferred synonym of a concept (identified by conceptId)

= 900000000000013009= 900000000000548007

snap_syn

This view selects other acceptable synonyms of a concept (identified by conceptId)= 900000000000013009= 900000000000549004

snap_synall

This view selects all synonyms of a concept (identified by conceptId)= 900000000000013009

IN (900000000000548007, 900000000000549004)2


Template 4.8.2-1: Description Selection Composite View Template

CREATE VIEW `snap_{name}` AS
(SELECT `d`.* FROM `snap_description` `d`
    JOIN `snap_refset_Language` `rs` ON `d`.`id` = `rs`.`referencedComponentId`
    JOIN `config_settings` `cfg` ON `rs`.`refSetId` = `cfg`.`languageId` 
    WHERE `d`.`active` = 1 AND `d`.`typeId` {typeId}
    AND `rs`.`active` = 1 AND `rs`.`acceptabilityId` {acceptabilityId}
    AND `cfg`.`id`=0);

Example 4.8.2-1: Selecting Description Data for a Concept

SQL Query
Select conceptId,'FSN',id,term from snap_fsn where conceptId=95570007
UNION
Select conceptId,'Pref',id,term from snap_pref where conceptId=95570007
UNION
Select conceptId,'Syn',id,term from snap_syn where conceptId=95570007;
Result
conceptIdFSNidterm
95570007FSN839752010

Kidney stone (disorder)

95570007Pref158296018Kidney stone
95570007Syn158297010Renal stone
95570007Syn158298017Nephrolith
95570007Syn158299013Renal calculus
95570007Syn512193015

Calculus of kidney

95570007Syn512194014Nephrolithiasis
95570007Syn512195010Kidney calculus

Views that Facilitate Searching for Concepts

For each snapshot view the SNOMED CT example database includes two views that are designed to facilitate searches for concepts associated with terms that match specified criteria. These views require both the description and the associated concept to be active in the chosen snapshot. This avoids the need to filter out inactive concepts from the search results3 . The specific characteristics of these views is shown in  Table 4.8.2-2 and a general template for the SQL definitions of these views is shown in  Template 4.8.2-2. To create the each of the views named in the table, the placeholder for {typeId} needs to be replaced with values in the Specific Settings column of the table. 

Example 4.8.2-2 show a query that searches the snap_syn_search_active view using MySQL's boolean full text search. This search method requires all the words preceded by + (plus) to be included and excludes all words preceded by - (minus). The results are shown together with the fully specified name of the concept (looked up using the snap_fsn view).  Although this is not a user-friendly way to specify a searches, the example SQL code illustrates the technical power of this search technique. Other search techniques can also be applied to the search views and additional options for enhancing searches are discussed in  4.9.4. Search Procedures.

Name1

DescriptionSpecific Settings
{typeId}

snap_syn_search_active

This view includes active preferred and acceptable synonyms of active concepts. It excludes fully specified names and also excludes all descriptions associated with concepts that are inactive in the specified snapshot.= 900000000000013009

snap_term_search_active

This view includes active preferred and acceptable synonyms of active concepts.

IN (900000000000003001, 900000000000013009)4

CREATE VIEW `snap_syn_search_active` AS
(SELECT `d`.*,`rs`.`acceptabilityId` FROM `snap_description` `d`
    JOIN `snap_refset_Language` `rs` ON `d`.`id` = `rs`.`referencedComponentId`
    JOIN `snap_concept` `c` ON `c`.`id` = `d`.`conceptId`
    JOIN `config_settings` `cfg` ON `rs`.`refSetId` = `cfg`.`languageId`
    WHERE `d`.`active` = 1 AND `d`.`typeId` {typeId}
    AND `rs`.`active` = 1
    AND `c`.`active` = 1
    AND `cfg`.`id`=0);

Usage Example

SQL Query
SELECT `s`.`conceptId`,`s`.`term` 'matching term',`f`.`term` `FSN` FROM `snap_syn_search_active` `s`
	JOIN `snap_fsn` `f` ON `f`.`conceptId`=`s`.`conceptId`
    WHERE MATCH (`s`.`term`)
			AGAINST ('+acute +anterior +myocardial +infarction -ecg -old -ekg' IN BOOLEAN MODE) ORDER BY length(`f`.`term`),length(`s`.`term`);
Result
conceptIdmatching termFSN
54329005Acute anterior myocardial infarction

Acute myocardial infarction of anterior wall (disorder)

54329005Acute myocardial infarction of anterior wall

Acute myocardial infarction of anterior wall (disorder)

703164000Acute anterior ST segment elevation myocardial infarction

Acute ST segment elevation myocardial infarction of anterior wall (disorder)

703164000Acute STEMI (ST elevation myocardial infarction) of anterior wall

Acute ST segment elevation myocardial infarction of anterior wall (disorder)

703164000Acute ST segment elevation myocardial infarction of anterior wall

Acute ST segment elevation myocardial infarction of anterior wall (disorder)

703252002Acute myocardial infarction of anterior wall involving right ventricle

Acute myocardial infarction of anterior wall involving right ventricle (disorder)

703252002Acute myocardial infarction of anterior wall with right ventricular involvement

Acute myocardial infarction of anterior wall involving right ventricle (disorder)

703165004Acute ST segment elevation myocardial infarction of anterior wall involving right ventricle

Acute ST segment elevation myocardial infarction of anterior wall involving right ventricle (disorder)

703165004Acute anterior ST segment elevation myocardial infarction with right ventricular involvement

Acute ST segment elevation myocardial infarction of anterior wall involving right ventricle (disorder)

703165004Acute STEMI (ST elevation myocardial infarction) of anterior wall with right ventricular involvement

Acute ST segment elevation myocardial infarction of anterior wall involving right ventricle (disorder)

285981000119103Acute ST segment elevation myocardial infarction involving left anterior descending coronary artery

Acute ST segment elevation myocardial infarction involving left anterior descending coronary artery (disorder)



Footnotes
Ref Notes
1 The prefix snap is replaced by snap1 or snap2 for retrospective views. [ a b ]
2 An alternative way to represent snap_synall is to remove the acceptability condition. The link to the language refset and the test for the `rs`.`active` condition must retained to ensure only descriptions in the relevant language refset are returned.
3 Requirements for searches that need to include inactive concepts can be run against the concept description selection views.
4 Alternatively remove the typeId condition to permit all types to be searched.


Feedback
  • No labels