RxNorm is a terminology that has a good content. It can be downloaded (after signing a user agreement) from NLM website.

But it requires dealing with databases (Oracle or MySQL). Can I parse the file quickly in R to extract just names of brand name drugs?


After downloading the zip file, use only the "prescribable" portion. (that are drugs currently approved for use, without many "historical" drugs)

The main file is RXCONSO.RRF which is 28MB. It has 113290 rows and contains many different types of rows (e.g., synonyms).

To filter only ingredients, using R, do this:

conso<-read.delim(file = 'RXNCONSO.RRF', sep='|',header = F, stringsAsFactors=F)

conso[3:7] <- list(NULL)  #not used in this distribution, only in full UMLS

column names can be seen here http://www.nlm.nih.gov/research/umls/rxnorm/docs/2014/rxnorm_doco_full_2014-2.html#s12_4

names(conso)[1] <- 'rxcui'
names(conso)[3] <- 'rxaui'
names(conso)[7] <- 'sab'  #12
names(conso)[8] <- 'tty'  #13
names(conso)[10] <- 'str' #15

Use TTY term type column - value BN=Brand Name

#only brand names

and in bn data.frame is your result.

Sample result would look like this:

> head(bn,5)
    rxcui       str
1      38  Parlodel
73    332  Adipex-P
107   479   Alfenta
187   756 Anafranil
188   769   Anaspaz

In fact, to get only generic ingredient names, a similar query can be used like this:

#get only ingredients and CUI and name for each intredient
| improve this answer | |

You can accomplish the same with RxNorm SOAP API 'getAllConceptsByTTY' where TTY = "BN" (brand name) and "BPCK" (brand name pack). DailyMed is also mapped to RxNorm, Going the DailyMed route is longer unless you want to extract information from the SPL using NLP.

The other advantage of using the API is using get closest match function to normalize the input strings, and of course you can always use the results in R to manipulate and apply later.

enter image description here

| improve this answer | |

RXNorm is probably the way to go but there's also DailyMed which has an API and data downloads. For example, a list of drugs (just brand name) can be paged through at http://dailymed.nlm.nih.gov/dailymed/services/v2/drugnames.json?pagesize=100&page=1&name_type=b

(/drugnames.json API documentation)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.