Smntx

 
 

Smntx Deployment


Smntx has been deployed on a commercial Cloud (Amazon Elastic Compute Cloud), a private HIPAA compliant Cloud (iBI UC Cloud) and also in various local deployments. If required we can give access to a fully contained EC2 or vagrant/virtualbox image.

The following guide outlines a full Smntx deployment on Ubuntu 10.

Overview

The deployment of Smntx relies on various components. The components and the versions we have tested are:
  • Java 1.6
  • MetaMap (2009 v2)
  • MetaMap Java API (2009 v2)
  • Derby (10.6)
  • Solr (>=4)
  • Jetty (6/7)

Prerequisites

Ensure you have a Java environment setup.

sudo apt-get install openjdk-6-jdk

Ensure you have downloaded and extraced the Smntx web application and required files, in this guide the location is called <SMNTX-FILES>. A zip file containing all the required files is available here.

MetaMap

MetaMap can be downloaded from http://metamap.nlm.nih.gov. To run MetaMap in Smntx both MetaMap and the MetaMap java API are required. Instructions on installation are provided on the MetaMap web site, however, they are also repeated here to complete this guide.

  1. Unzip MetaMap to a suitable location (<MM_INSTALL_DIR>).
    bunzip2 -c public_mm_linux_2009v2.tar.bz2 | tar xvf -
  2. Setup environment variables pointing to this installation.
    export METAMAP_HOME=~/<MM_INSTALL_DIR>
    export PATH=$PATH:$METAMAP_HOME/bin
  3. Install MetaMap
    $METAMAP_HOME/bin/install.sh
  4. Unzip MetaMap Java API to the same directopry
    bunzip2 -dc public_mm_linux_javaapi_2009v2.tar.bz2 | tar xvf -
  5. Install MetaMap Java API
    ./bin/install.sh
    • Note: to run MetaMap on a 64 bit instance you will need to install 32 bit libs:
      sudo apt-get install ia32-libs
    • Note 2: If you are running MetaMap on a remote host you need to update the accepted_hosts variable to allow connections from a remote host.
      vi $METAMAP_HOME/bin/mmserver09

The resulting MetaMap installation can be tested by

  1. Start MetaMap
    $METAMAP_HOME/bin/skrmedpostctl start
    $METAMAP_HOME/bin/wsdserverctl start
    $METAMAP_HOME/bin/mmserver09
  2. Test local invocation (without Java API)
    echo "lung cancer" | $METAMAP_HOME/bin/metamap09v2 -I
  3. Test Java API
    ./$METAMAP_HOME/bin/testapi.sh laboratory culture

Derby

  1. Download, Unzip and install derby (alternatively you can use the pacakge manager and javadb)
    curl http://archive.apache.org/dist/db/derby/db-derby-10.6.2.1/db-derby-10.6.2.1-bin.tar.gz \--o db-derby-10.6.2.1-bin.tar.gz
    tar -xvf db-derby-10.6.2.1-bin.tar.gz
  2. Setup environment variables
    export PATH=$PATH:~/derby/bin/
    export PATH=$PATH:~/derby/lib/
    export DERBY_HOME=~/derby
  3. Start the derby network server. (if this is called remotely remember to update the hosts file)
    sudo java -jar $DERBY_HOME/lib/derbyrun.jar server start
  4. Setup the Smntx database using the Smntx schema (database.sql)
    ij CONNECT
    'jdbc:derby://localhost:1527/ctsadb;create=true';
    run '<SMNTX-FILES>/database.sql';

Solr

  1. Download Solr 4.0
    curl http://www.ci.uchicago.edu/~kyle/apache-solr-4.0-2010-12-17_08-05-54.tgz --O apache-solr-4.0-2010-12-17_08-05-54.tgz
  2. Unzip and install solr (ensure you have at least version 4)
    tar -xzf apache-solr-4.0-2010-12-17_08-05-54.tgz
  3. Copy Smntx index schema files
    cp <SMNTX_FILES>/solrconfig.xml <PATH-TO-SOLR>/example/solr/conf
    cp <SMNTX_FILES>/schema.xml <PATH-TO-SOLR>/example/solr/conf
  4. Setup environment variables
    export PATH=$PATH:<PATH-TO-SOLR>/example/lib/
  5. Start Solr
    cd <PATH-TO-SOLR>/example
    sudo java -jar start.jar

Jetty

  1. Install Jetty (either locally or via the package manager)
    sudo apt-get install jetty
  2. Copy lib files to the jetty lib directory (/usr/share/jetty/lib/)
    • Solr and Solrj (from the solr/dist and solr/dist/solrj-lib/ directorys
      • apache-solr-core-4.0-2010-12-17_08-05-54.jar
      • apache-solr-solrj-4.0-2010-12-17_08-05-54.jar
      • commons-codec-1.4.jar
      • commons-httpclient-3.1.jar
      • commons-io-1.4.jar
      • slf4j-api-1.5.5.jar
    • Logging jars (included in if you do not have them)
      • commons-logging-1.1.1.jar
      • commons-logging-api-1.1.jar
      • slf4j-simple-1.5.5.jar
    • MetaMap jars (from the $METAMAP_HOME/src/javaapi/dist directory)
      • prologbeans.jar
      • MetaMapApi.jar
  3. Deploy the Smntx web application
    sudo cp <SMNTX_FILES>/MetaMap.war /usr/share/jetty/webapps/
  4. You will need to configure the properties of the war to point to the correct Solr, MetaMap and file storage directory. This can be done by unzipping the war file and changing the properties file(WEB-INF/classes/applicationContext.xml)
    vi WEB-INF/classes/applicationContext.xml


    <bean name="userBean">
      <property name="userBaseDirectory">
        <value>/home/ctsa/MetaMap/Temp/<value>
      </property>
    </bean>

    <bean id="metaMapQueue">
      <constructor-arg type="java.lang.String" value="localhost"/>
      <constructor-arg type="int" value="8066"/>
    </bean>

    <bean name="solrBean">
      <property name="solrURI">
        <value>http://localhost:8983/solr/</value>
      </property>
    </bean>
  5. If derby is not running on the default 1527 port you will also need to update the openJPA properties file (/WEB-INF/classes/META-INF/persistence.xml)
  6. Start/Restart Jetty
    sudo java -jar /usr/share/jettystart.jar
    Or
    sudo /etc/init.d/jetty restart sudo /etc/init.d/jetty stop sudo /etc/init.d/jetty start
  7. Note: If you want to access the demo from a remote host when using deamon jetty you will need to update the jetty configuration settings so that JETTY_HOST (accepted hosts) is 0.0.0.0
    sudo vi /etc/default/jetty

    Running Smntx

    Ensure each of the major components is started (I use screen to run multiple shells).
  8. MetaMap
    $METAMAP_HOME/bin/skrmedpostctl start $METAMAP_HOME/bin/wsdserverctl start $METAMAP_HOME/bin/mmserver09
  9. Derby
    sudo java -jar $DERBY_HOME/lib/derbyrun.jar server start
  10. Solr
    cd <PATH-TO-SOLR</example sudo java -jar
    start.jar
  11. Jetty
    sudo /etc/init.d/jetty start

Test the REST API using curl

curl localhost:8080/MetaMap/MetaMap.html

Finally test the web interface by pointing your browser at

http://localhost:8080/MetaMap/MetaMap.html