Running HDR ETS Programs Using Scripts
You can run the ETS loader, importer, and maintenance programs from the middle tier or from the database tier using the following scripts:
Middle Tier
If you want to run the ETS programs from the middle tier, ensure that ETS_HOME and JAVA_HOME are set properly. Before running the following scripts, edit the <HDR_HOME>/ weblogic/hdr/ets/lib/connection.properties file to pass the database host name, port number, database service name, and ETS schema user name.
ETS_HOME = <HDR_HOME>/weblogic/hdr/ets
- HDR Loader
Script
#!/bin/sh if [ -z "$ETS_HOME" ] || [ ! -d "$ETS_HOME" ]; then echo ETS_HOME is not set or not accessible, set to the location where HDR is installed. exit fi if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then echo JAVA_HOME is not set or not accessible, set to the location where JDK is installed. exit fi #Default ETS process options, can be editable JAVA=$JAVA_HOME/bin/java ETS_LIB="$ETS_HOME/lib/*" CONNECTION_PROPERTIES=$ETS_HOME/lib/connection.properties LOG_CFG=$ETS_HOME/lib/logging.properties EXEC_REPORT=$ETS_HOME/log/hdr_ets_loader_program.rpt LOG_FILE=$ETS_HOME/log/hdr_ets_loader_program.log LOG_FORMAT="%5\$s%n" # ER 29190730 - Roll off previous run's log file (if it exists) if [ -f $LOG_FILE ] then ROLL_OFF_TIMESTAMP=$(date"+%Y.%m.%d-%H.%M.%S") echo rolling off existing log file $LOG_FILE with date $ROLL_OFF_TIMESTAMP mv $LOG_FILE $LOG_FILE.$ROLL_OFF_TIMESTAMP fi if [ ! -x $JAVA ] then echo $JAVA is not executable exit fi echo $JAVA_HOME if [ ! -f $CONNECTION_PROPERTIES ] || [ ! -f $LOG_CFG ]; then echo Configuration files not readable. echo $CONNECTION_PROPERTIES echo $LOG_CFG exit fi echo HDR ETS Loader Options: echo ETS_HOME : $ETS_HOME echo Report file: $EXEC_REPORT echo Log file: $LOG_FILE echo #Default ETS process options, can be editable #SNOMED-CT 20130901 #CNTRL_FILE=$ETS_HOME/snomed/SCT_RF2_Snapshot_US1000124_20130901.ctl #CODING_SCHEME=SNOMED-CT #VERSION_NAME=v20130901 #LOINC v219 CNTRL_FILE=$ETS_HOME/loinc/LOINC_for_ETS_v219_control.ctl CODING_SCHEME=LOINC VERSION_NAME=v219 echo -en "Use Default ETS Loader Options[Y/N] (default=Y): " read etsDefaultOptions if [ -z "$etsDefaultOptions" ] then etsDefaultOptions=Y fi read -s -p "Enter ETS Database User Password (not echoed to screen): " DB_PWD && echo if [ "$etsDefaultOptions" != "Y" ]; then read -p "Enter Coding Scheme Control File Path: " CNTRL_FILE read -p "Enter Coding Scheme Name: " CODING_SCHEME read -p "Enter Coding Scheme Version Name: " VERSION_NAME fi echo "Coding Scheme Control File Path: "$CNTRL_FILE echo "Coding Scheme Name: "$CODING_SCHEME echo "Coding Scheme Version Name: "$VERSION_NAME if [ -z "$CNTRL_FILE" ] || [ ! -f $CNTRL_FILE ]; then echo Coding Scheme Control File Not Readable. echo $CNTRL_FILE exit fi if [ -z "$CODING_SCHEME" ] || [ -z "$VERSION_NAME" ]; then echo Coding Scheme Name and Version Name Must Be Specified. exit fi # Get all of the files in the classpath and convert to the correct UNIX format if [[ "$(uname)" == "CYGWIN"* ]]; then CLASSPATH=$ETS_LIB else CLASSPATH="" for j in $ETS_LIB do CLASSPATH=$j:$CLASSPATH done fi echo "CLASSPATH:" $CLASSPATH echo echo Running ETS Loader Process ... echo $JAVA -cp $CLASSPATH -Djava.util.logging.SimpleFormatter.format="$LOG_FORMAT" - DCONNECTION_PROPERTIES=$CONNECTION_PROPERTIES - DExecutionReport=$EXEC_REPORT -DLogFile=$LOG_FILE -DDB_USER=ETS - DDB_USER_PASSWORD=$DB_PWD -Djava.util.logging.config.file=$LOG_CFG oracle.hsgbu.ets.util.LoadManagerLauncher "$CNTRL_FILE" "$CODING_SCHEME" "$VERSION_NAME" > /dev/null 2>&1 & echo Process ID for ETS Loader: $! tail --retry -q -n 0 -f $LOG_FILE --pid=$!
- HDR Importer
Script
#!/bin/sh if [ -z "$ETS_HOME" ] || [ ! -d "$ETS_HOME" ]; then echo ETS_HOME is not set or not accessible, set to the location where HDR is installed. exit fi if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then echo JAVA_HOME is not set or not accessible, set to the location where JDK is installed. exit fi #Default ETS process options, can be editable JAVA=$JAVA_HOME/bin/java ETS_LIB="$ETS_HOME/lib/*" CONNECTION_PROPERTIES=$ETS_HOME/lib/connection.properties LOG_CFG=$ETS_HOME/lib/logging.properties EXEC_REPORT=$ETS_HOME/log/hdr_ets_importer_program.rpt LOG_FILE=$ETS_HOME/log/hdr_ets_importer_program.log LREPORT_FILE=$ETS_HOME/log/hdr_ets_loader_program.rpt LOG_FORMAT="%5\$s%n" ACTIVATE_VERSION="N" DEFAULT_VERSION="N" # ER 29190730 - Roll off previous run's log file (if it exists) if [ -f $LOG_FILE ] then ROLL_OFF_TIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S") echo rolling off existing log file $LOG_FILE with date $ROLL_OFF_TIMESTAMP mv $LOG_FILE $LOG_FILE.$ROLL_OFF_TIMESTAMP fi if [ -f $LREPORT_FILE ] then SEQNO=`grep "Load sequence number" $LREPORT_FILE | cut -d ':' -f2-2 | sed -e 's/^[ ]*//g' | sed 's/[ ]*$//g'` echo Load sequence no from loader report file: $SEQNO fi if [ ! -x $JAVA ] then echo $JAVA is not executable exit fi if [ ! -f $CONNECTION_PROPERTIES ] || [ ! -f $LOG_CFG ]; then echo Configuration files not readable. echo $CONNECTION_PROPERTIES echo $LOG_CFG exit fi echo HDR ETS Importer Options: echo ETS_HOME : $ETS_HOME echo ETS Loader Report file: $LREPORT_FILE echo ETS Importer Report file: $EXEC_REPORT echo ETS Importer Log file: $LOG_FILE echo read -s -p "Enter ETS Database User Password (not echoed to screen): " DB_PWD && echo read -p "Enter ETS Loader Sequence Number (default=$SEQNO): "SEQ_N if [ ! -z "$SEQ_N" ] then SEQNO=$SEQ_N fi if [ -z "$SEQNO" ] then echo Load sequence no is needed to run the importer program. The load sequence no is \"$SEQNO\" exit fi read -p "Enter Y/N to specify if the newly imported version should be set to 'active' after import (default=$ACTIVATE_VERSION): " ACTIVATE_VERSION_P if [ ! -z "$ACTIVATE_VERSION_P" ]then ACTIVATE_VERSION=$ACTIVATE_VERSION_P fi read -p "Enter Y/N to specify if the newly imported version should be set to 'default' after import (default=$DEFAULT_VERSION): " DEFAULT_VERSION_P if [ ! -z "$DEFAULT_VERSION_P" ] then DEFAULT_VERSION=$DEFAULT_VERSION_P fi # Get all of the files in the classpath and convert to the correct UNIX format if [[ "$(uname)" == "CYGWIN"* ]]; then CLASSPATH=$ETS_LIB else CLASSPATH="" for j in $ETS_LIB do CLASSPATH=$j:$CLASSPATH done fi echo echo Running ETS Importer Process ... echo $JAVA -cp $CLASSPATH -Djava.util.logging.SimpleFormatter.format="$LOG_FORMAT" - DCONNECTION_PROPERTIES=$CONNECTION_PROPERTIES -DExecutionReport=$EXEC_REPORT - DLogFile=$LOG_FILE -DDB_USER=ETS -DDB_USER_PASSWORD=$DB_PWD - Djava.util.logging.config.file=$LOG_CFG oracle.hsgbu.ets.util.ImportManagerLauncher $SEQNO $ACTIVATE_VERSION $DEFAULT_VERSION > /dev/null 2>&1 & echo Process ID for ETS Importer: $! tail --retry -q -n 0 -f $LOG_FILE --pid=$!
- HDR Maintenance Script
Note:
ETS Maintenance Job prompts for the run mode. For run mode details, see Scheduling the Maintenance Job in the Oracle Healthcare Data Repository Implementation Guide.#!/bin/sh if [ -z "$ETS_HOME" ] || [ ! -d "$ETS_HOME" ]; then echo ETS_HOME is not set or not accessible, set to the location where HDR is installed. exit fi if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then echo JAVA_HOME is not set or not accessible, set to the location where JDK is installed. exit fi #Default ETS process options, can be editable JAVA=$JAVA_HOME/bin/java ETS_LIB="$ETS_HOME/lib/*" CONNECTION_PROPERTIES=$ETS_HOME/lib/connection.properties LOG_CFG=$ETS_HOME/lib/logging.properties EXEC_REPORT=$ETS_HOME/log/hdr_ets_maintenance_program.rpt LOG_FILE=$ETS_HOME/log/hdr_ets_maintenance_program.log LOG_FORMAT="%5\$s%n" RUNMODE=FULL # ER 29190730 - Roll off previous run's log file (if it exists) if [ -f $LOG_FILE ] then ROLL_OFF_TIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S") echo rolling off existing log file $LOG_FILE with date $ROLL_OFF_TIMESTAMP mv $LOG_FILE $LOG_FILE.$ROLL_OFF_TIMESTAMP fi if [ ! -x $JAVA ] then echo $JAVA is not executable exit fi if [ ! -f $CONNECTION_PROPERTIES ] || [ ! -f $LOG_CFG ]; then echo Configuration files not readable. echo $CONNECTION_PROPERTIES echo $LOG_CFG exit fi echo HDR ETS Maintenance Options: echo ETS_HOME : $ETS_HOME echo Report file: $EXEC_REPORT echo Log file: $LOG_FILE echo read -s -p "Enter ETS Database User Password (not echoed to screen): " DB_PWD && echo read -p "Enter ETS Maintenance Run Mode (default mode: FULL): " RUN_MOD if [ ! -z "$RUN_MODE"] then RUNMODE=$RUN_MODE fi # Get all of the files in the classpath and convert to the correct UNIX format if [[ "$(uname)" == "CYGWIN"* ]]; then CLASSPATH=$ETS_LIB else CLASSPATH="" for j in $ETS_LIB do CLASSPATH=$j:$CLASSPATH done fi echo echo Running ETS Maintenance Process $JAVA -cp $CLASSPATH -Djava.util.logging.SimpleFormatter.format="$LOG_FORMAT" - DCONNECTION_PROPERTIES=$CONNECTION_PROPERTIES -DExecutionReport=$EXEC_REPORT - DLogFile=$LOG_FILE -DDB_USER=ETS -DDB_USER_PASSWORD=$DB_PWD - Djava.util.logging.config.file=$LOG_CFG oracle.hsgbu.ets.util.MaintenanceManagerLauncher $RUNMODE > /dev/null 2>&1 & echo Process ID for ETS Maintenance: $! tail --retry -q -n 0 -f $LOG_FILE --pid=$!
Database Tier
If you want to run the HDR ETS programs from the database tier, ensure that ETS_HOME and JAVA_HOME are set properly. Before running the following scripts, edit the <HDR_HOME>/ hdr_db/ets/lib/connection.properties file to pass the database host name, port number, database service name, and ETS schema user name.
ETS_HOME = <HDR_HOME>/hdr_db/ets
- HDR Loader
Script
#!/bin/sh if [ -z "$ETS_HOME" ] || [ ! -d "$ETS_HOME" ]; then echo ETS_HOME is not set or not accessible, set to the location where HDR is installed. exit fi if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then echo JAVA_HOME is not set or not accessible, set to the location where JDK is installed. exit fi #Default ETS process options, can be editable JAVA=$JAVA_HOME/bin/java ETS_LIB="$ETS_HOME/lib/*" CONNECTION_PROPERTIES=$ETS_HOME/lib/connection.properties LOG_CFG=$ETS_HOME/lib/logging.properties EXEC_REPORT=$ETS_HOME/log/hdr_ets_loader_program.rpt LOG_FILE=$ETS_HOME/log/hdr_ets_loader_program.log LOG_FORMAT="%5\$s%n" # ER 29190730 - Roll off previous run's log file (if it exists) if [ -f $LOG_FILE ] then ROLL_OFF_TIMESTAMP=$(date"+%Y.%m.%d-%H.%M.%S") echo rolling off existing log file $LOG_FILE with date $ROLL_OFF_TIMESTAMP mv $LOG_FILE $LOG_FILE.$ROLL_OFF_TIMESTAMP fi if [ ! -x $JAVA ] then echo $JAVA is not executable exit fi echo $JAVA_HOME if [ ! -f $CONNECTION_PROPERTIES ] || [ ! -f $LOG_CFG ]; then echo Configuration files not readable. echo $CONNECTION_PROPERTIES echo $LOG_CFG exit fi echo HDR ETS Loader Options: echo ETS_HOME : $ETS_HOME echo Report file: $EXEC_REPORT echo Log file: $LOG_FILE echo #Default ETS process options, can be editable #SNOMED-CT 20130901 #CNTRL_FILE=$ETS_HOME/snomed/SCT_RF2_Snapshot_US1000124_20130901.ctl #CODING_SCHEME=SNOMED-CT #VERSION_NAME=v20130901 #LOINC v219 CNTRL_FILE=$ETS_HOME/loinc/LOINC_for_ETS_v219_control.ctl CODING_SCHEME=LOINC VERSION_NAME=v219 echo -en "Use Default ETS Loader Options[Y/N] (default=Y): " read etsDefaultOptions if [ -z "$etsDefaultOptions" ] then etsDefaultOptions=Y fi read -s -p "Enter ETS Database User Password (not echoed to screen): " DB_PWD && echo if [ "$etsDefaultOptions" != "Y" ]; then read -p "Enter Coding Scheme Control File Path: " CNTRL_FILE read -p "Enter Coding Scheme Name: " CODING_SCHEME read -p "Enter Coding Scheme Version Name: " VERSION_NAME fi echo "Coding Scheme Control File Path: "$CNTRL_FILE echo "Coding Scheme Name: "$CODING_SCHEME echo "Coding Scheme Version Name: "$VERSION_NAME if [ -z "$CNTRL_FILE" ] || [ ! -f $CNTRL_FILE ]; then echo Coding Scheme Control File Not Readable. echo $CNTRL_FILE exit fi if [ -z "$CODING_SCHEME" ] || [ -z "$VERSION_NAME" ]; then echo Coding Scheme Name and Version Name Must Be Specified. exit fi # Get all of the files in the classpath and convert to the correct UNIX format if [[ "$(uname)" == "CYGWIN"* ]]; then CLASSPATH=$ETS_LIB else CLASSPATH="" for j in $ETS_LIB do CLASSPATH=$j:$CLASSPATH done fi echo "CLASSPATH:" $CLASSPATH echo echo Running ETS Loader Process ... echo $JAVA -cp $CLASSPATH -Djava.util.logging.SimpleFormatter.format="$LOG_FORMAT" - DCONNECTION_PROPERTIES=$CONNECTION_PROPERTIES - DExecutionReport=$EXEC_REPORT -DLogFile=$LOG_FILE -DDB_USER=ETS - DDB_USER_PASSWORD=$DB_PWD -Djava.util.logging.config.file=$LOG_CFG oracle.hsgbu.ets.util.LoadManagerLauncher "$CNTRL_FILE" "$CODING_SCHEME" "$VERSION_NAME" > /dev/null 2>&1 & echo Process ID for ETS Loader: $! tail --retry -q -n 0 -f $LOG_FILE --pid=$!
- HDR Importer
Script
#!/bin/sh if [ -z "$ETS_HOME" ] || [ ! -d "$ETS_HOME" ]; then echo ETS_HOME is not set or not accessible, set to the location where HDR is installed. exit fi if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then echo JAVA_HOME is not set or not accessible, set to the location where JDK is installed. exit fi #Default ETS process options, can be editable JAVA=$JAVA_HOME/bin/java ETS_LIB="$ETS_HOME/lib/*" CONNECTION_PROPERTIES=$ETS_HOME/lib/connection.properties LOG_CFG=$ETS_HOME/lib/logging.properties EXEC_REPORT=$ETS_HOME/log/hdr_ets_importer_program.rpt LOG_FILE=$ETS_HOME/log/hdr_ets_importer_program.log LREPORT_FILE=$ETS_HOME/log/hdr_ets_loader_program.rpt LOG_FORMAT="%5\$s%n" ACTIVATE_VERSION="N" DEFAULT_VERSION="N" # ER 29190730 - Roll off previous run's log file (if it exists) if [ -f $LOG_FILE ] then ROLL_OFF_TIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S") echo rolling off existing log file $LOG_FILE with date $ROLL_OFF_TIMESTAMP mv $LOG_FILE $LOG_FILE.$ROLL_OFF_TIMESTAMP fi if [ -f $LREPORT_FILE ] then SEQNO=`grep "Load sequence number" $LREPORT_FILE | cut -d ':' -f2-2 | sed -e 's/^[ ]*//g' | sed 's/[ ]*$//g'` echo Load sequence no from loader report file: $SEQNO fi if [ ! -x $JAVA ] then echo $JAVA is not executable exit fi if [ ! -f $CONNECTION_PROPERTIES ] || [ ! -f $LOG_CFG ]; then echo Configuration files not readable. echo $CONNECTION_PROPERTIES echo $LOG_CFG exit fi echo HDR ETS Importer Options: echo ETS_HOME : $ETS_HOME echo ETS Loader Report file: $LREPORT_FILE echo ETS Importer Report file: $EXEC_REPORT echo ETS Importer Log file: $LOG_FILE echo read -s -p "Enter ETS Database User Password (not echoed to screen): " DB_PWD && echo read -p "Enter ETS Loader Sequence Number (default=$SEQNO): "SEQ_N if [ ! -z "$SEQ_N" ] then SEQNO=$SEQ_N fi if [ -z "$SEQNO" ] then echo Load sequence no is needed to run the importer program. The load sequence no is \"$SEQNO\" exit fi read -p "Enter Y/N to specify if the newly imported version should be set to 'active' after import (default=$ACTIVATE_VERSION): " ACTIVATE_VERSION_P if [ ! -z "$ACTIVATE_VERSION_P" ]then ACTIVATE_VERSION=$ACTIVATE_VERSION_P fi read -p "Enter Y/N to specify if the newly imported version should be set to 'default' after import (default=$DEFAULT_VERSION): " DEFAULT_VERSION_P if [ ! -z "$DEFAULT_VERSION_P" ] then DEFAULT_VERSION=$DEFAULT_VERSION_P fi # Get all of the files in the classpath and convert to the correct UNIX format if [[ "$(uname)" == "CYGWIN"* ]]; then CLASSPATH=$ETS_LIB else CLASSPATH="" for j in $ETS_LIB do CLASSPATH=$j:$CLASSPATH done fi echo echo Running ETS Importer Process ... echo $JAVA -cp $CLASSPATH -Djava.util.logging.SimpleFormatter.format="$LOG_FORMAT" - DCONNECTION_PROPERTIES=$CONNECTION_PROPERTIES -DExecutionReport=$EXEC_REPORT - DLogFile=$LOG_FILE -DDB_USER=ETS -DDB_USER_PASSWORD=$DB_PWD - Djava.util.logging.config.file=$LOG_CFG oracle.hsgbu.ets.util.ImportManagerLauncher $SEQNO $ACTIVATE_VERSION $DEFAULT_VERSION > /dev/null 2>&1 & echo Process ID for ETS Importer: $! tail --retry -q -n 0 -f $LOG_FILE --pid=$!
- HDR Maintenance Script
Note:
ETS Maintenance Job prompts for the run mode. For run mode details, see Scheduling the Maintenance Job in the Oracle Healthcare Data Repository Implementation Guide.#!/bin/sh if [ -z "$ETS_HOME" ] || [ ! -d "$ETS_HOME" ]; then echo ETS_HOME is not set or not accessible, set to the location where HDR is installed. exit fi if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then echo JAVA_HOME is not set or not accessible, set to the location where JDK is installed. exit fi #Default ETS process options, can be editable JAVA=$JAVA_HOME/bin/java ETS_LIB="$ETS_HOME/lib/*" CONNECTION_PROPERTIES=$ETS_HOME/lib/connection.properties LOG_CFG=$ETS_HOME/lib/logging.properties EXEC_REPORT=$ETS_HOME/log/hdr_ets_maintenance_program.rpt LOG_FILE=$ETS_HOME/log/hdr_ets_maintenance_program.log LOG_FORMAT="%5\$s%n" RUNMODE=FULL # ER 29190730 - Roll off previous run's log file (if it exists) if [ -f $LOG_FILE ] then ROLL_OFF_TIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S") echo rolling off existing log file $LOG_FILE with date $ROLL_OFF_TIMESTAMP mv $LOG_FILE $LOG_FILE.$ROLL_OFF_TIMESTAMP fi if [ ! -x $JAVA ] then echo $JAVA is not executable exit fi if [ ! -f $CONNECTION_PROPERTIES ] || [ ! -f $LOG_CFG ]; then echo Configuration files not readable. echo $CONNECTION_PROPERTIES echo $LOG_CFG exit fi echo HDR ETS Maintenance Options: echo ETS_HOME : $ETS_HOME echo Report file: $EXEC_REPORT echo Log file: $LOG_FILE echo read -s -p "Enter ETS Database User Password (not echoed to screen): " DB_PWD && echo read -p "Enter ETS Maintenance Run Mode (default mode: FULL): " RUN_MOD if [ ! -z "$RUN_MODE"] then RUNMODE=$RUN_MODE fi # Get all of the files in the classpath and convert to the correct UNIX format if [[ "$(uname)" == "CYGWIN"* ]]; then CLASSPATH=$ETS_LIB else CLASSPATH="" for j in $ETS_LIB do CLASSPATH=$j:$CLASSPATH done fi echo echo Running ETS Maintenance Process $JAVA -cp $CLASSPATH -Djava.util.logging.SimpleFormatter.format="$LOG_FORMAT" - DCONNECTION_PROPERTIES=$CONNECTION_PROPERTIES -DExecutionReport=$EXEC_REPORT - DLogFile=$LOG_FILE -DDB_USER=ETS -DDB_USER_PASSWORD=$DB_PWD - Djava.util.logging.config.file=$LOG_CFG oracle.hsgbu.ets.util.MaintenanceManagerLauncher $RUNMODE > /dev/null 2>&1 & echo Process ID for ETS Maintenance: $! tail --retry -q -n 0 -f $LOG_FILE --pid=$!