library(tibble)
library(dplyr, warn.conflicts = FALSE)
library(pharmaversesdtm)
library(admiral)
# creating a query dataset for a customized query
cqterms <- tribble(
~TERMCHAR, ~TERMNUM,
"APPLICATION SITE ERYTHEMA", 10003041L,
"APPLICATION SITE PRURITUS", 10003053L
) %>%
mutate(SRCVAR = "AEDECOD")
cq <- query(
prefix = "CQ01",
name = "Application Site Issues",
definition = cqterms
)
create_query_data(queries = list(cq))
# create a query dataset for SMQs
pregsmq <- query(
prefix = "SMQ02",
id = auto,
definition = basket_select(
name = "Pregnancy and neonatal topics (SMQ)",
scope = "NARROW",
type = "smq"
)
)
bilismq <- query(
prefix = "SMQ04",
definition = basket_select(
id = 20000121L,
scope = "BROAD",
type = "smq"
)
)
# The get_terms function from pharmaversesdtm is used for this example.
# In a real application a company-specific function must be used.
create_query_data(
queries = list(pregsmq, bilismq),
get_terms_fun = pharmaversesdtm:::get_terms,
version = "20.1"
)
# create a query dataset for SDGs
sdg <- query(
prefix = "SDG01",
id = auto,
definition = basket_select(
name = "5-aminosalicylates for ulcerative colitis",
scope = NA_character_,
type = "sdg"
)
)
# The get_terms function from pharmaversesdtm is used for this example.
# In a real application a company-specific function must be used.
create_query_data(
queries = list(sdg),
get_terms_fun = pharmaversesdtm:::get_terms,
version = "2019-09"
)
# creating a query dataset for a customized query including SMQs
# The get_terms function from pharmaversesdtm is used for this example.
# In a real application a company-specific function must be used.
create_query_data(
queries = list(
query(
prefix = "CQ03",
name = "Special issues of interest",
definition = list(
basket_select(
name = "Pregnancy and neonatal topics (SMQ)",
scope = "NARROW",
type = "smq"
),
cqterms
)
)
),
get_terms_fun = pharmaversesdtm:::get_terms,
version = "20.1"
)
Run the code above in your browser using DataLab