Overview

Information on the ICD11 mapping project.

Documentation

Deployment Server Details

Software installed

Uploading files

Making a Release

Important details

Details to configure:

Data files for this project are in /home/ihtsdo/data/ICD11

These steps were taken to set up the project


Helpful Admin Commands

A cycle of redeploying maps involves running the algorithm to generate the "icd11Map.txt" and "icd11MapNotes.txt" files.  Assuming everything described above is already configured, the task here is simply to replace the data.  This is done with the "reload.csh" script in /home/ihtsdo/data/ICD11/reload.csh. 

#!/bin/csh -f

set rc = run.config=/opt/mapping-service/conf/config.properties
if ($#argv != 1) then
  echo "usage: $0 <refsetId>"
  echo "  icd11RefsetId"
  echo "  icd11RefsetId-b"
  exit 1
endif
#set refsetId = icd11RefsetId-b
set refsetId = $1
if ($refsetId != "icd11RefsetId" && $refsetId != "icd11RefsetId-b") then
    echo "ERROR: unexpected value for refsetId: $refsetId"
    exit 1
endif

set adminDir = /opt/mapping-service-admin/admin

echo "---------------------------------------------------"
echo "Starting ...`/bin/date`"
echo "---------------------------------------------------"
echo "refsetId: $refsetId"
echo ""

curl "https://prod-mapping-icd11.ihtsdotools.org/" | grep 'Bad Gateway' > /tmp/x.$$
if ($status == 0 && `cat /tmp/x.$$ | wc -l` == 0) then
    echo "STOP the server before running this (as root)"
    echo "    supervisorctl stop mapping-service"
    exit 1
endif

# Stop server
#sudo supervisorctl stop mapping-service

echo "  Extract icd11Map.txt into LOW, MED, HIGH"
grep 'FINAL CATEGORY LOW' icd11MapNotes.txt | cut -f 6 | sort -u -o low.txt
grep 'FINAL CATEGORY MEDIUM' icd11MapNotes.txt | cut -f 6 | sort -u -o medium.txt
grep 'FINAL CATEGORY HIGH' icd11MapNotes.txt | cut -f 6 | sort -u -o high.txt
grep 'FINAL CATEGORY NO MAP' icd11MapNotes.txt | cut -f 6 | sort -u >> high.txt

/bin/rm -f icd11Map.{low,medium,high}.txt
perl -ne 'BEGIN {open(I,"low.txt"); while(<I>){chop; $m{$_}=1;} close(I);} @_=split/\t/; print if $m{$_[5]}; ' icd11Map.txt > icd11Map.low.txt
perl -ne 'BEGIN {open(I,"medium.txt"); while(<I>){chop; $m{$_}=1;} close(I);} @_=split/\t/; print if $m{$_[5]}; ' icd11Map.txt > icd11Map.medium.txt
perl -ne 'BEGIN {open(I,"high.txt"); while(<I>){chop; $m{$_}=1;} close(I);} @_=split/\t/; print if $m{$_[5]}; ' icd11Map.txt > icd11Map.high.txt

/bin/rm -f icd11MapNotes.{low,medium,high}.txt
perl -ne 'BEGIN {open(I,"low.txt"); while(<I>){chop; $m{$_}=1;} close(I);} @_=split/\t/; print if $m{$_[5]}; ' icd11MapNotes.txt > icd11MapNotes.low.txt
perl -ne 'BEGIN {open(I,"medium.txt"); while(<I>){chop; $m{$_}=1;} close(I);} @_=split/\t/; print if $m{$_[5]}; ' icd11MapNotes.txt > icd11MapNotes.medium.txt
perl -ne 'BEGIN {open(I,"high.txt"); while(<I>){chop; $m{$_}=1;} close(I);} @_=split/\t/; print if $m{$_[5]}; ' icd11MapNotes.txt > icd11MapNotes.high.txt

echo "  Replace notes for maps ...`/bin/date`"
perl -ne 'BEGIN {open(I,"icd11MapNotes.txt"); while(<I>){@_=split/\t/; $m{$_[5]}=1;} close(I);} @_=split/\t/; print unless $m{$_[5]}; ' notes/icd11MapNotes.txt > fix
/bin/mv -f fix notes/icd11MapNotes.txt
cat icd11MapNotes.txt >> notes/icd11MapNotes.txt

# map remover augmented to remove map records for concept ids in a specified input file
echo "  Removing old maps ...`/bin/date`"
cd $adminDir/remover
mvn install -PMapRecords -D$rc -Drefset.id=$refsetId -Dinput.file=/opt/mapping-data/ICD11/icd11Map.txt >&! /tmp/mvn.log
if ($status != 0) then
    cat /tmp/mvn.log | sed 's/^/     /'
    echo "ERROR removing map records"
    exit 1
endif

echo "  Adding new maps and notes ...`/bin/date`"

echo "    add MEDIUM records as EDITING_DONE ...`/bin/date`"
cd $adminDir/loader
mvn install -PMapRecords -D$rc -Dinput.file=/opt/mapping-data/ICD11/icd11Map.medium.txt \
  -Dmember.flag=false -Drecord.flag=true -Dworkflow.status=EDITING_DONE >&! /tmp/mvn.log
if ($status != 0) then
    cat /tmp/mvn.log | sed 's/^/     /'
    echo "ERROR installing maps"
    exit 1
endif
echo "    add MEDIUM notes ...`/bin/date`"
cd $adminDir/loader
mvn install -PMapNotes -D$rc -Dinput.file=/opt/mapping-data/ICD11/icd11MapNotes.medium.txt >&! /tmp/mvn.log
if ($status != 0) then
    cat /tmp/mvn.log | sed 's/^/     /'
    echo "ERROR installing map notes"
    exit 1
endif

echo "    add HIGH as PUBLISHED ...`/bin/date`"
cd $adminDir/loader
mvn install -PMapRecords -D$rc -Dinput.file=/opt/mapping-data/ICD11/icd11Map.high.txt \
  -Dmember.flag=false -Drecord.flag=true >&! /tmp/mvn.log
if ($status != 0) then
    cat /tmp/mvn.log | sed 's/^/     /'
    echo "ERROR installing maps"
    exit 1
endif
echo "    add HIGH notes ...`/bin/date`"
cd $adminDir/loader
mvn install -PMapNotes -D$rc -Dinput.file=/opt/mapping-data/ICD11/icd11MapNotes.high.txt >&! /tmp/mvn.log
if ($status != 0) then
    cat /tmp/mvn.log | sed 's/^/     /'
    echo "ERROR installing map notes"
    exit 1
endif

# before doing workflow stuff with HIGH, compute workflow
echo "  Compute workflow ...`/bin/date`"
cd $adminDir/loader
mvn install -PComputeWorkflow -D$rc -Drefset.id=$refsetId >&! /tmp/mvn.log
if ($status != 0) then
    cat /tmp/mvn.log | sed 's/^/     /'
    echo "ERROR running compute workflow"
    exit 1
endif

echo "    convert HIGH to QA ...`/bin/date`"
cd $adminDir/loader
mvn install -PAdHoc -D$rc -Drefset.id=$refsetId -Dmode=icd11 -Dinput.file=/opt/mapping-data/ICD11/icd11Map.high.txt >&! /tmp/mvn.log
if ($status != 0) then
    cat /tmp/mvn.log | sed 's/^/     /'
    echo "ERROR running adhoc step"
    exit 1
endif

# compute workflow again when finished assigning to QA
echo "  Compute workflow ...`/bin/date`"
cd $adminDir/loader
mvn install -PComputeWorkflow -D$rc -Drefset.id=$refsetId >&! /tmp/mvn.log
if ($status != 0) then
    cat /tmp/mvn.log | sed 's/^/     /'
    echo "ERROR running compute workflow"
    exit 1
endif


# Start server -
#sudo supervisorctl start mapping-service

echo "---------------------------------------------------"
echo "Finished ...`/bin/date`"
echo "---------------------------------------------------"
echo ""
echo "REMEMBER to restart the server = supervisorctl start mapping-service"