SNOMED CT SQL Practical Guide
SNOMED CT SQL Practical Guide
This PDF document was generated from the web version on the publication date shown
above. Any changes made to the web pages since that date will not appear in the PDF.
See the web version of this document for recent updates.
Table of Contents
1. Introduction................................................................................................................................................2
2. Objectives, Audiences and Uses ................................................................................................................3
3. SNOMED CT Example Database.................................................................................................................4
4. Database Design.........................................................................................................................................7
4.1. Essential Reference Information .........................................................................................................................7
4.2. Release Type Options...........................................................................................................................................7
4.3. Data Type Options..............................................................................................................................................11
4.4. Database Table Naming.....................................................................................................................................13
4.5. Database Table Design.......................................................................................................................................16
4.6. Enabling Versioned Views ..................................................................................................................................18
4.7. Enabling Subtype Testing ..................................................................................................................................28
4.8. Composite Views ................................................................................................................................................29
4.9. Stored Procedures .............................................................................................................................................47
5. Creating and Populating a SNOMED CT Database..................................................................................59
5.1. Creating the Database........................................................................................................................................59
5.2. Creating Tables for Components.......................................................................................................................59
5.3. Creating Tables for Reference Sets ...................................................................................................................63
5.4. Importing Release Files......................................................................................................................................67
Appendix A: Building the SNOMED CT Example Database.........................................................................70
A.1 Download the SNOMED CT Example Database Package ..................................................................................70
A.2 Download the Release File Package ..................................................................................................................70
A.3 Instructions for Mac OS Users.............................................................................................................................71
A.4 Instructions for Windows Users..........................................................................................................................76
A.5 Using MySQL Workbench to Query SNOMED CT................................................................................................90
A.6 Overview of the SNOMED CT MySQL Database .................................................................................................95
A.7 MySQL Reference Data......................................................................................................................................101
Appendix B: Obtaining SNOMED CT Release Files....................................................................................103
Appendix C: Release Types and Versioned Views.....................................................................................105
C.1. Practical Uses for Versioned Views .................................................................................................................106
C.2. Release Type Support for Versioned Views ....................................................................................................107
C.3. Common Mistakes with Snapshot Generation...............................................................................................107
This guide provides a simple and practical example of how a relational database can be used to enable
effective access to the content and features of SNOMED CT. The guide includes tested SQL scripts for loading
release files into a relational database, searching the terminology and querying the terminology for concepts
that meet simple but useful constraints.
The primary purpose of this document is to enhance understanding of the logical design of SNOMED CT and to
provide practical ways to access the key features of SNOMED CT in a widely understood programming
language. For more scalable and performant approaches to implementing SNOMED CT please visit SNOMED
International's Github repository - e.g. https://github.com/IHTSDO.
This document is a publication of International Health Terminology Standards Development Organisation, trading as SNOMED International.
SNOMED International owns and maintains SNOMED CT®.
Any modification of this document (including without limitation the removal or modification of this notice) is prohibited without the express
written permission of SNOMED International. This document may be subject to updates. Always use the latest version of this document
published by SNOMED International. This can be viewed online and downloaded by following the links on the front page or cover of this
document.
SNOMED®, SNOMED CT® and IHTSDO® are registered trademarks of International Health Terminology Standards Development Organisation.
SNOMED CT® licensing information is available at http://snomed.org/licensing. For more information about SNOMED International and
SNOMED International Membership, please refer to http://www.snomed.org or contact us at info@snomed.org.
1. Introduction
Summary
This practical guide outlines key requirements for enabling effective access to SNOMED CT and illustrates some of
the options for meeting these requirements using a freely available SQL database. The rationale for using SQL as an
illustrative example is that this is a widely understood way to access structured data that can be readily applied to
SNOMED CT release files.
The approaches and options documented in the guide provide working examples of some essential SNOMED CT
terminology services. However, the primary purpose of these examples is to enhance understanding and not to
recommend SQL as a way to deliver large scale versions of these services. A range of more advanced technologies,
including those used in SNOMED International Tools, are able to deliver more scalable implementations of the
required services.
ÿ SNOMED International also provides a range of tools that enable access to SNOMED CT content. These
include a SNOMED CT Browser through which to explore the terminology and a range of other open source
tools that enable programmatic access to terminology content. For further details see SNOMED
International Tools or visit the SNOMED International GitHub repository to access open source projects
supporting a range of terminology service requirements.
Background
SNOMED CT is made available to licensees as a package of tab-delimited text files. The format of these files is
specified in the Release File Specification (Sections 4 Component Release Files Specification and 5. Reference Set
Types). These release files provide a standard way to distribute SNOMED CT content and derivatives but they do not
offer a direct way to provide user-friendly access to the terminology.
This guide documents a worked SQL example that loads the SNOMED CT release files into a database designed to
enable practical access to terminology content. This worked example enables exploration of the types of
terminology required for effective delivery of terminology services.
Purpose
The primary purpose of this document is to enhance understanding of the logical design and release file structure
of SNOMED CT and to provide practical ways to access the key features of SNOMED CT in a widely understood
programming language. For more scalable and performant approaches to implementing SNOMED CT please visit
SNOMED International's Github repository - e.g. https://github.com/IHTSDO.
For more details on the purpose of the document see Section 2. Objectives, Audiences and Uses.
\ Limitations
1. The programming code that this guide contains and/or refers to is only made available to provide
illustrative examples of key points related to the design, accessibility and use of SNOMED CT.
2. It is licensed under the Apache 2 licence and is not certified to be suitable for use in a production
system.
3. The code has been developed to work in a freely available open source relational database (MySQL
- https://www.mysql.com) to make it accessible to all SNOMED CT licensees without imposing
additional costs.
The code may need modification to work in other database environments.
Other database environments may also support additional features which enable
alternative approaches not described in this guide.
4. The use of SQL in this example is intended to enhance understanding of the structure and does not
imply that SQL is recommended for use production systems that deliver terminology services.
Audiences
There are three distinct target audiences for this guide:
1. Designers and developers
The guide provides practical examples of the ways in which features in SNOMED CT can be accessed
using a widely understood technology;
It demonstrates services that designers and developers should consider including in their
terminology server developments;
It can also be used to inform terminology server requirements for system access to SNOMED CT.
2. People seeking practical ways to access SNOMED CT content and reference sets:
The demonstrator documented in this guide provides ways to access SNOMED CT content and
reference sets using simple SQL queries.
This type of access can complement the use of a SNOMED CT browser or other specific tools by
enabling customizable access to specific collections of terminology content.
3. Anyone interested in SNOMED CT who is seeking a practical example of accessing the terminology in ways
described in other specifications and guides:
Although many SNOMED CT tools deliver user-friendly services for well-established use cases, some
use cases require customized services that are not readily available from existing tools.
For example, the full version of the demonstration database allows queries to be written that report
the history of changes that impact a defined set of SNOMED CT components.
ÿ Although there are three distinct target audiences, this guide has primarily been written for those with a
technical background.
Each section of the guide includes an indication of its applicability to each of these audiences.
\ Important Note
The example database in its current form should be considered as a read-only resource. Although an SQL
databases enables addition, deletion and updating of data, the design of the example database is not
intended to be used for editing the release data in any way. The reasons for this limitation include the
conditions of the SNOMED CT license as well as lack of support for the formal processes required for
authoring, change management and component versioning. Those interested in tools that support editing
of SNOMED CT content and reference sets should refer to information on SNOMED International Software
and Tools.
Feature Description
Database tables Separate database tables are created for the full and snapshot release of each distinct component and reference set
created for data in all type. Consistent design principles are applied to these tables to match the data structure, data type and function
full and snapshot requirements.
release files
Import of all full The full release makes it possible to use SQL queries to access to the complete history of all SNOMED CT components
release files and reference sets from the first release of the terminology in January 2002 up to the most recent release.
Import of all snapshot The snapshot release provides rapid access to the current view of the terminology, without the need for queries to
release files explicitly exclude earlier versions.
Examples of As the example database imports the snapshot release files into separate tables, there is no requirement for a
computed current computed snapshot views. However, computed current snapshot views derived from some of the full release tables
snapshot views are included in the example database. These views provides practical illustrations of the way to derive a current
snapshot from the full release. They also allow comparisons of performance and output between SQL queries run on
the snapshot table and the same queries run on the computed snapshot view.
Configurable The example database includes two configurable snapshot views of every full release database table. This allows
retrospective SQL queries to be refer to and compare the current snapshot and snapshot and one or two earlier dates. A simple
snapshot views configuration procedure is included to allow the retrospective snapshot dates of each view to be changed.
Configurable delta The example database includes three configurable delta views of every full release database table. This allows SQL
views queries to be refer only to versions of a component added or changed between two specified dates. A simple
configuration procedure is included to allow the delta data ranges (start and end times) of each view to be changed.
Language The example database includes a simple configuration procedure to specify the preferred display language or
configuration of views dialect. This is dependent on the languages in the release files, so with the International Edition only the options en-
US and en-GB can be used. However, when used with National Editions that include translated descriptions and an
appropriate language reference set this feature can be readily configured to support those additional language
settings. The language configuration setting can be applied separately to different snapshot views allowing or can be
switched as part of an sequence of queries to enable multilingual query results.
Consistent access to The same configurable snapshot and delta views are available for all component types and reference set members
all components and and these views follow a consistent naming convention. This means individual components and reference sets can
reference set be queried in a consistent manner. It also provides a foundation for composite views that bring together data from
members the same snapshot view of different related tables. The features below illustrate the practical application of this
principle.
Language refset Built-in views allow concepts to be displayed using either their fully specified name or preferred synonym in a
dependent views of specified language or dialect. Other built-in language dependent descriptions views include:
descriptions and
concepts • All the active synonyms of each concept (including or excluding the preferred synonym).
• All active synonyms associated with active concepts (this view is particularly useful for
text searches).
Integrated views of The database also features built-in views that provide access to information about relationships between concepts.
relationships and These views include synonym and fully specified name variants for each of the following:
descriptions
• The id and term of all subtype children of specified concept.
• The id and term of all supertype parents of a specified concept.
• Defining relationships as the id and term of the source, type and destination concepts
followed by the relationship group number.
All references to id and term refer to a pair of columns in the output of the view. The id is the concept identifier,
depending on the view the term is either the fully specified name or the preferred synonym.
Full text term The database uses a full-text index to allow searches by words within a term independent of the order in which those
searches terms appear. Example queries demonstrate this search facility as well as a simple way to display the closest
matches first. Other more technical search approaches using complete, pattern and regular expression matching can
also be readily applied.
Rapid subtype testing The database import process includes a step that builds a transitive closure file and loads this into an indexed
using a transitive database table. This enables rapid testing of whether one concept is a subtype descendant or supertype ancestor of
closure table any other concept 2 .
Procedure This illustrates an approach to testing expression constraints. The current version of the procedure is limited to
demonstrating constraints including one focus concept with one or two attribute value constraints 2 .
selection of concepts
based on expression
constraints
Procedure This illustrates an approach to searching using full text search with the returned results limited to concepts that are
demonstrating term subtypes of a specified concept. For example, there are more than 600 synonyms that contains both "mitral" and
search limited to a "valve". However if this search is limited to subtypes of a concept (e.g. procedure, body structure, observable,
specified hierarchy physical object etc.) it returns substantially fewer matches 3 .
ÿ Note
This summary of the functionality the database should be interpreted in the scope and context of the its
intended use as a demonstrator and learning tool. It is possible that the database may have other practical
applications for some use cases, but it is not regarded as a robust or high performance solution suitable
for large scale use. Rather it is designed to confirm the feasibility implementing some of the feature of
SNOMED CT and to stimulate others to use and improve upon the ideas and approaches described in the
guide.
1 These storage requirements are for the International Edition Release for 2019-07-31. More storage may be
required by other Editions with substantial additional national or local extension content.
2 Only the current snapshot view of the transitive closure table is available. Therefore this feature is not available
for retrospective snapshots. [ a b ]
3 Only the current snapshot view of the transitive closure table is available. Therefore subtype testing is not
available when searching retrospective snapshots.
4. Database Design
This section discusses some of the points that should be considered when designing a relational database to
provide access to SNOMED CT. It explains the rationale for decisions taken while designing the SNOMED CT example
database. It also identifies some other options which, while not implemented in the example database, are worth
considering.
Section 4 Component Release Files Specification contains the authoritative documentation about the
structure of release files containing data that represents SNOMED CT components (concepts, descriptions and
relationships).
Section 5 Reference Set Release Files Specification contains the authoritative documentation about the
structure of release files that represent SNOMED CT reference sets.
Table 4.2-1: Release Type Import Options to Support Version Access Requirements
Potential Use Requirements for access Release Type Import Options Notes
Cases to SNOMED CT versions
Description
• A single set of tables is created for all the release files that need to be imported.
• Data is imported into these table from the current snapshot release.
• The database is optimized by appropriate additional indexes.
• Access to common combinations of data from multiple tables may be facilitated by creating database views,
procedures and functions.
Advantages
• Simple solution which performs well.
• Supports to access the current snapshot release and current delta view.
Disadvantages
• No access to previous snapshot views.
• Cannot access to the previous state of components in the current delta view.
Description
• Two sets of tables are created for all the release files that need to be imported.
• Data from the current snapshot release is imported into one of these sets of tables
• Data from the previous snapshot release is imported into the other set of tables.
• The database is optimized by appropriate additional indexes.
• Access to common combinations of data from multiple tables may be facilitated by creating a sets of
database views, procedures and functions applicable to each set of tables.
• Access to information about changes to data between the two snapshot release may be facilitated by
additional views, procedures and functions that combine or compare data from the two versions.
Advantages
• Simple duplication of the single snapshot view which performs well.
• Supports to access the current and previous snapshot releases and current and previous delta views.
• Supports access to previous state of components in the current delta view.
Disadvantages
• No access to snapshot views prior to the previous version.
• Heavy use of disk space as a result of duplication of rows that are identical in both snapshots. Each snapshot
takes more than 80% of the space required by the full release.
• Not extensible because this approach is not realistic for multiple versions due to a linear increase in
redundant use of disk space.
Description
• A single set of tables is created for all the release files that need to be imported.
• Data is imported into these table from the full release.
• The database is optimized by appropriate additional indexes.
• Access to data in specific versions is facilitated by virtual snapshot views that can be accessed in the same
way as database tables 3 .
• Access to common combinations of data from snapshot views of tables may be facilitated by creating
database views, procedures and functions.
• Access to information about changes to data between any two snapshot release may be facilitated by
additional views, procedures and functions that combine or compare data from those versions.
Advantages
• Access to the complete release history of all versions of a SNOMED CT Edition.
• Efficient use of disk space requiring only 20% more disk space than importing a single snapshot release.
• Able to access snapshot views for any date.
• Able to access delta views for any date range.
Disadvantages
• Virtual views performs less well than a native database tables because the content of a view is the result of
query on a database table.
Advantages
• Access to the complete release history of all versions of a SNOMED CT Edition.
• High performance access to the current snapshot view using the snapshot release table rather than a virtual
snapshot view.
This is a significant advantage as the current snapshot is the most commonly used view.
• Able to access snapshot views for any date.
• Able to access delta views for any date range.
Disadvantages
• Requires approximately 80% more disk space than only importing the full release.
However, unlike the use of multiple snapshot tables. this disk space increase with each new release is
determined by numbers of additions and changes rather and the only redundancy is a single version
snapshot.
| The example SNOMED CT database is an example of the "Import Full and Snapshot Release" option. It
includes a current snapshot table and a full release table for each of the release files. The current snapshot
is accessed directly through the snapshot tables, while all snapshot views for any date between 31 January
2002 and the current release date are accessed as dynamic views. It also provides access to delta views
showing changes between any two dates since the first release of SNOMED CT.
1 In theory, the first requirement for full details of changes could be met by a trimmed version of the previous
snapshot from which rows that are unchanged in the current snapshot have been removed. However, this would
complicate both the import process and the process or querying the data.
2 In theory, requirements for a limited set of previous version views could also be met by importing multiple
snapshot releases. However, importing a snapshot uses roughly 80% of the disk space. Performance advantages
may in some cases make this approach worthwhile for two versions but it is not a scalable approach.
3 For further information on snapshot views see 4.6. Enabling Versioned Views. [ a b ]
Table 4.3-1: Mapping from Release Files Data Types to MySQL Data Types
Release File Description DB Data Possible Notes
Data Type Type Alternatives
SCTID A SNOMED CT identifier, between 6 and 18 BIGINT VARCHAR(18) Performance tests comparing BIGINT (a 64-bit
digits long, as described in 6.2 SCTID Integer) and VARCHAR(18) show that BIGINT
Representation. CHAR(18) consistently performs better for almost all types
of required access to the SNOMED CT database. A
test set of queries took 66% of the time to
complete with some tasks completed in less than
half the time.
UUID A Universally Unique Identifier is a 128-bit CHAR(36) BINARY(16) Performance tests comparing CHAR(36) and
unsigned generated using a standard BINARY(16) indicated that CHAR(36) consistently
algorithm. CHAR(32) performs significantly better than BINARY in the
types of queries used in the SNOMED CT
• UUIDs are represented as database.
strings of hexadecimal
BINARY only uses 16 bytes compared with 36
characters split by - characters required for CHAR(36).
as points specified by the UUID
standard. CHAR(36) enables UUIDs to be read and rendered
without requiring additional processing to match
the standard string representation of UUIDs.
Integer A 32-bit signed integer. INT Some integer columns may use far fewer than 32-
bits (4 bytes) and in future some might require
more. However, currently no integer values used
in release files exceed the range of a 32-bit signed
integer (except SCTIDs which are treated
separately). Therefore, for consistency and
simplicity the INT options is applied to all integer
columns.
Boolean A Boolean value, represented as one of two TINYINT CHAR(1) TINYINT uses only a single byte and it thus the
possible integer values (1 = true, 0 = false). most economic way to store a 0 or 1 value.
Time A date and time format expressed as a text DATETIME TIMESTAMP DATETIME allows date (and or time) storage in
string in line the basic representation most compact form (5 bytes in MySQL 8.x).
specified in the ISO 8601 standard. VARCHAR(14) Comparison, differences, and flexible output
(i.e. YYYYMMDD or YYYYMMDDTHHMMSSZ) formatting are also supported.
CHAR(8)
TIMESTAMP also supports date and time, only
using 4-bytes. However, this does not permit
dates after 2038 and the extra byte in DATETIME
completely removes the limitation.
ÿ If you are applying this guide to a different SQL implementation, you may need to modify some or all of
these data type mappings based on assessment of the performance and storage characteristics of the
available data types 1 .
1 The process for determining the data types used in the example database was as follows:
1. Identify the range of data types capable of representing all possible values based on the characteristics of
the general data types defined in the SNOMED CT specifications.
2. For the SNOMED CT data types used in primary keys (SCTID, UUID and Time), assess candidate datatypes
based on the performance of views and queries that use these keys for retrieval and database joins.
3. For the string data type, consider different options for columns of different lengths and where relevant
indexing requirements differ.
4. Where the above factors do not distinguish between options, choose the data type that uses the least
storage space.
[ab]
Table 4.4-2: Relevance of File Name Pattern Elements to Database Table Names
ÿ Note
The rules shown here are those applied to the example SNOMED CT database. Alternative table naming
patterns may be preferred by those developing their own SNOMED CT database. However, is important is
to ensure that the table naming pattern should be consistently applicable to all release files. Furthermore,
it also should be readily applicable to any additional reference set types that may be added to future
releases of the International Edition (or included in other SNOMED CT editions and or extensions).
Table 4.4-3: Rules Applied to Release File Names to Generate Table Name for the Example
Database
(full or snap)
Table 4.4-4: Results of Mapping Release File Names to Example Database Table Names
sct2_StatedRelationship_Full_INT_20190731.txt
sct2_TextDefinition_Full-en_INT_20190731.txt
sct2_Concept_Snapshot_INT_20190731.txt
sct2_Description_Snapshot-en_INT_20190731.txt
... list continues for all Snapshot release files ... list continues for all the snap_
tables
1 A few files in an extension may conform to a reference set that has been defined by the organization responsible
for that extension.
2 Pattern elements in square brackets [ ] are optional depending on file type.
Column Names
The column names used in the release files are the formally specified names and these should be used as the
column names in the relevant database tables.
Primary Keys
All database tables representing SNOMED CT release data should use a primary key that combines id and
effectiveTime.
• This combined primary key is:
Essential for full release tables as id alone is not unique.
Recommended for tables representing data from a snapshot release for overall consistency 3 .
Additional Indexes
Additional indexes are required to support rapid access to interrelated data (for example the descriptions and
Database Table Index Name Index Columns Rationale for this Index
(full or snap)_description description_con conceptId Find descriptions for concept.
cept
description_lang conceptId,languag Find descriptions with specific language code for concept.
eCode
description_ter term (fulltext) 5 Search for terms.
m
(full or snap)_relationship relationship_des destinationId,typeI Find concepts with relationships of a specified type of which a
t d,sourceId specified concept is the destinationId (value or supertype) or find
relationships with a specific combination of destination, type and
source.
relationship_sou sourceId,typeId,de Find concepts with relationships of a specified type of which a
rce stinationId specified concept is the destinationId (defined concept or subtype)
or find relationships with a specific combination of source, type and
destination.
(full or snap)_statedRelations statedRelationsh destinationId,typeI Find concepts with stated relationships of a specified type of which a
hip ip_dest d,sourceId specified concept is the destinationId (value or supertype) or find
relationships with a specific combination of destination, type and
source.
statedRelationsh sourceId,typeId,de Find concepts with relationships of a specified type of which a
ip_source stinationId specified concept is the destinationId (defined concept or subtype)
or find relationships with a specific combination of source, type and
destination.
(full or snap)_textDefinition textDefinition_co conceptId Find text definitions for concept.
ncept
textDefinition_la conceptId,languag Find text definitions with specific language code for concept.
ng eCode
textDefinition_te term (fulltext) Search for terms in text definitions.
rm
(full or snap)_refset_ [REFSETTYPE]_c referencedCompon Find rows in any reference set of type [REFSETTYPE] that refer to a
[REFSETTYPE] entId specified referenced component.
[REFSETTYPE]_rc refsetId,referenced Find rows in an identified reference set of type [REFSETTYPE] that
These indexes are applied to all
ComponentId refer to a specified referenced component.
refset tables
(full or snap)_refset_Extended ExtendedMap_m refsetId,mapTarget Find map records in a specified mapping reference set for a
Map ap particular mapTarget. Find all concepts that have a map to a
particular mapTarget in a specified mapping reference set.
(full or snap)_refset_SimpleM SimpleMap_map refsetId,mapTarget Find map records in a specified mapping reference set for a
ap particular mapTarget. Find all concepts that have a map to a
particular mapTarget in a specified mapping reference set.
(full or snap)_refset_MRCMAtt MRCMAttributeD domainId Find attribute domain information for a specified domain.
ributeDomain omain_dom
1 SNOMED CT data types are defined in section 3.1.2 Release File Data Types of the SNOMED CT Release File
Specifications.
2 See recommendation on the approach to data type mapping in section 4.3. Data Type Options.
3 A primary key consisting only of the id is a potential alternative for tables representing data from a snapshot
release.
4 To avoid slowing the data import process additional indexes are not added to the database tables until after all
text files have been imported.
5 Full text indexes for terms allow effective searching. However, unless the database is correctly configured, short
words, abbreviations and stop words may prevent effective indexing of common clinical terms. For further
details refer to A.7.1 Required MySQL Configuration Settings.
Table 4.6-1: Summary of Versioned Views of SNOMED CT Components and Reference Set
Members
Most The latest version of each SNOMED CT component and • Identification of changes to SNOMED CT Valuable as
Recent reference set member added, changed or inactivated in an indicator
arising from the most recent release.
Delta the most recent release. Typically, all these items with of recent
View have an effectiveTime equal to the most recent release changes
date. However, in cases where interim releases are
made available between releases, the most recent delta
view may be specified as including all items with an
effectiveTime after the previous major release date.
Other The versions of each SNOMED CT component and • Identification of changes to SNOMED CT Useful for
Delta reference set member added, changed or inactivated longer term
over a period of time.
Views after a specified delta start time and at or before a monitoring
specified delta end time. of changes.
Delta The content of a specified delta view combined with the • Reviewing full details of changes to Required for
Views retrospective snapshot view of SNOMED CT effective
SNOMED CT between two releases or over
with components and reference set members in the delta change
Details view at the specified delta start time. a period of time. managemen
of • Assessing and managing the impact of t
Changes updates to SNOMED CT.
Table 4.6-2 summarizes the way in which different release type options affect the ability to access particular
snapshot and delta views of SNOMED CT data. Importing the snapshot release supports direct access to the current
snapshot view and query access to the most recent delta view. The full release provides access to all snapshot and
delta views but is likely to perform slightly less well with the current snapshot view. Importing both full and current
snapshot releases offers all the advantages of importing the full release and also provides direct access to the
current snapshot view. This combined option requires more storage capacity but may be worthwhile because the
current snapshot is likely to be the most commonly used view.
Table 4.6-2: Summary of Versioned View Access Capabilities Depending on Release Types
Imported
General Snapshot Query - Replace full_tableName with Name of a Full Release Table
\ For example, in the following query the check for the active status is included in the nested query. This will
lead to the most recent active version of each component being selected. The result of this query will
therefore include an earlier active version of any component that is now inactive. A similar issue may also
occur with other criteria 1 .
General Snapshot Query - With Error Due to Added Condition in Nested Query
The query below corrects the error in the shown above. This query will return components that are active
in the current snapshot view. It will not return any components that are inactive in the current snapshot.
the nested query because the objective is to constrain the maximum effectiveTime to that the subquery returns.
This ensures that the outer query does not return component versions added after the specified snapshot time.
Most Recent Delta View Query for 2019-07-31 release. Replace tableName with Name of a Full or
Snapshot Release Table for 2019-07-31 Release
General Most Recent Delta View Query - for Change After 2019-01-31 and On or Before 2019-07-31
ÿ Note
This query requires the effectiveTime to be greater than the startDate and less than or equal to the
endDate. This avoids double counting items in two consecutive periods. This means that ranges can be
specified to start on one release date and end on another release date without counting changes that
occured on the first release date.
1 For more details about potential snapshot view query errors see C.3. Common Mistakes with Snapshot
Generation.
2 This interpretation of "the most recent delta" depends on the practice of periodic releases with all rows added
since the last release assigned the effectiveTime of the release. However, in cases where frequent interim
releases are made, it may be more accurate to consider the "the most recent delta" to consist of all rows with an
effectiveTime greater than the previous release date and less than or equal to the current release date. In this
case, all delta view queries would to follow the form of the Specified Date Range Delta View Query with a start and
end date.
Creating a Retrospective Snapshot View for 2019-01-31 from the Full Concept Table
Having created those two views it is then possible to write queries like the examples below to display data from
these snapshot views.
Creating a Retrospective Snapshot View for 2019-01-31 from the Full Concept Table
Comparing the results of these two queries shows that in January 2019 both concepts changed in the 2019-07-31
release. The concept with id 3859001 was made inactive and the definitionStatusId of concept with id 3704008 was
changed from 900000000000074008 (primitive) to 900000000000073002 (defined).
Table 4.6.3-1: Testing Performance of Queries on Snapshot Tables and Snapshot Views
Based on these findings the most effective way to optimize access to a snapshot view, is to replace the use of
database views with snapshot tables. Representing the a snapshot with tables, rather than using a database view,
adds roughly 2.6 Gb to the storage requirements for the example database.
The current snapshot view is essential and is used for most interactions with the database. Therefore, the
performance enhancements justify use of the additional disk space required to store the current snapshot in
separate tables. If there are specific reasons for extensive access to one or two retrospective snapshots, it might
also be worthwhile representing those snapshots in separate tables. However, it would not be worthwhile to apply
the same approach to the full range of less frequently used retrospective snapshots. Therefore, if the snapshot
views defined in 4.6.2 do not perform sufficiently well, it is worth considering ways to optimize snapshot access.
Unlike the views described earlier, the optimization methods described below require additional columns to be
added to each of the full release tables. After importing release files, the tables are processed to generate values for
the additional columns and this data is used to simplify the snapshot view queries by avoiding the need for nested
queries.
Overview
A column is added to each full release table. This column is used to represent flags that indicate which snapshot
view each row is included in.
Practical Example
1. A single 64-bit integer column called flag is added to all full release tables with a default value of 0 (zero).
2. A distinct number which is a power of 2 between 20 and 263 is assigned to each required retrospective
snapshot time.
3. The flag column in each row is set to the sum of the values of all the snapshots in which that row appears.
To be precise this means that a specific bit in the flag value is set if the row is part of a particular
snapshot and is not set if it is not part of that snapshot.
4. Once this process is complete, it is possible to select the rows of a retrospective snapshot with a simple
query that tests the relevant bit in the flag column value.
This avoids the need for the nested query required to identify rows that are part of a snapshot.
The example SQL below illustrates the process of flag setting. In practice, while this query works it is not very
efficient for several reasons. A more efficient approach would be to use a stored procedure that computes the full
set of flags applicable to each row. This approach would allow the flag column in each row to be updated once
rather than requiring a separate update for each snapshot view.
A configurable snapshot view can then be created tests the appropriate bit rather than requiring a nested query.
SET SQL_SAFE_UPDATES=0;
update full_tableName tbl
set flag=flag | 1
where tbl.effectiveTime=(select max(sub.effectiveTime) from copy_full_tableName sub
where sub.id=tbl.id and sub.effectiveTime<='20190731');
update full_tableName tbl
set flag=flag | 2
where tbl.effectiveTime=(select max(sub.effectiveTime) from copy_full_tableName sub
where sub.id=tbl.id and sub.effectiveTime<='20190131');
update full_tableName tbl
set flag=flag | 4
where tbl.effectiveTime=(select max(sub.effectiveTime) from copy_full_tableName sub
where sub.id=tbl.id and sub.effectiveTime<='20180731');
update full_tableName tbl
set flag=flag | 8
where tbl.effectiveTime=(select max(sub.effectiveTime) from copy_full_tableName sub
where sub.id=tbl.id and sub.effectiveTime<='20180131');
SET SQL_SAFE_UPDATES=1;
Once the flags are set, a query such as the one below can be used to return component versions that are part of a
particular snapshot view. The example query returns row in which the flag the second bit (value 2) is set. Based
on the settings in the query above this means it would include rows that are part of the 2019-01-31 snapshot view of
this table
Performance
Limited testing of this optimization approach indicates that it is between 2 and 3 times faster than the unoptimized
snapshot views. Direct access to a snapshot table is still twice as fast as this optimized approach.
Storage Requirements
The full release files in the 2019-07-31 release contain a total of approximately 16 million rows. If flags are added
each of these rows will require a further 8 bytes of storage. No additional indexes are required to support this
optimization. As a result the overall increase in storage requirements to support this optimization is less than 150
Mb.
As described here the approach is limited to 64 snapshot times. This is probably more than sufficient for most
practical requirements. However, it and could be extended by adding an another flag column or by changing the
data type of the flag column to binary.
Disadvantages
• The process of setting the flags required for this approach adds significantly to the time taken to build the
database.
• Adding an additional column to every table means that queries using "SELECT * FROM ... " will return a flag
column that is not part of the original SNOMED CT data.
• The flag values are technically essential to the process but this may not be apparent to anyone exploring the
database.
• Significantly slower than direct access to snapshot tables. Optimum current snapshot performance still
requires the snapshot table.
Advantages
• A significant improvement in retrospective snapshot performance compared with unoptimized tables.
• Minimal impact on disk capacity (adds less that 5% to the size of the full release tables).
• Provides a fallback option for the current snapshot view if storage capacity is limited.
Overview
An additional datetime column is added to each row. This column is used to represent the time at when a row was
replaced by the next version of that component or reference set member.
Practical Example
1. A single datetime column called supersededTime is added to all full release tables with a default value of a
long distant future date (e.g. 9999-12-31).
2. Each full table is queried to establish the sequence of versions of each component or reference set member
in effectiveTime order.
3. The supersededTime of a component that have been updated is set to the effectiveTime of the immediately
following version of that component
4. Once this process is complete each component is part of all snapshot views with a snapshot time greater
than or equal to its effectiveTime and less than its supersededTime.
This can be tested without the need for a nested query.
The example SQL below illustrates the process of flag setting. In practice, while this query works it is not very
efficient for several reasons. A more efficient approach would be to use a stored procedure that computes the full
set of flags applicable to each row. This approach would allow the flag column in each row to be updated once
rather than requiring a separate update for each snapshot view.
-- Compute the supersededTime values for each combination of id+effectiveTime and add
these to the temporary file
INSERT INTO tmp SELECT tbl.id, tbl.effectiveTime, (SELECT IFNULL(MIN(sub.effectiveTim
e),DATE "99991231") FROM full_tableName sub
WHERE tbl.id=sub.id AND tbl.effectiveTime<sub.effectiveTime) supersededTime FROM
full_tableName tbl;
-- Apply the appropriate supersededTime values to each row in the full table
UPDATE full_tableName tbl
JOIN tmp
SET tbl.supersededTime=tmp.supersededTime
WHERE tmp.id=tbl.id AND tmp.effectiveTime=tbl.effectiveTime;
Once the superseded time values are set, a query such as the one below can be used to return component versions
that are part of a particular snapshot view. The example query returns row in which the flag the second bit (value 2)
is set. Based on the settings in the query above this means it would include rows that are part of the 2019-01-31
snapshot view of this table
Performance
Past experience indicates that this approach is 2 times faster than the unoptimized snapshot views 2 . However, this
figure varies depending on the complexity of the queries it is used in. Direct access to a snapshot table is between 2
and 3 times as fast as this optimized approach.
Storage Requirements
The full release files in the 2019-07-31 release contain a total of approximately 16 million rows. If a datetime column
is added, each of these rows will require a further 5 bytes of storage. Database designs using this additional column
also included additional indexes including supersededTime 3 . As a result, the storage to fully support this approach
required an additional 750 Mb.
Disadvantages
• The process of setting the supersededTime required for this approach adds significantly to the time taken to
build the database.
• Adding an additional column to every table means that queries using "SELECT * FROM ... " will return the
supersededTime column that is not part of the original SNOMED CT data.
• The supersededTime values are technically essential to the process but this may not be apparent to anyone
exploring the database.
• The use of supersededTime together with associated indexes increases the storage capacity required for the
full release tables by approximately 20%.
• Significantly slower than direct access to snapshot tables and since the introduction of MySQL 8.0 are also
slower than the snapshot flagging method.
Advantages
• An improvement in retrospective snapshot performance compared with unoptimized tables but is out-
performed by the snapshot flagging method.
• A fallback option for the current snapshot view if storage capacity is limited but requires more storage than
the snapshot flagging method.
• Supports an unlimited number of snapshot times.
1 These views are defined using the general form described in 4.6.2.
2 Previous tests in MySQL 5.7 were 3 times faster than unoptimized snapshot views. However, MySQL 8.0 seems to
have enhanced the performance of the unoptimized queries without significantly improving the results of this
approach to optimization.
3 The performance impact of removing some of these indexes was not tested, so it is unclear if benefits could still
be delivered by this approach without these indexes.
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.
1 Concepts in Set-C that also have subtypes in Set-C are primitive supertypes of concept A but they are not
proximal primitive supertypes because these subtype(s) are more specific concepts that are also primitive
supertypes of concept A.
| Example
Apart from the concept identifier, the concept table contains no useful human-readable data about a
concept. Therefore, simply selecting data from a snapshot view of the concept table is unlikely to be
useful.
To display appropriate human-readable information about a concept information is required from two
other tables:
• The human-readable information about a concept is in the description table or view (e.g.
snap_description)
• Information about which descriptions are preferred or acceptable in given language data is in a
language refset table or view (e.g. snap_refset_language).
To display human-readable information about the way a concept is defined data is required from three
other tables:
• The defining relationships are in the relationships table or view (e.g. snap_relationship)
• Human-readable display of the type and value specified in the relationship requires data from the
description table or view (e.g. snap_description)
• Information about which descriptions are preferred or acceptable in given language data is in a
language refset table or view (e.g. snap_refset_language).
The following subsections describe some general characteristics of composite views and introduce some of the
composite views included in the SNOMED CT example database.
Table 4.8.1-1: Source Views for Data in Composite Views of Different Snapshots
Table 4.8.1-2: Composite View Including Data from Another Composite View
Composite views designed to support review of changes may gather data from different views as illustrated in
Table 4.8.1-3.
Table 4.8.1-3: Source Views for Data in Historical Composite Views of Different Delta Views
| Example
Most English language descriptions are either preferred or acceptable in both US and GB english.
Therefore instantiating tables that represent the sets of preferred and acceptable terms in either or both
dialects would not only duplicate much of the data in that table but would require even more space to
duplicate the relevant indexes. In addition to the impact of disk space, data duplicated in these composite
tables would need updating to take account of new releases.
1 As noted in 4.6.3. Optimizing Versioned Table Views the current snapshot may be represented as tables or
database views. While this may make a difference to performance it does not make any difference to the design
of composite views.
2 In the SNOMED CT example database, most composite views have been created for the current snapshot (snap)
and for both of the configurable retrospective snapshot views (snap1 and snap2). However, composite views
that access either the transitive closure (snap_transclose) or proximal primitives (snap_proxprim) are not
supported for the retrospective snapshots. This is because those tables are at present on available for the
current snapshot view.
3 The views snap_fsn, snap1_fsn and snap2_fsn are composite views similar to snap_pref but return the fully
specified name rather than the preferred term.
snap_pref This view selects the preferred synonym of a concept (identified = = 900000000000548007
by conceptId) 90000000000001
3009
SQL Query
Result
conceptId FSN id term
95570007 FSN 839752010 Kidney stone (disorder)
Table 4.8.2-2: Composite Description Views that Facilitate Searching for Concepts
snap_ This view includes active preferred and acceptable synonyms of active concepts. It excludes =
syn_search_active fully specified names and also excludes all descriptions associated with concepts that are 900000000000013009
inactive in the specified snapshot.
snap_ This view includes active preferred and acceptable synonyms of active concepts. IN
term_search_active (900000000000003001
,
900000000000013009)
4
Usage Example
SQL Query
Result
conceptId matching term FSN
54329005 Acute anterior myocardial infarction Acute myocardial infarction of anterior wall (disorder)
54329005 Acute myocardial infarction of anterior wall Acute myocardial infarction of anterior wall (disorder)
703164000 Acute anterior ST segment elevation myocardial Acute ST segment elevation myocardial infarction of
infarction anterior wall (disorder)
703164000 Acute STEMI (ST elevation myocardial infarction) of Acute ST segment elevation myocardial infarction of
anterior wall anterior wall (disorder)
703164000 Acute ST segment elevation myocardial infarction of Acute ST segment elevation myocardial infarction of
anterior wall anterior wall (disorder)
703252002 Acute myocardial infarction of anterior wall involving Acute myocardial infarction of anterior wall involving
right ventricle right ventricle (disorder)
703252002 Acute myocardial infarction of anterior wall with Acute myocardial infarction of anterior wall involving
right ventricular involvement right ventricle (disorder)
703165004 Acute ST segment elevation myocardial infarction of Acute ST segment elevation myocardial infarction of
anterior wall involving right ventricle anterior wall involving right ventricle (disorder)
703165004 Acute anterior ST segment elevation myocardial Acute ST segment elevation myocardial infarction of
infarction with right ventricular involvement anterior wall involving right ventricle (disorder)
703165004 Acute STEMI (ST elevation myocardial infarction) of Acute ST segment elevation myocardial infarction of
anterior wall with right ventricular involvement anterior wall involving right ventricle (disorder)
285981000119103 Acute ST segment elevation myocardial infarction Acute ST segment elevation myocardial infarction
involving left anterior descending coronary artery involving left anterior descending coronary artery
(disorder)
snap_rel_child_pref Selects the id and preferred synonym of each subtype child of a concept specified by conceptId. pref
Template 4.8.3-1: SQL Templates for Composite Views of Supertype Parents and Subtype
Children
SQL Query
Result
Concept id term
Concept 602500 Laparoscopic appendectomy
7
Table 4.8.3-2: Transitive Closure Views of Supertype Ancestors and Subtype Descendants
snap_ Selects the id and fully specified name of each supertype ancestor of a concept specified by conceptId. fsn
tc_an
cesto
r_fsn
snap_ Selects the id and preferred synonym of each supertype ancestor of a concept specified by conceptId. pref
tc_an
cesto
r_pre
f
snap_ Selects the id and fully specified name of each subtype descendant of a concept specified by conceptId. fsn
tc_de
scend
ant_f
sn
snap_ Selects the id and preferred synonym of each subtype descendant of a concept specified by conceptId. pref
tc_de
scend
ant_p
ref
Template 4.8.3-2: SQL Templates for Composite Views of Supertype Ancestors and Subtype
Descendants
SQL Query
Result
Concept conceptId term
Concept 16001004 Otalgia
Ancestor 22253000 Pain
Ancestor 102957003 Neurological finding
Ancestor 106147001 Sensory nervous system finding
Ancestor 118234003 Finding by site
Ancestor 118236001 Ear and auditory finding
Ancestor 118254002 Finding of head and neck region
Ancestor 138875005 SNOMED CT Concept
Ancestor 247234006 Ear finding
Ancestor 276435006 Pain / sensation finding
Ancestor 279001004 Pain finding at anatomical site
Ancestor 297268004 Ear, nose and throat finding
Ancestor 301354004 Pain of ear structure
Ancestor 301857004 Finding of body region
Ancestor 404684003 Clinical finding
Ancestor 406122000 Head finding
Ancestor 699697007 Finding of sensation by site
Descendant 12336008 Referred otalgia
Descendant 74123003 Otogenic otalgia
Descendant 162356005 Earache symptoms
Descendant 162359003 Bilateral earache
Descendant 430879002 Posterior auricular pain
Descendant 1084561000119106 Bilateral referred otalgia of ears
Descendant 1089561000119107 Referred otalgia of left ear
Descendant 1092171000119100 Referred otalgia of right ear
Table 4.8.3-3: Views of Proximal Primitive Supertype Ancestors and Concepts with a Specific
Proximal Primitive Ancestor
snap_pp_parent_pref Selects the id and preferred synonym of each proximal primitive parent of a concept specified pref
by conceptId.
snap_pp_child_fsn Selects the id and fully specified name of each concept with a proximal primitive parent fsn
specified by conceptId.
snap_pp_child_pref Selects the id and preferred synonym of each concept with a proximal primitive parent pref
specified by conceptId.
SQL Query
--
Select "Concept", conceptid, term from snap_pref where conceptId=21522001
UNION
Select "Proximal Primitive Parent", id, term from snap_pp_parent_pref where
conceptId=21522001;
Result
Concept conceptI term
d
Concept 21522001 Abdominal pain
Proximal Primitive 22253000 Pain
Parent
Result
Concept conce term
ptId
Concept 22253 Pain
000
Concept with PP-Parent: 21522001 | 44480 Allergic headache
Pain| 06
Concept with PP-Parent: 21522001 | 45680 Retrosternal pain
Pain| 03
Concept with PP-Parent: 21522001 | 65610 Pain in urethra
Pain| 07
Concept with PP-Parent: 21522001 | 10601 Pain in lower limb
Pain| 006
Concept with PP-Parent: 21522001 | 12584 Bone pain
Pain| 003
Concept with PP-Parent: 21522001 | 15803 Bladder pain
Pain| 009
Concept with PP-Parent: 21522001 | 16513 Postcordotomy pain
Pain| 000
Concept with PP-Parent: 21522001 | 18876 Pain in finger
Pain| 004
Concept with PP-Parent: 21522001 | 20793 Scapulalgia
Pain| 008
Concept with PP-Parent: 21522001 | 21522 Abdominal pain
Pain| 001
Concept with PP-Parent: 21522001 | 21545 Tenalgia
Pain| 007
Concept with PP-Parent: 21522001 | 29857 Chest pain
Pain| 009
Concept with PP-Parent: 21522001 | 30473 Pain in pelvis
Pain| 006
Concept with PP-Parent: 21522001 | 30989 Knee pain
Pain| 003
1 The terms are displayed by using the Composite Description Views described in the previous section.
2 The prefix snap is replaced by snap1 or snap2 for retrospective views.
3 Transitive closure and proximal primitive views are only available for the current snapshot. [ a b ]
snap_rel_def_pref This view includes all active, inferred relationships of a concept specified by sourceId 3 . It selects the id pref
and fully specified name for each of the concept identifiers (sourceId, typeId and destinationId) and the
relationshipGroup number.
SQL Query
Result
sourceI sourceTerm typeId typeTerm destinatio destinationTerm relationshi
d nId pGroup
602500 Laparoscopic appendectomy 1166800 Is a 51316009 Laparoscopic procedure 0
7 03
602500 Laparoscopic appendectomy 1166800 Is a 80146002 Appendectomy 0
7 03
602500 Laparoscopic appendectomy 1166800 Is a 264274002 Endoscopic operation 0
7 03
602500 Laparoscopic appendectomy 1166800 Is a 440588003 Endoscopic procedure on appendix 0
7 03
602500 Laparoscopic appendectomy 2606860 Method 129304002 Excision - action 1
7 04
602500 Laparoscopic appendectomy 4058130 Procedure site - 66754008 Appendix structure 1
7 07 Direct
602500 Laparoscopic appendectomy 4253910 Using access 86174004 Laparoscope 1
7 05 device
1 The terms are displayed by using the Composite Description Views described in an earlier section of this guide.
2 The prefix snap is replaced by snap1 or snap2 for retrospective views.
3 The selection criteria for any of these relationship views can also be specified by destinationId, typeId or by a
combination of these identifiers. However, to see all the defining relationships of a specified concept, the
sourceId should be used as this refers to the concept defined by the relationships. [ a b ]
Table 4.8.5-1: Composite Views of Inactive Concepts with Related Concept Inactivation and
Historical Association Refset Data
Name 1 Description
delta_inactive_conce This view selects details of concepts that are inactive in the chosen delta or snapshot view. In addition to the concept
pts id the fully specified name of the inactive concept is selected. The output of this view also includes the reason for
activation and any historical associations between this inactive concept and an active concept. The reason for
inactivation is shown as the preferred synonym for the concept representing the reason for inactivation in the concept
inactivation reference set. The historical association is represented by the preferred synonym of the association
reference set(s) and the fully specified name of the associated target concept. Where a concept has multiple active
associations each of these reported as a separate row (the inactive concept and inactivation reason data is duplicated
on each of these rows).
Example 4.8.5-1: Selecting Inactive Concepts with Related Concepts Inactivation and
Historical Association Refset Data
SQL Query
3734 201907 0 90000000000 Split thickness skin graft Ambiguou POSSIBLY 3758568 Split thickness graft of skin to skin
003 31 0074008 (procedure) s EQUIVALE 011 (procedure)
NT TO
4101 201907 0 90000000000 Revision of spinal Ambiguou POSSIBLY 6189420 Revision of spinal subarachnoid shunt
004 31 0074008 pleurothecal shunt s EQUIVALE 15 (procedure)
(procedure) NT TO
4101 201907 0 90000000000 Revision of spinal Ambiguou POSSIBLY 6186810 Revision of subdural-pleural shunt
004 31 0074008 pleurothecal shunt s EQUIVALE 17 (procedure)
(procedure) NT TO
4131 201907 0 90000000000 Implantation into pelvic Ambiguou POSSIBLY 2968044 Procedure on pelvic region of trunk
005 31 0074008 region (procedure) s EQUIVALE 014 (procedure)
NT TO
4131 201907 0 90000000000 Implantation into pelvic Ambiguou POSSIBLY 3756616 Implantation procedure (procedure)
005 31 0074008 region (procedure) s EQUIVALE 019
NT TO
4518 201907 0 90000000000 Buthenal (substance) Ambiguou POSSIBLY 7969840 Crotonaldehyde (substance)
006 31 0074008 s EQUIVALE 14
NT TO
4919 201907 0 90000000000 Congenital protrusion Duplicate SAME AS 6421120 Protrusion (morphologic abnormality)
007 31 0074008 (morphologic 18
abnormality)
5034 201907 0 90000000000 Graft to hair-bearing Duplicate SAME AS 3757739 Hair bearing graft of skin to skin
009 31 0074008 skin (procedure) 014 (procedure)
Inactive Descriptions
For each delta and snapshot view the SNOMED CT example database includes a view of inactive descriptions. The
characteristics of each of these views are shown in Table 4.8.5-2 and a general template for the SQL definitions of
these views is shown in Template 4.8.5-2.
Example 4.8.5-2 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.
Name 2 Description
delta_inactive_descr This view selects details of all descriptions that are inactive in the chosen delta or snapshot view. In addition to
iptions selecting the description data it also includes the active fully specified name of the related concept and the reason for
activation. The reason for inactivation is shown as the preferred synonym for the concept representing the reason for
inactivation in the description inactivation reference set.
Example 4.8.5-2: Selecting Inactive Descriptions with Related Description Inactivation Refset
Data
SQL Query
16101 201907 0 91560 Embryo stage 1 Structure of embryo at stage 1 1 Nonconformance to editorial policy
018 31 01 (body structure) component
16837 201907 0 96310 Rheumatoid spondylitis Ankylosing spondylitis (disorder) 1 Not semantically equivalent
014 31 08 component
17615 201907 0 10093 Anisakiasis due to Anisakis Anisakiasis caused by larva of 1 Erroneous
010 31 004 simplex Anisakis simplex (disorder)
20220 201907 0 11702 bis-(p-Chlorophenyl) Bis-(p-chlorophenyl) ethanol 1 Nonconformance to editorial policy
015 31 002 ethanol (substance) component
20469 201907 0 11860 Nannizzia Genus Arthroderma (organism) 1 Not semantically equivalent
015 31 003 component
Stored procedures and functions provide an another way to define reusable resources in a database. The key
difference between these database views, stored procedures and functions are summarized in Table 4.9.1-1 1 .
From a practical perspective these differences enable stored procedures to facilitate some types of access to a
SNOMED CT data that cannot be supported by using database views. The following subsections describe a few
examples of stored procedures that are included in the SNOMED CT example database.
Table 4.9.1-1: Features of Views, Stored Procedures and Functions (in MySQL)
1 The features of stored procedures and functions shown in the table are those that apply to MySQL. Some of
these features may differ in other database environments.
2 Access to features that make changes to data or database resources may be limited by database security
settings. [ a b c ]
The configuration settings are represented by a database table called config_settings and each of the procedures
described in this section either selects data from that table or updates data in the table. The details and default
settings of the config_settings table are shown in Table 4.9.2-1.
call showConfig();
Result 2
0 90000000000 US United States of America English language reference set (foundation 2019-07-31 2019-01-31 2019-07-3
0509007 English metadata concept) 1
1 90000000000 US United States of America English language reference set (foundation 2019-01-31 2018-07-31 2019-01-3
0509007 English metadata concept) 1
2 90000000000 US United States of America English language reference set (foundation 2018-07-31 2018-01-31 2018-07-3
0509007 English metadata concept) 1
Set Language
The setLanguage procedure sets the languageId and languageName for a configuration row specified by its
identifier value.
p_lang_code The date after which changes will be included in the VARC Any value that MySQL recognizes 'en-GB'
delta view. HAR(5 as a date or date-time.
)
Example Procedure Call
call setLanguage(1,'en-GB');
Result
If p_lang_code does not refer to a language code in the config_language file or if no valid refset or refset members are found the procedure
reports an error.
If the procedure succeeds, the language setting is changed but there is no output data. To check the result of the change, call showConfig()
after resetConfig.
p_snapshot The date for which the identified snapshot view will DATE Any value that MySQL recognizes '2017-07-31'
Time be computed. TIME as a date or date-time.
call setSnapshotTime(1,'2017-07-31');
Result
The snapshotTime setting is changed but there is no output data. To check the result of the change, call showConfig() after resetConfig.
p_deltaStartTim The date after which changes will be included in the DATE Any value that MySQL recognizes '2016-07-31'
e delta view. TIME as a date or date-time.
p_deltaEndTime The date on or before which changes with be DATE Any value that MySQL recognizes '2019-01-31'
included in the delta view. TIME as a date or date-time.
Example Procedure Call
call setDeltaRange(1,'2016-07-31','2017-07-31');
Result
The deltaStartTime and deltaEndTime settings are changed but there is no output data. To check the result of the change, call showConfig()
after resetConfig.
Reset Configuration
The resetConfig procedure resets all the configuration settings to the default values shown in Example 4.9.2-2.
\ The reset depends on the date times config_settings on the row with id=0 being unchanged. In particular,
if assumes the snapshotTime of that row as the releaseDate. The other procedures described in this
section do not change those values. However, if those values are changed by update queries the
resetConfig procedure will not correctly reset the snapshot and delta times.
call resetConfig();
Result
The reset is performed but there is no output data. To check the result of the reset, call showConfig() after resetConfig.
1 Internally all these configuration dates are stored as the time 23:59:59 on the stated date. This ensure all
changes on the end date are included in snapshot and delta views while all changes on the start date are
excluded from a delta view. [ a b c ]
2 The results shown here are those the initial default settings for the 2019-07-31 release.
3 The refsetName is selected by looking up the languageId in the snap_fsn view.
call snap_termsInLanguages(p_conceptids,p_langCodes);
call snap_ShowLanguages('80146002,49438003','en-GB,en-US');
Result
ÿ Note
This procedure is intended to demonstrate some of the search options available in MySQL and to illustrate
the value of restricting searches to subtypes of concepts that in particular hierarchies or sub-hierarchies.
Additional work would be required to make a more user-friendly interface to these search facility and this
is beyond the scope of the SNOMED CT example database.
If p_search does not include "+" or "-" symbols, the MySQL natural language search is used. It also
orders the returned results by 'relevance' and is intended to assist contextual searching through
literature. However, our testing indicate that the boolean mode is usually more effective for
SNOMED CT searches.
For more information about full text searches in MySQL please see Full-Text Search Functions in
the MySQL Reference Manual.
p_filte A filter that will be applied to selectively include concepts that are subtype descendants of a tex '<find'
r specified concept: t
'<proc'
• a simple focus concept subtype constraint.
Starting with a less than sign < followed either by either '<123037004'
a conceptId; or
'!lung'
a shortcut abbreviation for a commonly used concept. To
see the current set of shortcuts run the following query 'heart'
"SELECT * FROM config_shortcutPlus;"
A regular expression pattern to be used to filter terms returned by the search string
Result
conce term
ptId
75570 Viral pneumonia
004
27669 Congenital viral pneumonia
2000
75570 Viral pneumonia (disorder)
004
42150 Viral pneumonia associated with AIDS
8002
27669 Congenital viral pneumonia (disorder)
2000
42150 Viral pneumonia associated with acquired immunodeficiency syndrome
8002
The eclQuery lists the conceptId and preferred term for each concept that conforms to a specified SNOMED
CT expression constraint.
ÿ Notes
1. The expression constraints supported do not cover the full ECL specification but are restricted as
described below.
2. This procedure will only run in MySQL version 8.0 or later. It uses some function which are not
available in earlier versions (including the widely used MySQL version 5.7).
Result
conceptId term
10519008 Acute pulmonary oedema due to fumes AND/OR vapours
40541001 Acute pulmonary oedema
61233003 Silo-fillers' disease
233706004 Drug-induced acute pulmonary oedema
233709006 Toxic pulmonary oedema
233710001 Chemical-induced pulmonary oedema
233711002 Oxygen-induced pulmonary oedema
360371003 Acute cardiac pulmonary oedema
10674871000119105 Pulmonary oedema caused by chemical fumes
Symbol Name
< Descendant of The set of all subtypes of the given concept < 404684003 |Clinical finding|
<< Descendant or self of The set of all subtypes of the given concept << 73211009 |Diabetes mellitus|
plus the concept itself
> Ancestor of The set of all supertypes of the given concept > 40541001 |Acute pulmonary edema|
>> Ancestor or self of The set of all supertypes of the given concept >> 40541001 |Acute pulmonary edema|
plus the concept itself
<! Child of The set of all children of the given concept <! 195967001 |Asthma|
>! Parent of The set of all parents of the given concept >! 195967001 |Asthma|
^ Member of The set of referenced components in the given ^ 733990004 |Nursing activities reference
reference set set|
: Refinement Only those concepts whose defining < 404684003 |clinical finding|: 116676008 |
relationships match the given attribute value associated morphology| = *
pairs
AND Conjunction Only those concepts in both sets (< 19829001 |disorder of lung|) AND (<
301867009 |edema of trunk|)
OR Disjunction Any concept that belongs to either set (< 19829001 |disorder of lung|) OR (<
301867009 |edema of trunk|)
MINUS Exclusion Concepts in the first set that do not belong to (< 19829001 |disorder of lung|) MINUS (<
the second set 301867009 |edema of trunk|)
Both the constraints may be specified using any of the forms permitted for the focus concept
constraint (see 1)
• Attribute attribute-value-constraint pairs must be separated by a comma from any following attribute-
value-constraint pair
• NOTE: The procedure does not support:
Nested refinement constraints
Role grouping constraints
Cardinality constraints
DELIMITER ;
SELECT Now() `--`,"Create Database and Initialize" '--';
-- CREATE DATABASE
DROP DATABASE IF EXISTS `snomedct`;
CREATE DATABASE `snomedct` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `snomedct`;
-- INITIALIZE SETTINGS
SET GLOBAL net_write_timeout = 60;
SET GLOBAL net_read_timeout=120;
SET GLOBAL sql_mode ='';
SET SESSION sql_mode ='';
Notes
1. The symbol in the top right of each file specification summary table is a link to the full file specification.
2. The table names used on this page are prefixed with full_ as these are the tables into which the full SNOMED
CT release will be imported. The loader script also create identically structured tables with the prefix
snap_ and the latest snapshot view is loaded into those tables.
3. The SQL code on this page creates the primary keys for each table (id, effective time) but omits creation of
any other indexes. The loader script creates additional indexes after importing data into the table. This
enables faster importing of data from the text files as the additional indexes do not need to be updated
while importing.
4. The effectiveTime is set as a DATETIME data type. This supports a specific time in hours, minutes or seconds.
In practice, effectiveTime values are formally restricted to YYYYMMDD but we are aware of at least one
SNOMED CT extension that includes time units in the effectiveTime field or its release files. The effectiveTime
is set by default to a 2000-01-31, a date which predates any SNOMED CT effectiveTime value. In practice, the
effectiveTime will always be set by the imported data so the default has no material effect.
5. Tables are also created for the full_textDefinition table and its snapshot version. As these tables have the
same structure as the description tables, the data from the textDefinition release files could be imported
into those tables instead. The text definitions would still be distinguishable from the descriptions as they
have a different typeId.
id SCTID
effectiveTime Time
active Boolean
moduleId SCTID
definitionStatusId SCTID
id SCTID
effectiveTime Time
active Boolean
moduleId SCTID
conceptId SCTID
languageCode String
typeId SCTID
term String
caseSignificanceId SCTID
id SCTID
effectiveTime Time
active Boolean
moduleId SCTID
sourceId SCTID
destinationId SCTID
relationshipGroup Integer
typeId SCTID
characteristicTypeId SCTID
modifierId SCTID
Notes
1. The symbol in the top right of each file specification summary table is a link to the full file specification.
2. The table names used on this page are prefixed with full_ as these are the tables into which the full SNOMED
CT release will be imported. The loader script also create identically structured tables with the prefix
snap_ and the latest snapshot view is loaded into those tables.
3. The SQL code on this page creates the primary keys for each table (id, effective time) but omits creation of
any other indexes. The loader script creates additional indexes after importing data into the table. This
enables faster importing of data from the text files as the additional indexes do not need to be updated
while importing.
4. The SQL code used on this page does not include any additional optimizations for generating alternative
snapshot views. Optimizations discussed in this guide can be added to the tables if required. However, this
loader script creates and populates tables for both the full release and the current snapshot views.
Therefore, additional optimizations would only deliver performance benefits when querying retrospective
snapshot views. Even in this case the performance benefits for most types of query are often limited when
compared to the use of unoptimized dynamic views.
5. The effectiveTime is set as a DATETIME data type. This supports a specific time in hours, minutes or seconds.
In practice, effectiveTime values are formally restricted to YYYYMMDD but we are aware of at least one
SNOMED CT extension that includes time units in the effectiveTime field or its release files. The effectiveTime
is set by default to a 2000-01-31, a date which predates any SNOMED CT effectiveTime value. In previous
versions of the script defaults were set to 0000-00-00 but some SQL settings treat these as invalid dates. In
practice, the effectiveTime will always be set by the imported data so the default has no material effect.
id UUID
effectiveTime Time
active Boolean
moduleId SCTID
refsetId SCTID
referencedComponentId SCTID
id UUID
effectiveTime Time
active Boolean
moduleId SCTID
refsetId SCTID
referencedComponentId SCTID
acceptabilityId SCTID
id UUID
effectiveTime Time
active Boolean
moduleId SCTID
refsetId SCTID
referencedComponentId SCTID
mapGroup Integer
mapPriority Integer
mapRule String
mapAdvice String
mapTarget String
correlationId SCTID
mapCategoryId SCTID
id UUID
effectiveTime Time
active Boolean
moduleId SCTID
refsetId SCTID
referencedComponentId SCTID
sourceEffectiveTime Time
targetEffectiveTime Time
1 If you prefer, you can move the SnomedRfsMySql folder to a different location. If you do this then references to
"$HOME/SnomedRfsMySql" (or "C:\SnomedRfsMySql") in the following instructions should be replaced by
references to the path to the SnomedRfsMySql folder on your system.
File Modified
1 If you prefer, you can download the SNOMED CT release package to a different location. If you do this then you
will need to specify the full path to the release package when you run the SNOMED CT load process.
Users of other Unix based system such as Linux or Ubuntu may find some of the instructions in this section
applicable in their environment. However, the location of MySQL configuration files may differ and as a
result some aspects of the configuration process may need to be altered.
Users of Window systems should skip to A.4 Instructions for Windows Users.
ÿ Note
if MySQL was installed using a different installation package, some of the configuration steps
described in later sections may need to be modified.
Please refer to https://www.mysql.com/products/community/ for detailed information about
MySQL.
Type the command lines shown below into the terminal window.
cd "$HOME/SnomedRfsMySql"
Tip
If this command does reports an error, please try the following modified command, which may prompt for
your password to confirm the action:
sudo chmod u+x bash/*
| This script requires you to have administrator rights to access your computer and may prompt you to
enter your login password. If you do not have administrator rights to access your computer, you will need
to ask someone who does have those rights to run this part of the process.
sudo bash/snomed_config_mysql
| Info
The MySQL Server must be started (or stopped and restarted) to apply the required configuration settings.
cd "$HOME/SnomedRfsMySql"
bash/snomed_load_mysql
• create : Create a new database and load the data from the
specified version.
• update : Update the views and procedures in the
database without recreating the database or reloading the
the tables.
• extend : Extend the database by loading data from
another package to the existing database.
The suffix indicates the edition and version to which this applies:
Specify a name (must begin with the letter s Uses the database name provided.
followed by lowercase letters and/or digits)
• Using different names allows several SNOMED CT
databases to co-exist (e.g. for different Editions)
• Each SNOMED CT database will use about 5Gb of disk
space ... so using different names may fill your available
disk space!
• If the named database already exists, it will be dropped
(deleted) and recreated.
MySQL Leave blank to accept the default The default is root.
username
Enter your MySQL username The username chosen must be an account with administrator access rights
enabling database creation.
Users of Mac OS systems should refer A.3 Instructions for Mac OS Users.
Users of other Unix based system such as Linux or Ubuntu may also fine A.3 Instructions for Mac OS
Users usedful. However, the location of MySQL configuration files may differ and as a result some aspects
of the configuration process may need to be altered.
ÿ Note
if MySQL was installed using a different installation package, some of the configuration steps
described in later sections may need to be modified.
Please refer to https://www.mysql.com/products/community/ for detailed information about
MySQL.
ÿ Note
Although the installers are 32-bit software, they will install the 64-bit version of MySQL if you are using a
64-bit system.
• When both Server and Workbench are in the right-hand list, click the Next button.
Checking Requirements
At this point you may see a message indicating a requirement for a Visual C++ Redistributable package as shown
below.
If you see this message you should download and install the required package from https://www.microsoft.com/en-
us/download/details.aspx?id=48145 before proceeding.
• Further notes on this process are provided on Meeting Requirements for MySQL Installation (Windows).
• Select the Legacy Authentication Method unless you will be using the database for other purposes that
require greater security.
ÿ Note
The Configuration File setting must refer to: C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
• This is a file that will be modified in the to configure the server so that it will correctly load the
SNOMED CT release files.
\ Warning
Be sure to remember your root password this as you will need it for access to the database.
• Choose the x64 version if you have a 64-bit computer or the x86 if you have an older 32-bit computer.
• Continue an install the package.
• The return to the MySQL installation process.
cd C:\SnomedRfsMySql
• Type the following command to stop the MySQL server (if it is running).
sc stop MySQL80
• Type the following command to run the configuration process. This command runs a script that updates the
MySQL server configuration.
win\snomed_wconfig_mysql
sc start MySQL80
If you need to install Perl on another disk or network drive (click here) ...
If Perl is installed on a network or a secondary drive (i.e. not drive C), you need to specify that
location. To do this create (or edit) a plain text file called perlPath.cfg file in the
SnomedRfsMySql\win folder. This file must contain a single line of text specifying the full
path of the perl.exe file (for example the file might contain the text "D:
\AddedSoftware\Strawberry\perl\bin\perl.exe")
If the import script cannot find perl.exe at the location specified in the perlPath.cfg file, that
configuration file will be deleted and will need to be recreated with the correct full path to
perl.exe.
perl C:\SnomedRfsMySql\lib\test.pl
• If Strawberry Perl is correctly installed the result should the following message.
Tip
If the message above does not appear, check the following:
1. The command line above assumes that SnomedRfsMySql is installed in the C:\ root folder. If this is
not the case, repeat the test with the correct path to SnomedRdsMySql.
2. Ensure that you have closed all open command line windows. Then open a new command line
window and run the test command again.
3. If neither of the above steps corrects corrects the issue, it suggest a problem with the installation.
Consider uninstalling and reinstalling Strawberry Perl to correct the issue.
•
• Right-click on this item to show the drop down menu
cd "C:\SnomedRfsMySql"
win\snomed_wload_mysql
• create : Create a new database and load the data from the
specified version.
• update : Update the views and procedures in the database
without recreating the database or reloading the the tables.
• extend : Extend the database by loading data from another
package to the existing database.
The suffix indicates the edition and version to which this applies:
Enter your MySQL username The username chosen must be an account with administrator access rights
enabling database creation.
• Then search the list of services to identify the name of the MySQL service.
• In the Manage Server Connections dialog update the Window Service Name to match the service name
identified earlier.
In future when you open MySQL Workbench you will see the option to open the SNOMEDCT connection.
\ If you are using example queries as templates for your own queries alway copy the query first so that you
do not overwrite the original example query.
• If you accidentally overwrite an example query, you can download the SnomedRfsMySql.zip file
again and extract the example queries folder.
• In the schema privileges the newuser is given access to the snomedct database schema:
• Within the snomedct database the rights of this newuser are limited to the following actions.
Views
SQL database views are in effect virtual tables. They can be queried in the same way as a table but they do not store
data. The data that appears to be stored in a view is in fact defined by a stored query applied to the data stored in
one or more tables.
It is important to be aware of performance issues related to the use of database views. For example, views that refer
to other views can result in queries that take longer to process. Although, a detailed discussion on this topic is
outside the scope of this guide, please keep this in mind when using the views and composite views that were
created as part of this SNOMED CT example MySQL database.
The SNOMED CT import process creates two distinct types of views. Filtered views of a single table and composite
views that bring together related data from different tables.
del delta_[component-type] (e.g. The delta table views enable access to delta views between any two dates. Only rows in the table
ta delta_concept, delta_description) with an effectiveTime greater than the start time and less that end time will be included in these
delta_refset_[refset-type] (e.g. views.
delta_refset_Simple) When the database is imported the delta date ranges are set as follows:
del delta1_[component-type] (e.g.
ta1 delta1_concept, • delta views are set with a start date 6 months before the current release and
delta1_description) an end date matching the current release date (this matches the current
delta1_refset_[refset-type] (e.g. Delta release file content).
delta1_refset_Simple)
• delta1 views start 12 months before the current release with an end date 6
del delta2_[component-type] (e.g. months before the current release date.
ta2 delta2_concept,
• delta2 views start 18 months before the current release with an end date 12
delta2_description)
delta2_refset_[refset-type] (e.g. months before the current release date.
delta2_refset_Simple) Delta date ranges can be changed by calling the stored procedure setDeltaRange(viewNumber,
startDateTime, endDateTime).
For example, to set the delta view range to start on 31 July 2018 and end a year later
• CALL setDeltaRange(0,"20180731","20190731");
The delta1 and delta2 ranges can also be set in the same way
• CALL setDeltaRange(1,"20170731","20190731");
• CALL setDeltaRange(2,"20020131","20070731");
An additional table view (with the prefix snapasview) provides a current snapshot view derived from the Full
release. This is redundant in this database, because the import process imports the Snapshot release files as well as
the Full release files. However, a few snapasview examples are included to provide examples of a views that could
be used to avoid the need to import the Snapshot tables.
Composite Views
The table below summarizes the composite views supported by the database. Many of these composite views
have variants that access specific snapshot views. These variants are indicated by the view prefixes snap, snap1
and snap2. Note that the snap variants use the snap tables, while snap1 and snap2 variants use the relevant
snapshot table views. Composite views that require access to the transitive closure table can only access the
current snapshot (i.e. the snap tables). A few specific composite views are also relevant to the delta views and these
have delta, delta1 and delta2 variants.
Composite View Purpose Snap Table and Views Delta Views
fsn Display of fully specified name for a specified All snapshot views -
conceptid.
pref Display of preferred synonym for a specified conceptid. All snapshot views -
syn Display of acceptable synonyms for a specified All snapshot views -
conceptid.
synall Display of all valid synonyms (preferred and All snapshot views -
acceptable) for a specified conceptid.
syn_search_active All valid synonyms of active concepts. This is used as All snapshot views -
the substrate for searches.
term_search_active Fully specified name and all valid synonyms of active All snapshot views -
concepts. This can be used as an extended substrate
for searches including fully specified names.
rel_fsn All relationships with fully specified names returned for All snapshot views -
sourceid (src_id, src_term), typeid (type_id, type_term)
and destinationid (dest_id, dest_term) and
relationshipGroup.
rel_pref All relationships with preferred synonyms returned for All snapshot views -
sourceid (src_id, src_term) typeid (type_id, type_term)
and destinationid (dest_id, dest_term) and
relationshipGroup.
rel_def_fsn All defining attribute relationships with fully specified All snapshot views -
names returned for sourceid (src_id, src_term), typeid
(type_id, type_term) and destinationid (dest_id,
dest_term) and relationshipGroup.
rel_def_pref All defining attribute relationships with preferred All snapshot views -
synonyms returned for sourceid (src_id, src_term)
typeid (type_id, type_term) and destinationid (dest_id,
dest_term) and relationshipGroup.
rel_child_fsn All direct subtypes of a concept (conceptId) returned All snapshot views -
using the id and fully specified name (id, term) of the
child concept.
rel_child_pref All direct subtypes of a concept (conceptId) returned All snapshot views -
using the id and preferred synonym (id, term) of the
child concept.
rel_parent_fsn All direct supertypes of a concept (conceptId) returned All snapshot views -
using the id and fully specified name (id, term) of the
parent concept.
rel_parent_pref All direct supertypes of a concept (conceptId) returned All snapshot views -
using the id and preferred synonym (id, term) of the
parent concept.
transclose_pref Transitive closure table view returned with subtype Only snap table -
and supertype returned with id and preferred term.
proxprim_pref Proximal primitive relationships closure table view Only snap table -
returned with subtype and supertype returned with id
and preferred term.
inactive_concepts Returns all inactive concepts in a specified snapshot or All snapshot views All delta views
delta view. The returned data includes the fully
specified name of the concept, the reason for
inactivation (from the concept inactivation reference
set) and the associations with active concepts shown in
the historical association reference sets.
inactive_descriptions Returns all inactive descriptions in a specified snapshot All snapshot views All delta views
or delta view. The returned data includes the fully
specified name and active status of the described
concept, and the reason for inactivation (from the
description inactivation reference set),
Stored Procedures
Procedure Description View Prefix
Support
snap_SearchPlus( Searches for acceptable synonyms of active concepts using a MySQL fulltext boolean search All snapshot
searchWords,filter) for the specified word or words. Word prefixed by "+" must be present, words prefixed by "-" views.
but be absent and words with neither prefix will also be searched for but their absence from a
term will not prevent a match.
CALL snap_SearchPlus('appendix','<proc');
CALL snap_SearchPlus('hemoglobin','<lab');
CALL snap_SearchPlus('infection','<19829001');
snap_ShowLanguages( Shows the terms associated with a specified conceptId in two languages specified by the All snapshot
conceptId, languageCodeA, language codes. views.
languageCodeB)
Example:
eclSimple(expression- Allows a fairly simple ECL expression to be processed. Maximum of one focus concept Only current
constraint) constraint optionally refined by up to two attribute value constraints. snapshot
Example:
CALL `eclSimple`('<404684003:363698007=<<39057004,116676008=<<415582006');
setLanguage(viewNumber, Sets the language reference set that determines the terms to be displayed by composite views -
languageCode) with names ending _fsn, _pref, _syn, _synall, term. The language and dialect code is used to
specify the language (e.g. en-US, en-GB).
If other values are supported by the SNOMED Edition, these will need to be added to the
config_languages to provide the refsetId lookup from the language code.
Example:
setDeltaRange( Sets the date range for a specified delta view (viewNumber 0=delta, 1=delta1, 2=delta2) -
viewNumber, startDateTime,
endDateTime) Examples:
CALL setDeltaRange(0,"20180731","20190731");
CALL setDeltaRange(2,"20020131","20070731");
setSnapshotTime( Sets the date on which a specified snapshot view is based (viewNumber 1=snap1, 2=snap2) -
viewNumber, dateTime)
Example:
resetConfig() Resets the configuration file to the default initial starting snapshot time and delta range. -
showConfig() Displays the configuration table settings for language, snapshot dates and delta ranges. -
ft_stopword_file = '' The two settings improve the full text search capabilities of the database. mysqld
ft_min_word_len = 2
• The first one removes the stop word list (which contains many words that
are significant in clinical terms). An alternative approach would be a
smaller stop word list but tests with SNOMED CT seem to suggest that this
would not result in a significant improvement in performance.
• The second setting allows words that are 2 letters long to be indexed (the
default setting is 4 which means terms like leg, arm, eye, ear ... are not
found in searches). Reducing this to 3 resolves this issue but still means
that common clinical abbreviations like MI, FH, RA as not indexed.
disable-log-bin These two settings stop the MySQL server from creating binary log files. Creation of these log files mysqld
during the import process not only results in substantially slowing of the process but can also
skip-log-bin
generates huge log files that more than double the space required for installation.
The additional configuration settings required are specified in the following way in a file provided in the SnomedRf
sMySql/cnf folder.
[mysqld]
local-infile=1
ft_stopword_file = ''
ft_min_word_len = 2
disable-log-bin
skip-log-bin
default-authentication-plugin=mysql_native_password
[mysql]
local-infile=1
[client]
local-infile=1
protocol=tcp
host=localhost
port=3306
Step 2 Are in a SNOMED International Member territory? To check if you are based in a Member territory see
the Members page on the SNOMED International
• If you are not in a Member territory website. On that page you will see a table listing all
skip to Step 6. the Member territories and providing contacts details
for each Member.
Step 3 Does your Member use the Member Licensing and Some SNOMED International Members use the
Distribution Service (MLDS)? SNOMED International MLDS service while others host
their own licensing and download services. To find
• If your Member uses MLDS skip to Step out if your Member uses MDLS service either:
5.
• Look at the releases available for
licensing and download from MLDS; or
• Follow the contact links for your
Member on the SNOMED International
Members webpage.
Step 4 Register with the licensing service provided by Follow the contact links for your Member on the
your Member. Members webpage. These links should take you to
information about the licensing and distribution
• Finally please check Step 6 below. service used by the Member.
Release Types
SNOMED CT release packages include the following three distinct representations of the terminology content.
• A full release, which is a release type in which the release files contain every version of every component and
reference set member ever released.
• A snapshot release, which is a release type in which the release files contain only the most recent version of
every component and reference set member released, as at the release date.
• A delta release, which is a release type in which the release files contain only rows that represent component
versions and reference set member versions created since the previous release date.
Versioned Views
A versioned view is formally defined as:
• A snapshot view which is a view of SNOMED CT There are two distinct types of snapshot view:
that includes the most recent version of all comp
onents and reference set members at a specified • A current snapshot view, which is a snapshot view for
point in time. the date of the most recent release.
• A retrospective snapshot view, which is a snapshot
view for a specified snapshot date.
• A delta view, which is a view of SNOMED CT that There are two distinct types of delta view:
contains only rows that represent changes to co
mponents and reference set members since a • The current delta view, which is a delta view for the
specified date or between two specified dates in date range between the most recent release date and
the past. the immediately preceding release date.
• A retrospective delta view, which is a delta view for a
specified date range.
View Uses
Full view This view contains all versions of all released components and reference set members. 1
• It can support all the uses identified in the following rows of this table.
Current snapshot view This view contains only the most recent version of all released components and reference set members.
• During and immediately after upgrading to a new release version, the previous snapshot
view map be of particular value for determining details of changes.
• Earlier snapshot views can also be valuable when comparing and evaluating results of
analyses which may have been affected by terminology changes.
Current delta view This view only includes the post change state of components that have changed since the previous release.
• It can be used to identify components that have been added or inactivated since the
previous release and this information can be used to check whether updates are needed.
For example, updating, implementation resources such as local subsets, data entry
picklists and queries. These updates may include removing inactive concepts or
descriptions as well as adding relevant newly added concepts and descriptions.
Note that some aspects of this review process also require access to the previous
current snapshot view.
Retrospective delta A retrospective delta has the same features as a current delta view but relates to changes between two earlier dates.
view
• It can be used in conjunction with snapshot views
Release Types
Full Snapshot Delta
Supported Views
Snapshot Views
Delta Views
Current Delta A delta view for the date range between the
most recent release date and the immediately
preceding release date.
get incorrect results in which all components appear to be active even after they have been inactivated. An example
of this error has been presented below.
Table C.3-4: Correct Snapshot view as at 2019-01-31 with inactive rows excluded