The original drugref web site appeared to go dormant around 2007. The domain appears to still be registered: http://www.robtex.com/dns/drugref.org.html

Background information on the what the project intended remains web-accessible at:

The intended benefits of drugref included:
  • integrative high level generic API over several different data sources
  • combining of several data sources into a larger whole such that the lack in one can be augmented by another

We can see how "a" drugref may be useful by examining a mosaic of available DrugDatabases:
  • the French data do not contain any Defined Daily Dose (DDD)
  • the WHO data does not contain any brand names or product manifests or interactions
  • the Oscar implementation of drugref contains both Canadian DPD data and Crowther / Holbrook interaction data from the publication by these authors
  • if the French data would be augmented with ATC via the INN, a more expansive "drugref" could combine that with WHO DDD and Canadian product manifests and Oscar interactions.

How might a drugref-like service be most optimally used?
  • for purposes of speed and reliable access, a praxis which uses GNUmed may rather install drugref locally
  • drugref would be instantiated separately from GNUmed
  • GNUmed clients would post requests to drugref
  • we only just need a suitable interface to drugref, even just a command line interface

A - drugref structure and function
B - drugref content

A - whoever would install drugref locally would
i) install a particular version of the drugref database
ii) install a particular version of the drugref server software
iii) install a particular version of the drugref interface software (of which more than one interface could exist)

- the last above would involve a GNUmed client plugin interface, stored and maintained with the GNUmed project despite that there may exist some drugref interface permitting access to the drugref software independently of GNUmed

With regard content, the ability to easily import country-specific drug data into the locally installed drugref will depend on the compatibility of the form in which the source data is provided (which can change over time) and also the version of the drugref database. Therefore before trying to reimport or "refresh" what is in one's local drugref, it would be important to know if there existed any change to the form in which the source data was being provided...

... so while each praxis could figure this out, this would then have to be done by each praxis, whether using Oscar or GNUmed or other EMR within any one country (or source of data, internationally). This would make it more sensible to co-ordinate any "import and/or refresh" scripts through a centrally-maintained drugref project which organizes such scripts per-source.

There is a possibility that a project like FreeDiams could become the new drugref.

Drugref in Oscar

The original drugref involved a postgres database, python XML-RPC API, and php interface:

Oscar McMaster EMR reworked drugref into (what they refer to) as drugref2:
  • Oscar never did use the PHP interface (meant for maintaining a monolithic database)
  • Oscar originally imported Canadian DPD data into the original drugref schema, but found this slow
  • subsequently let Canadian DPD data imports persist (as imported) in additional tables and added (a python?) DPD plugin to supply needed server-side data to the API (versioned in the oscar cvs hosted on sourceforge, but hosted for the most part on savannah at the above link?)
  • added tables to speed searching
  • imported later-acquired Holbrook interactions data
  • ported to mysql
  • in 2009
    • made a java version of the API (as an alternative to the pythonic API)
    • implemented the database layer in JPA (Java Persistence API), which has made it easier to support both Postgresql and Mysql
    • http://code.google.com/p/drugref2/source/checkout
    • you can run the java drugref webapp on-top of an existing postgresql drugref database and it works
  • more at


looking for the state of open source drug databases and came across a 
supposedly open source drug database from e-md and Oscar's drug database.

Here are some pointers.

1) http://www.e-mds.com/solutions/drug_database/drugdb.html
2) http://www.oscarcanada.org/oscar-users/drugref

Snippets from the Oscar list below.

Health Canada's database specifies certain Latin characters to designate certain dosage formats, which creates a mismatch if using UTF-8.
I am trying to setup Oscar on my laptop using the published
installation guide - everything goes well until I get to the step in
postgres DB: "./create_database.sh" where I consistently get the
character code error message: encoding LATIN1 does not match my
server's locale setting UTF8.  I understand that this is a postgres
"thing". How do I get past it? Do I have to change my locale
settings specifically for postgres and if so, how?

