CALIBERdoseconvert-package: Extract Drug Dose From Unstructured Dosage Text

Description Details Author(s) References See Also Examples


A program to convert unstructured dosage text into structured dosage information. It was originally designed for general practitioner dosage instructions from the Vision clinical system. The program uses a number of lookup tables of words and patterns which are built in to the package, but with the option of using custom lookup tables.

The main user function is doseconvert, which converts a vector of one or more text dosage instructions into a data.table of structured dose information. The program is designed for speed; it automatically collates identical dosage instructions prior to conversion, and can use multiple processors (using the parallel package on Linux).

The program can be run in server mode using RServe. This is an example using Python on Ubuntu to access an R service (type these commands into the terminal):

# Install required packages (command line):
sudo apt-get install r-cran-rserve
sudo apt-get install python-pip
sudo pip install pyRserve

# Start R in daemon mode:
R CMD Rserve

# Start python:

# Now type the following commands in python:
import pyRserve
conn = pyRserve.connect()

# Analyse a text
conn.r.doseconvert('2 tablets daily')

# Shut down R session

Example python code for a faster way to run a conversion service (by preloading lookup dictionaries).


Package: CALIBERdrugdose
Type: Package
Version: 0.1-2
Date: 2017-02-27
License: GPL-3


Anoop Shah


Shah AD, Martinez C. An algorithm to derive a numerical daily dose from unstructured text dosage instructions. Pharmacoepidemiol Drug Saf 2006; 15(3): 161-166. doi: 10.1002/pds.1151

See Also



doseconvert('take 2 puffs twice daily') 

CALIBERdrugdose documentation built on May 2, 2019, 6:49 p.m.