Skip to content

Installation v6.22 (2022 Reporting Period)

peter li edited this page Dec 6, 2022 · 13 revisions

These instructions are for installing the version 6 of popHealth in a production like environment. The instructions are based on installing from the v6.2 branch of the popHealth repository.

You will need an NLM VSAC account to download the 2021 measure bundle and value set definitions for 2022 reporting period. You can sign up for an NLM VSAC account at https://uts.nlm.nih.gov/home.html (click the "Sign Up" link in the upper right corner of the page.)

The instructions assume that a system user named 'pophealth' wants to install the app in their home directory, i.e., /home/pophealth. This is not a requirement; any user with sudo privileges can install pophealth. Just be sure to adjust the directory paths in the commands below. Also, make sure to update your /etc/hosts file to include the line

127.0.1.1    my-machine-name

else, you might receive "sudo: unable to resolve host my-machine-name” warning when running sudo commands.

1. Installing Ubuntu

The ISO for ubuntu 18.04 LTS can be downloaded from the following URL: http://releases.ubuntu.com/xenial/

These instructions were developed against the "64-bit PC (AMD64) server install CD" (ubuntu-16.04-server-amd64.iso).

Installing Ubuntu is a fairly straight-forward process, but for more details on installing Ubuntu please visit the following URLs:

Graphical install using the desktop CD: https://help.ubuntu.com/community/GraphicalInstall

Installation using the Alternate CD (more configuration options): https://help.ubuntu.com/18.04/installation-guide/index.html

Once Ubuntu has been installed you need to update the software on the computer using Apt. Apt is a software package management system used by Ubuntu. Note: the last command in the group below is only necessary if any packages were actually upgraded.

sudo apt-get update
sudo apt-get -y upgrade
sudo reboot

2. Configure Proxy Settings

This step is only required if the server you are installing popHealth onto needs to go through an HTTP proxy server to reach the internet. These steps will ensure that the appropriate proxy settings are in place for every user that logs into the system.

Use your favourite text editor to create a file in /etc/profile.d named http_proxy.sh with the following contents. In the sample below, replace your.proxy.host.com with the fully-qualified host name of your proxy server, and your.proxy.port with the port number that the proxy server uses.

# Set up system-wide HTTP proxy settings for all users
http_proxy='http://your.proxy.host.com:your.proxy.port/'
https_proxy='http://your.proxy.host.com:your.proxy.port/'
export http_proxy https_proxy

Set proper permissions on the new file, and load the settings into the current environment. NOTE: the proxy settings will automatically be loaded when a user logs in, but we are manually loading them here, to avoid having to log out and log back in again.

sudo chmod 0644 /etc/profile.d/http_proxy.sh
source /etc/profile.d/http_proxy.sh

Make sure that the sudo command will allow the new proxy settings to be passed to commands it launches. This is done by using your text editor to create a file in the /etc/sudoers.d directory named http_proxy (no extension) with the following contents:

# keep http_proxy environment variables.
Defaults env_keep += "http_proxy https_proxy"

Set proper permissions on the new file:

sudo chmod 0440 /etc/sudoers.d/http_proxy

3. Installing Mongo DB version 3.4.24

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt update
sudo apt-get install -y mongodb-org=3.4.24 mongodb-org-server=3.4.24 mongodb-org-shell=3.4.24 mongodb-org-mongos=3.4.24 mongodb-org-tools=3.4.24
sudo systemctl enable mongod

Update mongod.conf to eliminate Mongodb error of: "BSONObj exceeded maximum nested object depth: 200"

wget https://raw.githubusercontent.com/projectcypress/cypress-recipe/cypress_v5/files/default/mongod.conf
sudo cp mongod.conf /etc
sudo systemctl start mongod

You may have problems with the installation of libssl 1.0.0, if you do, follow this:

Edit the source list sudo nano /etc/apt/sources.list to add the following line:

deb http://security.ubuntu.com/ubuntu xenial-security main

Then

sudo apt update
sudo apt install libssl1.0.0

Then reinstall mongo using

sudo apt-get install -y mongodb-org=3.4.24 mongodb-org-server=3.4.24 mongodb-org-shell=3.4.24 mongodb-org-mongos=3.4.24 mongodb-org-tools=3.4.24
sudo systemctl enable mongod

If Mongo when starting gives you an error “Couldn't connect to server 127.0.0.1:27017” it might be related that it didn't create the “data/db” folder, follow this:

sudo mkdir -p /data/db

Then just restart the service

sudo systemctl start mongod

4. Installing RVM and Ruby 2.6.3

RVM is a system that allows managing different versions of Ruby.  It will allow the correct version of ruby to be easily installed on the system. Ruby is the development language used for the popHealth application.