I think I may have run into this when trying out DrugRef. I actually
changed the create_database.sh line so that it specified a utf8
encoding instead of a latin1 one: 

   createdb --encoding utf8 drugref2

I don't know whether this is safe or not (I have suspicions that it is
not, because my DrugRef behaviour was kind of crazy.) 

I also changed drugref_service.py to reflect a utf8 encoding.

# coding: utf8

This was on Debian, not on Ubuntu, but I am guessing the behaviour is
This could be set in your /home/USER/.profile or /root/.profile file do
the following in /etc

grep LC_ALL *

this will let you know in what file this variable is set in.

Mine is in csh.login, but I am slackware user and it maybe different in

lots of info on environment variables in ubuntu is here:

There has been many questions about installing drugref2 database, so I updated oscarmanual.org with a more detailed guide on installing drugref2, thanks to Randy and Peter. 
It can be found at this page:

to upgrade the python based Drugref1.5/2 you need

1) to install and learn another versioning system ...... done (luckily its easy)
2) to download the Drugref2 code from a separate repository..... done
2) to install and learn Maven (which might depend on python) .... done
(install done not the learn part)
3) to build Drugref2....  done
4) I presume dump drugref2-1.0-SNAPSHOT.war where Tomcat will find it
and decompress the war... done
5) I presume leave the Postgres database alone... done
6) I presume disable/delete the Python based existing Drugref .... done
7) open http://localhost:8180/drugref2-1.0-SNAPSHOT/ to check that the
JSP opens.... done

but that doesn't seem to be enough

A couple of steps you didn't mention are:

1) edit drugref.properties to point to your drugref database.  This file is found in drugref2/src/main/resources

2) create an  empty database

3) in a browser run https://youripaddr:port/drugref2-1.0-SNAPSHOT/Update.jsp
   This step will take upwards of 30mins or more to complete.  It creates and populates drugref's tables

You might want to increase the memory java has available before doing this as I've run into heap space errors.
So adding this to tomcat's startup.sh should work:

export JAVA_OPTS="-server -Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true"

4) If you do not have a normal connector, i.e. non-ssl, in tomcat's server.xml file, add one.  Here's an example of one I used:

<Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />

5)  Change the drugref_url property in the oscar.properties file to use the new drugref

drugref_url = http://localhost:8080/drugref2-1.0-SNAPSHOT/DrugrefService

To upgrade the python based Drugref1.5/2 to the new javabased Drugref2
that is supported by Oscar 9.12
(rough howto)

1) Install and learn another visioning system: Mercurial (luckily its easy)
2) to download the Drugref2 code from a separate repository
3) to install and learn Maven which for Ubuntu or Debian is a simple
apt-get install Maven2
or similar
4) to build Drugref2: navigate to the drugref2 directory that you downloaded and
mvn clean install
5) Change or adjust memory settings for Java to allow for the
increased load.  Not so surprising if you follow this howto and
install on the same machine that is serving Oscar your JVM will be
sucking back 800 Mb of memory, 500 of it Heap.
JAVA_OPTS="-Xmx2048m -Xms1024m -XX:MaxPermSize=512m"
which could be a line in  /etc/default/tomcat5.5 but this is variable
6) using your own username and password for mysql
mysql -uusername -ppassword
mysql>create database drugref;
7) create a unencrypted http connector in Tomcat if you don't already have one
typically port 8080 or 8180
8) copy the drugref2.war from (4) to where Tomcat will find it (ie in
the webapps folder)
and decompress the war
9) now that Tomcat has extracted it navigate to
cd /usr/local/tomcat/webapps/drugref2/WEB-INF/classes/
and vi or nano drugref.properties
adjusting the db_user and db_password to match what you used in (6)
above to create the drugref schema
10) restart drugref2 (or restart Tomcat, or restart your computer)
11) open http(s)://yourtomcatip:port/drugref2 to check that the JSP loads
12) open http(s)://yourtomcatip:port/drugref2/Update.jsp to allow the
schema to populate with tables and data
13) Stare at "Updating Drugref Database!"
14) repeat step 13
15) if you get tired you can
mysql -uusername -ppassword drugref
mysql>show tables;
if you get 15 rows of table names you are still on the right track
16) vi or nano your oscar.properties
comment out your current drugref url by placing a # mark ahead of the line
#drugref_url = http://localhost:8001
drugref_url = http://yourtomcatip:port/drugref2/DrugrefService
it should look something like
drugref_url = http://localhost:8180/drugref2/DrugrefService
17) restart Oscar (or Tomcat or your computer). (yeah it would seem
more efficient to do 17 when you do 10 but trust me, it doesn't work
unless it is done sequentially)


