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
PREFIX
in the output dataset ofcreate_query_data()
, e.g.,"SMQ03"
- name
-
The value is used to populate
GRPNAME
in the output dataset ofcreate_query_data()
. If theauto
keyword is specified, the variable is set to the name of the query in the SMQ/SDG database.Permitted Values: A character scalar or the
auto
keyword. Theauto
keyword is permitted only for queries which are defined by anbasket_select()
object. - id
-
The value is used to populate
GRPID
in the output dataset ofcreate_query_data()
. If theauto
keyword is specified, the variable is set to the id of the query in the SMQ/SDG database.Permitted Values: A integer scalar or the
auto
keyword. Theauto
keyword is permitted only for queries which are defined by anbasket_select()
object. - add_scope_num
-
Determines if
SCOPEN
in the output dataset ofcreate_query_data()
is populatedIf the parameter is set to
TRUE
, the definition must be anbasket_select()
object.Default:
FALSE
Permitted 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
SRCVAR
andTERMCHAR
orTERMNUM
can be specified to define the terms of a customized query. TheSRCVAR
should be set to the name of the variable which should be used to select the terms, e.g.,"AEDECOD"
or"AELLTCD"
.SRCVAR
does not need to be constant within a query. For example a query can be based onAEDECOD
andAELLT
.If
SRCVAR
refers to a character variable,TERMCHAR
should be set to the value the variable. If it refers to a numeric variable,TERMNUM
should be set to the value of the variable. If only character variables or only numeric variables are used,TERMNUM
orTERMCHAR
respectively 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()
,
death_event
,
event()
,
event_joined()
,
event_source()
,
flag_event()
,
records_source()
,
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(
~TERMCHAR, ~TERMNUM,
"APPLICATION SITE ERYTHEMA", 10003041L,
"APPLICATION SITE PRURITUS", 10003053L
) %>%
mutate(SRCVAR = "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 × 3
#> TERMCHAR TERMNUM SRCVAR
#> <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:
#> c("APPLICATION SITE ERYTHEMA", "APPLICATION SITE PRURITUS")
#> c(10003041, 10003053)
#> c("AEDECOD", "AEDECOD")
#> Pregnancy and neonatal topics (SMQ)
#> NULL
#> NARROW
#> smq
#> NULL
#> 8050
#> BROAD
#> smq