First we will need to install some dependencies:

cd ~
sudo apt-get install build-essential openssl libssl-dev libreadline-dev curl zlib1g zlib1g-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion pkg-config unzip

Next install RVM. This will install RVM for all users

sudo gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL get.rvm.io | sudo bash -l -s stable

NOTES: In case the last command fails, we need to find alternative keys for this. This one worked for this tutorial on the current date:

curl -sSL https://rvm.io/pkuczynski.asc | sudo gp g2 -import

Then install rvm normally:

curl -sSL get.rvm.io | sudo bash -l -s stable

Next source the RVM environment so we can use it here:

rv

Log out, and then log back in again so that the settings RVM installs will be loaded in your environment. Once you have logged back in, run the following commands. These will install some more dependencies.

We will install these dependencies using an admin console. The admin console can be opened with the following command and run each command individually:

sudo -i
rvm autolibs enable
rvm install 2.6.3
rvm --default 2.6.3
gem install bundler
exit

setup rvm for the admin user:

source /etc/profile.d/rvm.sh
rvm use 2.6.3
rvm --default 2.6.3

*****NOTE: If the above path (/etc/profile.d/rvm.sh) does not exist, try replacing it with: ~/.rvm/scripts/rvm *****

5. Check MongoDB

MongoDB is the database used by popHealth. Run the command below to test connection. If the command exits with a error about not being able to connect, then reboot, and log back in as the admin user. Sometimes mongodb fails to create a network socket when it is started immediately after installation. It should automatically start when the system is rebooted.

mongo

This should output MongoDB shell version: 3.4.x

Note that the version should read 3.4.10.

Type 'exit' to exit the mongo shell

exit

6. Downloading PopHealth source code

Downloading the pophealth source code from github. The following commands assume that your current directory is located at /home/pophealth

git clone https://github.com/worldvista/popHealth.git -b v6_22 popHealth
cd popHealth

Install popHealth and all its dependencies:

bundle install

