Navigation Menu

Skip to content

jmandel2/smart_server

 
 

Repository files navigation

#The SMArt reference EMR documentation is rapidly evolving. If something in this document looks strange, confusing, or wrong, please ask about it: ###http://groups.google.com/group/smart-app-developers

Repositories

These instructions apply to each of three github repositories that you'll need in order to run the SMArt Reference EMR in your own environment:

System setup

  • Recent Linux installation (Kernel 2.6+). We recommend an up-to-date version of Ubuntu, and these instructions are written from that perspective.

  • Note: These instructions have been updated for Ubuntu 11.4.

  • Note: We recommend you do this by sudo'ing from a non-root user. If you would like to do this as root make sure you create at least one non-root user with useradd -m {USER} otherwise the default locale will not be set. This issue is most common on a new OS build.

  • Python 2.7 with package psycopg2 and libxslt1

    sudo apt-get install python-psycopg2 python-libxslt1 python-m2crypto python-simplejson python-argparse python-setuptools python-pyparsing

    sudo easy_install -U "rdflib>=3.0.0"  rdfextras
  • Django 1.1
    sudo apt-get install python-django
  • PostgreSQL 8.3+
     sudo apt-get install postgresql

Setup Database

You'll have the easiest time naming your database smart

  • There are two ways to authenticate to PostgreSQL: use your Unix credentials, or use a separate username and password. We strongly recommend the latter, and our instructions are tailored appropriately. If you know how to use PostgreSQL and want to use Unix-logins, go for it, just remember that when you use Apache, it will usually try to log in using its username, www-data.

  • in /etc/postgresql/8.4/main/pg_hba.conf, find the line that reads:

    local all all ident

This should be the second uncommented line in your default config. Change ident to md5:

local all all md5

  • You will need to restart PostgreSQL:
   sudo service postgresql restart
  • Create a PostgreSQL user for your SMArt service, e.g. "smart" and setup a password
 sudo su - postgres
 createuser --superuser smart
 psql
 postgres=# \password smart
 postgres=# \q
 
  • Create the Databases and make the smart user their owner.
 createdb -O smart smart
 createdb -O smart rxnorm
 exit
 

