Date: July 28 2021
Summary: How to explore drugs in an OHDSI table by name
Keywords: #ohdsi #sql #drug #name #r #archive
EHDEN Academy
We install the OHDSI dummy database, Eunomia
, to write our queries:
install.packages(c("SqlRender", "DatabaseConnector", "remotes"))
remotes::install_github("ohdsi/Eunomia", ref = "v1.0.0")
We will also install the package knitr
for viewing and working with resulting tables easily:
install.packages("knitr")
Here we load the DatabaseConnector
library to connect to Eunomia
:
library('DatabaseConnector')
library('knitr')
And set a connection to Eunomia
connectionDetails <-Eunomia::getEunomiaConnectionDetails()
connection <- connect(connectionDetails)
First we need to write our SQL query as follows:
sql <- "
SELECT * FROM @cdm.concept WHERE lower(concept_name) = 'warfarin'
"
And then we can run our SQL query and return the results as follows:
result <- renderTranslateQuerySql(connection, sql,cdm ="main")
knitr::kable(result)
Zelko, Jacob. Exploring Drug Concepts by Name. https://jacobzelko.com/07282021211226-drug-concepts. July 28 2021.