I'm trying to install drugref, using the instructions from McMaster (http://it.oscarmcmaster.org/howto-s/setting-up-drugref-on-ubuntu-version-2) for "Setting up DrugRef on Ubuntu Version 2", however, the setup fails on Ubuntu 8.04, as the installation fails on the LATIN1 encoding:

"createdb: database creation failed: ERROR:  encoding LATIN1 does not match server's locale en_CA.UTF-8"

I was able to get this sub-system up and running... there was a couple of weirdisms that I had to work around, and I will document the process with more details & explanations in due course... but here is the quicky

the first weirdism is that the default locale for my server was picked up and used with the base postgresql 8.3 installation on ubuntu 8.04, and thus broke the drugref installation due to it needing LATIN1

thus, the fix is to install after overriding the locale in the shell:

export LC_ALL=C

sudo apt-get install postgresql-8.3

sudo apt-get install python-pgsql

unset LC_ALL

The second weirdism cames from python -- to get around it, I needed to add to first line of "drugref-ca_1_5/drugref_service.py" 

# coding: latin-1

Including the '#' (see: http://www.python.org/dev/peps/pep-0263/ for more details)

The tricky bits for getting the drug database running wasn't too bad because there isn't many moving parts that can go awry...

the first trick was ensuring the LATIN-1 support was enabled in the PostgreSQL database, but if you didn't get errors complaining about LATIN-1 when you ran the "import_dpd.sh" script, then you jumped that hurdle...

the next trick was to make sure that you installed the drugref database when you were logged in as the "postgres" user... if you ran the command (su - postgres) before you  created and imported the database, then that shouldn't be a problem either...

I'm suspecting that maybe the postgres processes aren't running on your machine...

My instructions creates a log file for DrugRef which you should be able to read via the command:
 "more /usr/local/drugref-ca_1_5/drug.log"

make sure that the "postgres" processes are actually running on your machine:

   ps -ef | grep postgres 

On 5-Dec-08, at 7:29 PM, David Daley wrote:

In your oscar*.properties file... is the drugref stuff enabled?

# DrugRef server
drugref_url = http://localhost:8001

That was it!  The config file was set up for some foreign IP address.   
Switched it to localhost (surely should be the default!) and restarted  
tomcat and I now have a fully functioning drug database.


I'm looking through the code and my comprehension of the drugref/drugs table right now is approximately as follows :

cd_drug_search.id = drugId which is an auto_increment style column

drugId = drugs.gcn_seqno

drugs.gcn_seqno is the only "id" style column identifying the drug (ignoring the human readable descriptions etc)

If the above is true, that means the gcn_seqno is for the most part useless in terms of finding out which drug is being to refered to right? because the number can change depending on the drug ref installation and or possibly updates to the rows in the drug ref installation right?

am I also correct in that the drug_code and din are never stored in oscar anywhere? (with respect to prescriptions / drugs).


The ATC code and the din are stored in the drugs table.   ATC in the ATC column and din in the regional_identifier.  

gcn_seqno shouldn't be used.  

drug_code from health canada isn't used because it might not be consistent between DPD versions.

If the ATC code is different then you'll have to add each one individually. I am surprised to see that there are that many ATC codes for PPI's. MyDrugRef is another Open Source project but any modification would cost money! My daughter was doing all the programming. Maybe I can ask her to look into linking ATC codes together to avoid multiple entries of the same warning.

On Fri, Apr 17, 2009 at 5:16 AM, Dr Page <drpage@shawbiz.ca> wrote:
Was adding some interactions (great feature).
Problem that I encountered was trying to add a warning that "PPI's inhibit activity of plavix"
the PPI's all seem to have similar but different identification numbers (A02BC01/2/3/4/5 etc)
Wonder if there was a way to link the interaction with A02BC0% ?

I found that a few of the lines were mysterious and could have used
more documentation. For example, when installing DrugRef I
accidentally skipped the line 

sudo ln -s /usr/lib/postgresql/8.3 /usr/local/pgsql

which made my install scripts break. 

It may be documenting MyDrugRef and how it relates to DrugRef, if this
is even important. (I am still pretty confused about this area.) 


Subject: [Oscarmcmaster-devel] Now with a solution - Re: oscar/drugref broke
Reply-To: oscarmcmaster-devel@lists.sourceforge.net

ok.... here's the bug... (and the fix) -- who owns this code?

in psql drugref2, you can run the requested command directly:

drugref2=# select pharm_cd_form_code, pharmaceutical_cd_form from cd_form where drug_code = (select drug_code from cd_drug_search where id='19513');


drugref2=# select pharm_cd_form_code, pharmaceutical_cd_form from cd_form where drug_code = (select drug_code from cd_drug_search where id='2488');

ERROR:  operator does not exist: integer = character varying
LINE 1: ...armaceutical_cd_form from cd_form where drug_code = (select ...
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

the fix is (cast the subquery as an integer):

drugref2=# select pharm_cd_form_code, pharmaceutical_cd_form from cd_form where drug_code = cast((select drug_code from cd_drug_search where id='2488') as integer);
 pharm_cd_form_code | pharmaceutical_cd_form 
                 85 | TABLET
(1 row)


On Fri, May 1, 2009 at 12:23 AM, David Daley <davidgdaley@gmail.com> wrote:
A bit more on this adventure...

from the POSTGRES log file (ejected when you click on "update, save & print":

2009-05-01 00:10:03 EDT ERROR:  operator does not exist: integer = character varying at character 116
2009-05-01 00:10:03 EDT HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
2009-05-01 00:10:03 EDT STATEMENT:  DECLARE "PgSQL_08254B4C" CURSOR FOR select pharm_cd_form_code, pharmaceutical_cd_form from cd_form where drug_code = (select drug_code from cd_drug_search where id='2488');

and from Ubuntu's  syslog:

Apr 30 23:28:11 mail jsvc.exec[8705]: 2009-04-30 23:28:11,783 ERROR [MiscUtils:92] Errored Uri=/oscar/oscarRx/writeScript.do 
Apr 30 23:28:11 mail jsvc.exec[8705]: 2009-04-30 23:28:11,783 ERROR [MiscUtils:95] Status Code = 500 
Apr 30 23:28:11 mail jsvc.exec[8705]: 2009-04-30 23:28:11,785 ERROR [MiscUtils:98] javax.servlet.ServletException: JavaClient: XML-RPC Fault #1: org.apache.xmlrpc.XmlRpcException: <class 'libpq.OperationalError'>:ERROR:  operator does not exist: integer = character varying LINE 1: ...armaceutical_cd_form from cd_form where drug_code = (select ...                                                              ^ HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts. 

Subject: [Oscarmcmaster-devel] Postgres not starting properly from rc.local   in Ubuntu 9.04
Reply-To: oscarmcmaster-devel@lists.sourceforge.net

I believe I may have found the problem with my rc.local postgres script not working properly. Aart de Vries posted on 21 May and article on using NetBeans for oscar, and he states: 

In order for Python to start
from rc.local, Ubuntu 9.04 behaves differently than the older versions. You have to precede the
startup-line with &#8220;nohup &#8221;. The full command in /etc/rc.local should be (on a single line):
nohup su c "/usr/bin/python /usr/local/drugref-ca_1_5/drugref_service.py >> /usr/local/drugrefca_1_5/drug.log 2>&1 &" postgres
- the script that one adds to rc.local:

su -c &#8220;/usr/bin/python /usr/local/drugref-ca_1_5/drugref_service.py >> /usr/local/drugref-ca_1_5/drug.log 2>&1 &&#8221; postgres

or the alternative:

su -c &#8220;/usr/bin/python /usr/local/drugref-ca_1_5/drugref_service.py > /usr/local/drugref-ca_1_5/drug.log  &&#8221; postgres

On Tue, Jun 2, 2009 at 11:40 PM, Alen P. <humanmind@gmail.com> wrote:
Thanks for the links. I have two questions:
1. eForm: I added the html and image file. The image does not appear under Form E-Form, Form Library. When I click on form (html name) the html page loads but background form image is not displayed.
2. DrugRef seems to use PostgreSQL. But Oscar uses MySql. Why the two databases? Hasn't anyone ported DrufRef to MySql? This gives me the impression that DrugRef is obselete. 

We decided to use Drugref by collaborating with the drugref.org open source project. The project uses PostgreSQL so we stick with PostgreSQL. The PostgreSQL or MySQL debate seems to stir up debate bigger than religion so we stay clear of it;-)


What is the story about Drugref2
I saw fr. Googledoc there is a drugref2.war and using mysql. Look like it
will be much better to have xxx.py + postgresql. Is there any road map that
I can follow?

Also, I did try download manual install package from sourceforge.net. Even
the createdatabase.sh get error when creating databases. Do you think
setting up a forum can help the project? Since I just frustrated sometimes
since I don't know where to get the info instead asking via this mailist.

Simple story
1. You don't need drugref 2 as the existing drugref will continue to
function in 9_12 and most people are using 9_6 anyway.  The usual IT
caveats apply, it is hard to beat good enough.  Upgrade when you can
make a business case for the risk.
2. If you want the bleeding edge (it is very very pretty, and probably
IS much quicker to write a Rx but I haven't dared put it into
production yet at our shop) then you can install it. I wrote a walk
through (and Jackson kindly simplified it and posted it to


Version of python -- both 2.4 and 2.5 should work.

I ran into issues with postgresql 8.3 as well.

I switched to 8.2 and all is well

I am having the same problem .. i am getting this error ?
:8001... failed: Connection timed out.

did the drugref url change ? or is it still seaton.caisi.ca:8001 ?

I re-installed the latest drugref version from sourceforge.net.


I have installed Oscar on CentOS 5.3 x86 and have the following postgres/python packages installed:


When I run the drugref script, I get the following error in /usr/local/drugref-ca_1_5/drug.log file:

Traceback (most recent call last):
  File "/usr/local/drugref-ca_1_5/drugref_service.py", line 3, in ?
    from pyPgSQL import PgSQL as dbapi
ImportError: No module named pyPgSQL

Do I have to edit the /usr/local/drugref-ca_1_5/drugref_service.py file or am I missing something? 

Any help will be appreciated.
this should help


Shouldn't postgresql-python provide pypgsql? Do we have to build this module on every fedore/redhat/centos installation? 

On Ubuntu, all we need to install are the postgresql-8.3 python-pgsql packages and everything works fine.

Looking at the contents of that package, I don't see the python package pyPgSQL


I don't know if they have an RPM package for this.

Need to install pyPgSQL and also need to modiy the configuration file (setup.xx) to run through it.

For interactions,is it possible to incorporate the &#8220;allergy classes&#8221; into MyDrugRef??
Unless it has changed, to warn of an interaction between a PPI and Plavix, one had to enter each PPI individually.
I think that they all fit in the therapeutic class &#8220;Proton pump inhibitors&#8221;.
The issue will likely arise with the penicillin interactions as well.
My Drug Ref is an amazing tool- I just need more time to populate it!

The drug tables are in the Postgres tables within the drugref module (which is in Python, not Java).

On Tue, Oct 27, 2009 at 2:22 PM, Santiago Dejo wrote:
In Argentina virtually all the prescriptions must be handwritten!! A
hughe waste of time....The Health System is divided into 3 main
sectors: public, social security (a lot of distinct entities), and
prepaid system (a lot of disitnct entities)....each with its own
rules, forms, recipes....Sometimes I think I will not live long enough
to see a system like yours...Anyway the prescription module can be
useful to record/statistical analysis, etc..

I can get drug tables from Argentina, but I don't know how to insert
them into oscar rx. I was planning to add/alter data from the canadian
drug table but I couldn't find the drug tables that oscarrx use.
Does anyone know how up-to-date the data in the drug database (DrugRef) is and how often is it updated? Also, once the DrugRef database has been populated the first time, how do we make sure the data is constantly updated with the latest drug data? Any tips/pointers would be appreciated.

There is a script you can run. I think the drugref.org is down forever. Maybe jay can check with Horst in Australia to get the scoop?

To my knowledge there is no script written to update Drugref (I asked
for one from Oscar Service when they did my install but they didn't
have one apparently, perhaps another service provider has something),
best to delete and recreate from scratch with the install script
periodically (How often is a perceptive question as the database gets
updated at Health Canada continuously, and updating always risks
breaking something that was working.  Having the chemist call you to
say that the drug is off the market or not finding the latest and
greatest is an indication to rerun the script).  Step by step, which
you could turn into a script if you really want to:

Delete the old install script and replace them with the new ones from source:

   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

Change users to the postgres user:

   su - postgres

Run postgresql


which will bring up the postgresql prompt 'postgres=# ' and delete the
old drug ref database

   drop database drugref2;

Quit out of postgresql:


Once 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.


David Daley suggests 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.



When browing around sniffing for open-source EMR packages to evaluate, I
found Oscar a couple of days ago, and I finally got it up and running
today for a quick testrun. And I must say that I'm extremley impressed
by it so far. However, I'm trying to find the drugref web-service and
database, but the links that can be found here,
seem to be broken. Is there another way to enable drugref?

I presume you have installed drugref ( a seperate install,  the
current instructions are in  David's how to on
the configuration file oscar.properties or similar will have the URL
of drugref which you may need to change to point to the local
usually this should be
drugref_url = http://localhost:8001
I recently updated a test copy of OSCAR to the latest build but I have a problem when I search for a drug in the drug database after updating the drug database.  PostgreSQL is running and Python is running also when I type http://localhost:8001 in Firefox.  My properties file is correctly setup and it does not make sense of why it does not display any drugs.  My environment variables are setup to the correct paths, and I&#8217;m currently running version Postgresql 7.4.
I&#8217;ve modified rc.local to startup postmaster and then the drug database, i.e.:
nohup su -c "/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ -l /tmp/pgsql.log start" postgres
nohup su -c "/usr/local/bin/python /usr/local/drugref-ca_1_5/drugref_service.py >> /usr/local/drugref-ca_1_5/drug.log 2>&1 &" postgres

Hi Randy, I fixed the problem after a bit of testing. I had to execute the following command twice since for some weird reason the first time it did not work:
sudo ln -s /usr/lib/postgresql/8.3 /usr/local/pgsql   //before creating the drug database on postgresql
I then executed the same command after importing the drug database into postgresql.

Hi Dan,

I believe the new Rx module, enable by RX3=yes in the properties file, requires a new version of drug ref.  This version is written in java and can be checked out with mercurial and compiled with maven.

You can see the code at http://code.google.com/p/drugref2/source/checkout
Topic revision: 25 Jul 2010, JamesBusser
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback
Powered by Olark