Install openrdf-sesame (and tomcat)

  • get Tomcat and OpenRDF-Sesame:
 sudo apt-get install tomcat6
 wget http://downloads.sourceforge.net/project/sesame/Sesame%202/2.4.0/openrdf-sesame-2.4.0-sdk.tar.gz
  • install OpenRDF Sesame as a Tomcat web application
 tar -xzvf openrdf-sesame-2.4.0-sdk.tar.gz
 sudo mkdir /usr/share/tomcat6/.aduna
 sudo chown tomcat6.tomcat6 /usr/share/tomcat6/.aduna/
 sudo cp -r openrdf-sesame-2.4.0/war/* /var/lib/tomcat6/webapps/
  • restart Tomcat (optional since autoDeploy is typically enabled in Tomcat by default)
 sudo /etc/init.d/tomcat6 restart

The OpenRDF store doesn't support access control. You will probably want to limit access to just localhost. To limit servlet access to localhost, make two tomcat configuration changes:

    /var/lib/tomcat6/conf/context.xml
    <Context>
    +  <Valve className="org.apache.catalina.valves.RemoteHostValve" allow="localhost"/>

    /var/lib/tomcat6/conf/server.xml
    <Connector port="8080" protocol="HTTP/1.1"
    +          enableLookups="true"

You'll need to restart Tomcat again if you make these changes

Download, Install, and Configure SMArt Backend Server

  • Install GIT
     sudo apt-get install git
  • get the code
 git clone https://github.com/chb/smart_server.git
 cd smart_server
 git submodule init
 git submodule update
 
  • copy settings.py.default to settings.py and update it:

    • set DATABASE_USER to the username you chose, in this documentation smart, and set DATABASE_PASSWORD accordingly.
    • set APP_HOME to the complete path to the location where you've installed smart_server, e.g. /web/smart_server
    • set SITE_URL_PREFIX to the URL where your server is running, including port number e.g. http://localhost:7000
    • set SMART_UI_SERVER_LOCATION to the URL where your UI server will be running, including port number e.g. http://localhost:7001
  • copy bootstrap_helpers/application_list.json.default to bootstrap_helpers/application_list.json and customize to include the apps you want.

  • set things up (supplying the smart db password when prompted a few times)

 ./reset.sh
 

NOTE: On the first run of reset.sh, you will also see some 500s. Don't worry about them. When the reset process completes, you should see:

   ...
   No fixtures found.
   

This is normal -- nothing has gone wrong.

IMPORTANT: if you've enabled apps that are part of the sample apps below, you should wait to run reset.sh until you've got the sample apps server running. The SMArt Reference EMR attempts to download the apps' manifest files, and if they're not available over HTTP, reset.sh won't complete successfully. If you mistakenly run reset.sh before setting up the SMArt Sample Apps, don't worry, just set up the SMArt Sample Apps server, and run reset.sh again.

Download, Install, and Configure SMArt UI Server

  • get the code
 git clone https://github.com/chb/smart_ui_server.git
 cd smart_ui_server
 git submodule init
 git submodule update
 
  • copy settings.py.default to settings.py and update:
    • set SMART_UI_BASE to the complete path to the location where you've installed smart_ui_server, e.g. /web/smart_ui_server
    • set SMART_SERVER_LOCATION, CONSUMER_KEY, CONSUMER_SECRET appropriately to match the SMArt Server's location and chrome credentials. (Check your bootstrap.py within smart_server for those credentials. If you change them, you'll need to run reset.sh again on the SMArt server. If you never changed bootstrap.py, then your CONSUMER_KEY and CONSUMER_SECRET are both chrome, and you don't need to change their value in the UI server default settings file.)

Download, Install, and Configure SMArt Sample Apps

  • get the source code
 git clone https://github.com/chb/smart_sample_apps.git
 cd smart_sample_apps
 git submodule init
 git submodule update
  • copy settings.py.default to settings.py and update:
    • set APP_HOME to the complete path to the location where you've installed smart_sample_apps, e.g. /web/smart_sample_apps
    • set SMART_SERVER_PARAMS to point to the location of the SMArt Server. If you are running the SMArt server on localhost:7000 as we suggest, there's no need to change anything.

Generate Sample Patient Records and Load Them in the SMArt EMR

  • get the source code and generate sample data
 git clone https://github.com/chb/smart_sample_patients.git
 cd smart_sample_patients/bin
 python generate.py --write ../test-data/
 
  • Load into SMArt EMR
 cd /path/to/smart_server
 PYTHONPATH=.:.. DJANGO_SETTINGS_MODULE=settings /usr/bin/python \
   load_tools/load_one_patient.py \
   /path/to/smart_sample_patients/test-data/*
 

Expect this to take a few minutes.

#Running the Development Servers

The Django development servers are easy to run at the prompt.

The backend server can run on localhost in the configuration given above:

 cd /path/to/smart_server/
 nohup python manage.py runconcurrentserver 7000 > /dev/null 2>&1 &

The UI server, if you want it accessible from another machine, needs to specify a hostname or IP address. If you want port 80, you need to be root of course. The mask "0.0.0.0" will allow all incoming connections:

 cd /path/to/smart_ui_server/
 nohup python manage.py runconcurrentserver 0.0.0.0:7001 > /dev/null 2>&1 &

And finally, the Sample Apps:

 cd /path/to/smart_sample_apps/
 nohup python manage.py runconcurrentserver 0.0.0.0:8001 > /dev/null 2>&1 &
  • Note: In the above examples the console output is suppressed. If you are having trouble with the server, you may want to redirect the output to the console or a log file.

#The SMArt EMR is now at: http://localhost:7001/login

About

SMArt Bootstrap Server

Resources

License

Stars

Watchers

Forks

Packages

No packages published