You may want to organize your research folder using small scripts, each designed for a part of your analysis plan.
Inspired from Reproducible Research in R
The dictionary might be located in scripts, under the name “dict.R”.
If you haven’t, visit vignette("getting_started") and
vignette("basic_workflow") for details on what this
template does.
# #### PATHS #### ####
path_who    <- "../vigibase_ecl/who" # adapt to your own
path_meddra <- "../meddra" 
# #### IMPORT #### ####
# ---- Datasets ---- ####
mp     <- dt_parquet(path_who, "mp")
thg    <- dt_parquet(path_who, "thg")
meddra <- dt_parquet(path_meddra, "meddra_hierarchy")
smq_list <- dt_parquet(path_meddra, "meddra_smq_list")
smq_content <- dt_parquet(path_meddra, "meddra_smq_content")# #### Drug definitions #### ####
d_sel <-
  list(
    nivolumab = "nivolumab", # use lower case
    ici = c("nivolumab", "pembrolizumab")
  )
# ---- ID collector
d_drecno <-
  d_sel |>
  get_drecno(
    mp = mp
  )
# #### ATC definitions #### ####
atc_sel <-
  list(l03 = "L03") # ATC code
# ---- ID collector
atc_drecno <-
  atc_sel |>
  get_atc_code(
    mp = mp,
    thg_data = thg
  )
# #### ADR definitions #### ####
# adr selection, matching meddra case
# ---- SOC definition
pt_sel <-
  list(
    hepatitis = c("Hepatitis", "Budd-Chiari syndrome"),
    hyponatremia = c("Pneumonitis")
  )
hlt_sel <-
  list(
    conduction = "Diarrhoea (excl infective)"
  )
# ---- SMQ definition
smq_sel <-
  list(
    hta = "Ischaemic heart disease (SMQ)"
  )
# ---- ID collectors
a_llt <-
  c(
    get_llt_soc(pt_sel,
                term_level = "pt",
                meddra = meddra),
    get_llt_soc(hlt_sel,
                term_level = "hlt",
                meddra),
    get_llt_smq(smq_sel,
                smq_scope =  "narrow",
                smq_list,
                smq_content)
  )