Oscar guru David Daley has an excellent 'how to' for doctors that want to set up OSCAR EMR for their clinic.
However, OSCAR is constantly being updated and improved upon. New features are being added, and bugs fixed by a small army of volunteer and professional programmers around Canada (and the world). The fantastic thing about open source is that when a family doctor in Saskatoon adds a new feature, it can become available to everyone else who uses OSCAR. The code for OSCAR is stored in a repository which is constantly updated.
To take advantage of the latests stable version of OSCAR, you can upgrade your system for free. Here's how.
Notes:
i. This how to assumes that you have installed using the settings and locations in David Daley's how-to which I have cribbed from here to create the update how-to).
ii. I use vi ‘vi’ as my text editor, but it is not for everyone. If you want to use another editor, replace ‘vi’ in the commands that follow with, for example, nano.
Log into your server using terminal.
Backup your server (if the update goes horribly wrong, it is essential that you can roll back your server to what you had before).
Change to your backup folder.
cd /usr/local/backups
We're going to create a backup script to totally backup your oscar installation, so open a new file:
sudo vi extendedBackupOSCAR.sh
Enter the following text and save the file:
#!/bin/sh -e
#set the backup directory name
installation=oscar
backup=/usr/local/backups
mysql_root_password=*******
oscarname=extended.$installation.backup
backupdir=$backup/$oscarname-`date +%F`
#create the backup directory
mkdir $backupdir
#dump the mysql data into the backup
sqlname=$oscarname.sqldump.`date +%F`
/usr/bin/mysqldump --add-drop-table -uroot -p$mysql_root_password oscar_mcmaster > $backupdir/$sqlname.sql
gzip $backupdir/$sqlname.sql
#tar the oscar server
tarname=$oscarname.webapps.`date +%F`
tar -cf $backupdir/$tarname.tar /usr/share/tomcat5.5/webapps
gzip $backupdir/$tarname.tar
Run the script:
sudo ./extendedBackupOSCAR.sh
Now transfer the backup files you just created to somewhere safe (make sure that they are stored encrypted and/or securely as they contain all your patient information).
Update the source code on your system
We are going to update to OSCAR 9.05 in this example (by setting the date for 31 May 2009).
cd $HOME/src/oscar_source
cvs -d:pserver:anonymous@oscarmcmaster.cvs.sourceforge.net:/cvsroot/oscarmcmaster login
(you will be asked for a password, you can leave this blank).
cvs -z3 -r -d:pserver:anonymous@oscarmcmaster.cvs.sourceforge.net:/cvsroot/oscarmcmaster co -r RELEASE_9_06 oscar_mcmaster
cvs -z3 -d:pserver:anonymous@oscarmcmaster.cvs.sourceforge.net:/cvsroot/oscarmcmaster co -P -D "2009-07-20 23:59:59" drugref
cvs -d:pserver:anonymous@oscarmcmaster.cvs.sourceforge.net:/cvsroot/oscarmcmaster logout
Wait for the files to download, then compile the new version of the software.
cd $HOME/src/oscar_source/oscar_mcmaster/build
ant
Once the build is finished (you should get a 'Build Successful' confirmation message), transfer ONLY the updated oscar.war file to your tomcat server:
**WARNING! copying all the .war files over (ie: including the OscarDocument.war file) will delete all of you uploaded documents such as scanned results and old charts.**
sudo cp $HOME/src/oscar_source/oscar_mcmaster/build/tmp/oscar.war $CATALINA_HOME/webapps/
and restart the tomcat server
sudo /etc/init.d/tomcat5.5 restart
Update the MySQL database
Now you need to update your MySQL database with any changes that have taken place since the last update.
First, we move to the oscar mysql updates directory and list all the MySQL update files:
cd $HOME/src/oscar_source/oscar_mcmaster/database/mysql/updates
ls -l
We need to run all the files ending in .sql which have a file name with a date BETWEEN the last installation date and our chosen update date. Run them in date order (oldest first).
(Replace ****** in the following with your MySQL root password.)
mysql -u root -p******** oscar_mcmaster < update-YYYY-MM-DD.sql
Then, we do the same with the caisi mysql updates directory and list all the MySQL update files:
cd /home/robbie21/src/oscar_source/oscar_mcmaster/database/mysql/caisi/updates/
ls -l
Again, we need to run all the files ending in .sql which have a file name with a date BETWEEN the last installation date and our chosen update date. Run them in date order (oldest first).
(Replace ****** in the following with your MySQL root password.)
mysql -u root -p******** oscar_mcmaster < patch-YYYY-MM-DD.sql
Update the DrugRef database
Delete the old drug ref folders and replace them with the new ones:
sudo rm -R /usr/local/DPD
sudo rm -R /usr/local/drugref-ca_1_5
sudo mkdir /usr/local/DPD
sudo mkdir /usr/local/drugref-ca_1_5
sudo cp $HOME/src/oscar_source/drugref/drugref2/DPD/* /usr/local/DPD
sudo cp $HOME/src/oscar_source/drugref/drugref2/drugref-ca_1_5/* /usr/local/drugref-ca_1_5
sudo chown -R postgres:postgres /usr/local/DPD
sudo chown -R postgres:postgres /usr/local/drugref-ca_1_5
Now change users to the postgres user:
su - postgres
Run postgresql and elete the old drug ref database
psqlwhich will bring up the postgresql prompt 'postgres=# '
drop database drugref2;and you should get back the confirmation 'DROP DATABASE'.
Quit out of postgresql:
\qOnce back at the normal command line, move to the new drug ref folder.
cd /usr/local/DPD
Make the scripts executable:
chmod +x create_database.sh
chmod +x import_dpd.sh
And run the scripts to create the new database. The second command will download the latest drug database from Health Canada. This import script will take some time, so be patient (a good time to get a fresh coffee). You can ignore the ERROR: table "*****" does not exist CREATE TABLE messages.
./create_database.sh
./import_dpd.sh
We need to add a new first line to the DrugRef calling program to compensate for a python issue.
First, edit the file:
vi /usr/local/drugref-ca_1_5/drugref_service.py
And now add as the very first line (including the hash # sign):
# coding: latin-1
Save that file, and then exit from the postgres user account.
exit
That's it!
Check everything is working by logging into OSCAR.
That's it!

