A query object defines a query, e.g., a Standard MedDRA Query (SMQ), a
Standardized Drug Grouping (SDG), or a customized query (CQ). It is used
as input to create_query_data().
Arguments
- prefix
The value is used to populate
VAR_PREFIXin the output dataset ofcreate_query_data(), e.g.,"SMQ03"- name
The value is used to populate
QUERY_NAMEin the output dataset ofcreate_query_data(). If theautokeyword is specified, the variable is set to the name of the query in the SMQ/SDG database.Permitted Values: A character scalar or the
autokeyword. Theautokeyword is permitted only for queries which are defined by anbasket_select()object.- id
The value is used to populate
QUERY_IDin the output dataset ofcreate_query_data(). If theautokeyword is specified, the variable is set to the id of the query in the SMQ/SDG database.Permitted Values: A integer scalar or the
autokeyword. Theautokeyword is permitted only for queries which are defined by anbasket_select()object.- add_scope_num
Determines if
QUERY_SCOPE_NUMin the output dataset ofcreate_query_data()is populatedIf the parameter is set to
TRUE, the definition must be anbasket_select()object.Default:
FALSEPermitted Values:
TRUE,FALSE- definition
Definition of terms belonging to the query
There are three different ways to define the terms:
An
basket_select()object is specified to select a query from the SMQ database.A data frame with columns
TERM_LEVELandTERM_NAMEorTERM_IDcan be specified to define the terms of a customized query. TheTERM_LEVELshould be set to the name of the variable which should be used to select the terms, e.g.,"AEDECOD"or"AELLTCD".TERM_LEVELdoes not need to be constant within a query. For example a query can be based onAEDECODandAELLT.If
TERM_LEVELrefers to a character variable,TERM_NAMEshould be set to the value the variable. If it refers to a numeric variable,TERM_IDshould be set to the value of the variable. If only character variables or only numeric variables are used,TERM_IDorTERM_NAMErespectively can be omitted.A list of data frames and
basket_select()objects can be specified to define a customized query based on custom terms and SMQs. The data frames must have the same structure as described for the previous item.
Permitted Values: an
basket_select()object, a data frame, or a list of data frames andbasket_select()objects.
See also
create_query_data(), basket_select(), Queries Dataset Documentation
Source Objects:
basket_select(),
censor_source(),
date_source(),
death_event,
dthcaus_source(),
event_source(),
event(),
tte_source()
Examples
# create a query for an SMQ
library(tibble)
library(dplyr, warn.conflicts = FALSE)
# create a query for a SMQ
query(
prefix = "SMQ02",
id = auto,
definition = basket_select(
name = "Pregnancy and neonatal topics (SMQ)",
scope = "NARROW",
type = "smq"
)
)
#> <query> object
#> prefix: "SMQ02"
#> name: auto
#> id: auto
#> add_scope_num: FALSE
#> definition:
#> <basket_select> object
#> name: "Pregnancy and neonatal topics (SMQ)"
#> id: NULL
#> scope: "NARROW"
#> type: "smq"
# create a query for an SDG
query(
prefix = "SDG01",
id = auto,
definition = basket_select(
name = "5-aminosalicylates for ulcerative colitis",
scope = NA_character_,
type = "sdg"
)
)
#> <query> object
#> prefix: "SDG01"
#> name: auto
#> id: auto
#> add_scope_num: FALSE
#> definition:
#> <basket_select> object
#> name: "5-aminosalicylates for ulcerative colitis"
#> id: NULL
#> scope: "NA"
#> type: "sdg"
# creating a query for a customized query
cqterms <- tribble(
~TERM_NAME, ~TERM_ID,
"APPLICATION SITE ERYTHEMA", 10003041L,
"APPLICATION SITE PRURITUS", 10003053L
) %>%
mutate(TERM_LEVEL = "AEDECOD")
query(
prefix = "CQ01",
name = "Application Site Issues",
definition = cqterms
)
#> <query> object
#> prefix: "CQ01"
#> name: "Application Site Issues"
#> add_scope_num: FALSE
#> definition:
#> # A tibble: 2 x 3
#> TERM_NAME TERM_ID TERM_LEVEL
#> <chr> <int> <chr>
#> 1 APPLICATION SITE ERYTHEMA 10003041 AEDECOD
#> 2 APPLICATION SITE PRURITUS 10003053 AEDECOD
# creating a customized query based on SMQs and additional terms
query(
prefix = "CQ03",
name = "Special issues of interest",
definition = list(
cqterms,
basket_select(
name = "Pregnancy and neonatal topics (SMQ)",
scope = "NARROW",
type = "smq"
),
basket_select(
id = 8050L,
scope = "BROAD",
type = "smq"
)
)
)
#> <query> object
#> prefix: "CQ03"
#> name: "Special issues of interest"
#> add_scope_num: FALSE
#> definition:
#> 1:
#> # A tibble: 2 x 3
#> TERM_NAME TERM_ID TERM_LEVEL
#> <chr> <int> <chr>
#> 1 APPLICATION SITE ERYTHEMA 10003041 AEDECOD
#> 2 APPLICATION SITE PRURITUS 10003053 AEDECOD
#> 2:
#> <basket_select> object
#> name: "Pregnancy and neonatal topics (SMQ)"
#> id: NULL
#> scope: "NARROW"
#> type: "smq"
#> 3:
#> <basket_select> object
#> name: NULL
#> id: 8050L
#> scope: "BROAD"
#> type: "smq"
