Before upgrading a SNOMED CT Extension to a new version of the International Edition on the Snow Owl terminology server it's necessary to find and update relationships pointing to concepts which are retired in the new release.
- The new International Release RF2 files
- The SCTID(s) of the extension module
- Snow-Owl running with the extension
- Basic knowledge of using Snow-Owl exports
- An OSX or Unix command line
- Export RF2 snapshot of Extension
- Grep for Extension RF2 relationships referencing retired International concepts
- Fix extension relationships
1. Export RF2 snapshot of Extension
Export a snapshot of the Extension from Snow-Owl by creating a snapshot export and specifying the SCTID or SCTIDs in the Extension.
Example export config for Sweden:
This will give you a url as a response e.g. :
So put into your web browser address bar: "https://dev-ms-authoring.ihtsdotools.org/snowowl/snomed-ct/v2/exports/f2d28e97-6e3b-4c75-b665-8895532954bd/archive"
If on the local machine use the uuid with the url as below:
NOTE: At present the export does not start being generated until after the archive has been requested. As such not much may seem to be occurring for quite a while.
2. Grep for Extension RF2 relationships referencing retired International concepts
Unzip the International Edition RF2 files into a working directory.
Unzip the Extension RF2 snapshot (the export.zip above) into a working directory.
Use the following shellscript and change the relevant directories:
Either use the script in the main termserver dir called checkconrels.sh or if it does not exist
- nano checkconrels.sh
- open Bash Script to Check concept relationships: and copy the script
- edit the script to set the paths to the international release, the international delta filename and the extension.
- sudo chmod 0774 checkconrels.sh
Use the following command line statement to find retired concepts from the International concept delta and for each grep the Extension relationship files. (The last six fields are extracted so the final grep can filter for active relationships without picking up relationships in role group 1).
Update the paths for your use case.
for retiredConcept in `grep -P '\t0\t' SnomedCT_RF2Release_INT_20160731/Delta/Terminology/sct2_Concept_Delta_INT_20160731.txt | cut -f1`; do \
grep $retiredConcept SE-Snapshot-Export/SnomedCT_Release_INT/RF2Release/Terminology/sct2_*Relationship_*.txt | cut -f1,2,3,4,5,6 | grep -P '\t1\t' \
&& echo "Relationship(s) above reference newly retired concept $retiredConcept"; \
Example output for upgrading the Swedish release to July 2016 of the International Edition:
SE-Snapshot-Export/SnomedCT_Release_INT/RF2Release/Terminology/sct2_Relationship_Snapshot_INT_20160921.txt:2047071000052125 20150531 1 45991000052106 51911000052104 69960004
SE-Snapshot-Export/SnomedCT_Release_INT/RF2Release/Terminology/sct2_StatedRelationship_Snapshot_INT_20160921.txt:49141000052128 20150531 1 45991000052106 51911000052104 69960004
Relationship(s) above reference newly retired concept 69960004
This shows that the inferred relationship 2047071000052125 and stated relationship 49141000052128 need to be fixed.
3. Fix extension relationships
Use the Snow-Owl relationship endpoint to update the offending relationships. Usually the destination of the relationship can be repointed to the parent of the retired concept but check that this concept has not also been retired.
Make a note of the relationships that have been fixed. After the upgrade process the MS customer should be informed so that they may make more appropriate relationship fixes now the new international content is available.
This method only covers the upgrade between consecutive International Edition releases. If an Extension is jumping two releases, for example from July 2015 to July 2016, then the command in section 2 should be repeated for each International release in turn.