Install nodejs v10.x and bower

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install -g bower
rm -rf vendor/assets/components/*
bower install

NOTES: If when you run this command - "sudo apt-get install npm", and it gives you "the following packages have unmet dependencies ubuntu", you should continue with the next command (first verify that npm was installed running npm on terminal)

7. Import the measure bundle

popHealth releases measure bundles that contain the measure artifacts that are needed to begin the measure calculation process:

In addition to the measure bundle, the value sets need to be loaded into popHealth from the NLM VSAC Service. You will need an NLM account in order to complete this step and load value sets from the VSAC service._ Register for an account at: https://uts.nlm.nih.gov/home.html. Note that starting Jan 2021, NLM VSAC changed their user authentication process to use API key. You can find the API key in the ‘My Profile’ area after signing in. In the following command where you are asked to input the NLM VSAC credential, please use the API key in lieu of the password.

Run the following command to download and install the measure bundle

bundle exec rake pophealth:download_update_install version=2021 RAILS_ENV=production

Note that if you are working with the certification body such as InfoGard, please make sure to ask which measure bundle is used to generate the Cypress test deck. The CQM may not calculate correctly if there is a bundle mismatch.

After executing the above command, make sure that the following responses are displayed on the screen to show that the measure bundle is installed without any issue.

Bundle import successful Cleaning out records and caches

8. Setup ECQM-Execution-Service

The ecqm calculation is performed by the Project Cypress component called ecqm-execution-service. To install this component, run the following commands.

git clone https://github.com/projecttacoma/cqm-execution-service.git -b cypress_v6

cd cqm-execution-service/

node –v  (Make sure Node version is ^10.0.0)

npm install

npm start  (this runs the node service as a shell process)

In production we would run the service in a docker container - see the https://github.com/projecttacoma/cqm-execution-service readme to install the docker based service)

9. Creating an administrator user account

To create the default admin user account, run the following command:

bundle exec rake admin:create_admin_account RAILS_ENV=production

Default Username: pophealth, Password: pophealth

You can change the account password once you log in and go to the 'Edit Account' page from the top right menu.

10. Precompile Assets

To set up the asset pipeline and make sure all the images and fonts are included, run the following from the application directory

rake assets:precompile RAILS_ENV=production RAILS_RELATIVE_URL_ROOT=/home/pophealth/popHealth

11. Configure Startup Processes

Please note that the following scripts from step 11 to 13 assumes that the pophealth code are located at /home/pophealth/popHealth and that the Linux account user is "pophealth". Please modify the script accordingly if the code are placed at a different location or if the user account name is not "pophealth"

Configure delayed job to start up on server startup. At this point, you should still have a shell open as the pophealth user:

cd ~
echo -e '#!/bin/bash\ncd /home/pophealth/popHealth\n. /usr/local/rvm/scripts/rvm\nbundle exec rake jobs:work RAILS_ENV=production\n' > start_delayed_job.sh
chmod +x start_delayed_job.sh

cat << DELAYED_WORKER_END | sudo dd of=/etc/systemd/system/pophealth_delayed_worker.service
  [Unit]
  Description=delayed_worker
  After=mongod.service
  Requires=mongod.service

  [Service]
  Type=simple
  User=pophealth
  WorkingDirectory=/home/pophealth/popHealth
  ExecStart=/home/pophealth/start_delayed_job.sh
  TimeoutSec=120

  [Install]
  WantedBy=multi-user.target
DELAYED_WORKER_END     

You will then need to start and enable the service:

sudo systemctl enable pophealth_delayed_worker
sudo systemctl start pophealth_delayed_worker

Run the following command to make sure that the pophealth_delayed_worker is running

sudo systemctl status pophealth_delayed_worker

You should see the text "active (running)" in the returned message.

12. Configure Passenger / Apache

Install apache and passenger with the following commands:

sudo -i
apt-get install apache2=2.4.*
gem install passenger -v '5.3.7'

These should be the dependencies required for passenger:

apt-get install libcurl4-openssl-dev apache2-dev libapr1-dev libaprutil1-dev libssl-dev

Update the site configuration with (please note that the script below assume that the pophealth code is installed on /home/pophealth/popHealth):

cat << POPHEALTH_SITE_END > /etc/apache2/sites-available/pophealth
 <VirtualHost *:80>
   PassengerRuby /usr/local/rvm/wrappers/ruby-2.6.3/ruby
   DocumentRoot /home/pophealth/popHealth/public
   TimeOut 1200
   <Directory /home/pophealth/popHealth/public>
      AllowOverride all
      Options -MultiViews
      Require all granted
   </Directory>
  </VirtualHost>
POPHEALTH_SITE_END

Make the default apache site be the pophealth provided content:

rm /etc/apache2/sites-enabled/000-default*
ln -s ../sites-available/pophealth /etc/apache2/sites-enabled/000-default.conf

Update the apache configuration with the following commands:

cat << POPHEALTH_MOD_END > /etc/apache2/conf-available/pophealth
SetEnv SECRET_KEY_BASE `cat /dev/urandom | env LC_CTYPE=c tr -dc 'a-e0-9' | fold -w 64 | head -n 1`
POPHEALTH_MOD_END

ln -s /etc/apache2/conf-available/pophealth /etc/apache2/conf-enabled/pophealth.conf

cat << PASSENGER_CONF_END > /etc/apache2/mods-available/pophealth.conf
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.6.3/gems/passenger-5.3.7/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
   PassengerRoot /usr/local/rvm/gems/ruby-2.6.3/gems/passenger-5.3.7
   PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.6.3/wrappers/ruby
</IfModule>
PASSENGER_CONF_END

ln -f -s /etc/apache2/mods-available/pophealth.conf /etc/apache2/mods-enabled/pophealth.conf

Install the apache passenger module.  If you need other dependencies, the installer will tell you:

passenger-install-apache2-module

At the end of the installation, you should see a line that says: Everything looks good. :-)

Restart apache:

service apache2 restart

Exit the root shell:

exit

To open the popHealth web app you'll need the server IP address. Open a web browser and enter

http://<server_ip_address>/

13. Importing test patients

There are two methods for importing patient data into popHealth - manual upload of patient file via the popHealth UI or patient API upload via http post. For testing purpose, you can download a test QRDA CAT I patient zip file derived from the Cypress tool version 6.3 and manually import the zip file using the popHealth administrator user interface. The Cypress test patient zip file can be accessed from

https://github.com/worldvista/cqmtest/raw/master/cypress6.30

Unzip the patient zip file. You will find a series of zip files for each of the measures used for the Cypress attestation. To import, login into the popHealth application. The import function is located under the Administrator->Patients menu at the top right corner of the user interface. Assuming that you are using the "Multiple Practice" mode, first create a practice, then select the newly created practice when importing a specific patient zip file for a given measure. Wait for the import process to complete, i.e., the number of patients stop incrementing. To perform the CQM calculation, go to the Administrator->Providers menu, and select the practice provider. This will take you to the CQM dashboard. Select reporting period from 1-1-2022 to 12-31-2022 (default) and the measure associated with the patient files to perform the eCQM calculation. You can find the measure quickly by typing the measure, i.e., cms9 in the "measure or group title" input box on the left side panel.

Clone this wiki locally