Skip to content

Commit

Permalink
Closes #26 rename/rerun programs from admiral.test/admiralvaccine (
Browse files Browse the repository at this point in the history
…#38)

* #26: remove prefix update_/admiral_

* #26: use_data_raw()

* #26: move data to data-raw

* #26: update input data

* #26: update program name/rerun

* #26: rerun qs_ophtha

* #26: set.seed for qs_ophtha

* #26: update input data

* #26: update data.R

* #26: devtools::document()

* #26: update .lintr, add batch_run.sh

* #26: remove raw_domain
  • Loading branch information
kaz462 authored Jul 19, 2023
1 parent ffcf7e0 commit 36bb03f
Show file tree
Hide file tree
Showing 111 changed files with 281 additions and 336 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
^dev$
^vignettes/adxx\.Rmd$
^vignettes/pharmaversesdtm\.Rmd$
^data-raw$
3 changes: 2 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ linters: linters_with_defaults(
exclusions: list(
"R/data.R" = Inf,
"inst" = list(undesirable_function_linter = Inf),
"vignettes" = list(undesirable_function_linter = Inf)
"vignettes" = list(undesirable_function_linter = Inf),
"data-raw" = list(undesirable_function_linter = Inf)
)
90 changes: 24 additions & 66 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,29 @@
#' An updated SDTM AE dataset that uses the CDISC pilot project
#'
#' @source \url{https://github.com/pharmaverse/admiral.test/blob/main/data/admiral_ae.rda}
"admiral_ae"

#' Adverse Events Dataset-raw
#'
#' A SDTM AE dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/ae.xpt?raw=true} # nolint
"raw_ae"
"ae"

#' Concomitant Medication Dataset
#'
#' A SDTM CM dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/cm.xpt?raw=true} # nolint
"admiral_cm"
"cm"

#' Demography Dataset
#'
#' A SDTM DM dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/dm.xpt?raw=true} # nolint
"admiral_dm"
"dm"

#' Disposition Dataset-updated
#'
#' An updated SDTM DS dataset that uses the CDISC pilot project
#'
#' @source \url{https://github.com/pharmaverse/admiral.test/blob/main/data/admiral_ds.rda}
#' @author Gopi Vegesna
"admiral_ds"

#' Disposition Dataset-raw
#'
#' A SDTM DS dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/ds.xpt?raw=true} # nolint
"raw_ds"
"ds"

#' Electrocardiogram Dataset
#'
Expand All @@ -52,7 +38,7 @@
#' A SDTM EX dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/ex.xpt?raw=true} # nolint
"admiral_ex"
"ex"

#' Ophthalmology Exposure Dataset
#'
Expand All @@ -67,66 +53,45 @@
#'
#' @source \url{https://github.com/pharmaverse/admiral.test/blob/main/data/admiral_lb.rda}
#' @author Annie Yang
"admiral_lb"

#' Laboratory Measurements Dataset
#'
#' A SDTM LB dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/lb.xpt?raw=true} # nolint
"raw_lb"
"lb"

#' Medical History Dataset-updated
#'
#' An updated SDTM MH dataset that uses data from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/mh.xpt?raw=true} # nolint
#' @author Annie Yang
"admiral_mh"

#' Medical History Dataset-raw
#'
#' A SDTM MH dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/mh.xpt?raw=true} # nolint
"raw_mh"
"mh"

#' Ophthalmic Examinations Dataset
#'
#' A SDTM OE dataset simulated by Ophthalmology team
#'
#' @author Gordon Miller
"admiral_oe"
"oe_ophtha"

#' Pharmacokinetics Concentrations Dataset
#'
#' A SDTM PC dataset simulated by Antonio Rodríguez Contestí
#'
#' @source \url{https://github.com/pharmaverse/admiral.test/blob/main/data/admiral_pc.rda}
#' @author Antonio Rodríguez Contestí
"admiral_pc"
"pc"

#' Pharmacokinetic Parameters Dataset
#'
#' A SDTM PP dataset simulated by Antonio Rodríguez Contestí
#'
#' @source \url{https://github.com/pharmaverse/admiral.test/blob/main/data/admiral_pp.rda}
#' @author Antonio Rodríguez Contestí
"admiral_pp"

#' Questionnaire Dataset
#'
#' A SDTM QS dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/qs.xpt?raw=true} # nolint
"raw_qs"
"pp"

#' Questionnaire Dataset
#'
#' A SDTM QS dataset from the CDISC pilot project & Ophthalmology test data
#'
#' @source \url{https://github.com/pharmaverse/admiral.test/blob/main/data/admiral_qs.rda} # nolint
"admiral_qs"
"qs"

#' Ophthalmology Questionnaire Dataset
#'
Expand All @@ -140,93 +105,86 @@
#' A SDTM SC dataset simulated by Ophthalmology team
#'
#' @author Gordon Miller
"admiral_sc"
"sc_ophtha"

#' Tumor Identification Dataset
#'
#' A SDTM TU dataset simulated by Gopi Vegesna
#'
#' @author Gopi Vegesna
"admiral_tu"
"tu_onco"

#' Tumor Results Dataset
#'
#' A SDTM TR dataset simulated by Gopi Vegesna
#'
#' @author Gopi Vegesna
"admiral_tr"
"tr_onco"

#' Disease Response Dataset
#'
#' A SDTM RS dataset simulated by Gopi Vegesna
#'
#' @author Gopi Vegesna
"admiral_rs"
"rs_onco"

#' Supplemental Adverse Events Dataset
#'
#' A SDTM SUPPAE dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/suppae.xpt?raw=true} # nolint
"admiral_suppae"
"suppae"

#' Supplemental Disposition Dataset-updated
#'
#' A SDTM SUPPDS dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/suppds.xpt?raw=true} # nolint
"admiral_suppds"

#' Supplemental Disposition Dataset-raw
#'
#' A SDTM SUPPDS dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/suppds.xpt?raw=true} # nolint
"raw_suppds"
"suppds"

#' Supplemental Demography Dataset
#'
#' A SDTM SUPPDM dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/suppdm.xpt?raw=true} # nolint
"admiral_suppdm"
"suppdm"

#' Supplemental Tumor Results Dataset
#'
#' A SDTM SUPPTR dataset simulated by Gopi Vegesna
#'
#' @author Gopi Vegesna
"admiral_supptr"
"supptr_onco"

#' Trial Design Dataset
#'
#' A SDTM TS dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/ts.xpt?raw=true} # nolint
"admiral_ts"
"ts"

#' Vital Signs Dataset
#'
#' A SDTM VS dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/vs.xpt?raw=true} # nolint
"admiral_vs"
"vs"

#' SMQ Dataset
#'
#' An example SMQ dataset
#'
"admiral_smq_db"
"smq_db"

#' SDG Dataset
#'
#' An example SDG dataset
#'
"admiral_sdg_db"
"sdg_db"

#' Subject Visits Dataset
#'
#' A SDTM SV dataset from the CDISC pilot project
#'
#' @source \url{https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/sv.xpt?raw=true} # nolint
"admiral_sv"
"sv"
File renamed without changes.
9 changes: 7 additions & 2 deletions dev/update_ae.R → data-raw/ae.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
library(dplyr)
library(admiral)
library(metatools)
library(haven)

data("raw_ae")
raw_ae <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/ae.xpt?raw=true") # nolint
raw_suppae <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/suppae.xpt?raw=true") # nolint
ae <- convert_blanks_to_na(raw_ae)
suppae <- convert_blanks_to_na(raw_suppae)

# create possible AELAT values - as collected on CRF ----
lat <- c("LEFT", "RIGHT", "BOTH")
Expand All @@ -24,4 +27,6 @@ admiral_ae <- ae %>%
attr(admiral_ae, "label") <- "Adverse Events"

# Save dataset ----
save(admiral_ae, file = "data/admiral_ae.rda", compress = "bzip2")
ae <- admiral_ae
save(ae, file = "data/ae.rda", compress = "bzip2")
usethis::use_data(suppae, overwrite = TRUE)
34 changes: 34 additions & 0 deletions data-raw/batch_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# direct copy from CDISC pilot
Rscript data-raw/ex.R
Rscript data-raw/cm.R
Rscript data-raw/sv.R
Rscript data-raw/ts.R
Rscript data-raw/vs.R
Rscript data-raw/dm.R

# Update from CDISC pilot
Rscript data-raw/ae.R
Rscript data-raw/ds.R
Rscript data-raw/lb.R
Rscript data-raw/mh.R
Rscript data-raw/qs.R

# build from program
Rscript data-raw/pc.R
Rscript data-raw/pp.R
Rscript data-raw/query_databases.R # sdg_db, smq_db


# admiralophtha
Rscript data-raw/ex_ophtha.R
Rscript data-raw/qs_ophtha.R
# admiralophtha build from program
Rscript data-raw/oe_ophtha.R
Rscript data-raw/sc_ophtha.R


# admiralonco build from program
Rscript data-raw/tr_onco.R
Rscript data-raw/tu_onco.R
Rscript data-raw/rs_onco.R
7 changes: 7 additions & 0 deletions data-raw/cm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# from CDISC pilot study ----
library(haven)
library(admiral)
raw_cm <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/cm.xpt?raw=true") # nolint
cm <- convert_blanks_to_na(raw_cm)

usethis::use_data(cm, overwrite = TRUE)
11 changes: 11 additions & 0 deletions data-raw/dm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# from CDISC pilot study ----
library(haven)
library(admiral)
sdtm_path <- "https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/" # nolint
raw_dm <- read_xpt(paste0(sdtm_path, "dm", ".xpt?raw=true"))
raw_suppdm <- read_xpt(paste0(sdtm_path, "suppdm", ".xpt?raw=true"))
dm <- convert_blanks_to_na(raw_dm)
suppdm <- convert_blanks_to_na(raw_suppdm)

usethis::use_data(dm, overwrite = TRUE)
usethis::use_data(suppdm, overwrite = TRUE)
16 changes: 10 additions & 6 deletions dev/update_ds.R → data-raw/ds.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ library(tidyselect)
library(labelled)
library(admiral)
library(metatools)
library(haven)

data("admiral_dm")
data("raw_ds")
data("raw_suppds")
data("dm")
sdtm_path <- "https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/" # nolint
raw_ds <- read_xpt(paste0(sdtm_path, "ds", ".xpt?raw=true"))
raw_suppds <- read_xpt(paste0(sdtm_path, "suppds", ".xpt?raw=true"))

# Converting blank to NA
dm <- convert_blanks_to_na(admiral_dm)
dm <- convert_blanks_to_na(dm)
ds1a <- convert_blanks_to_na(raw_ds)
suppds1a <- convert_blanks_to_na(raw_suppds)

Expand Down Expand Up @@ -97,5 +99,7 @@ admiral_ds <- select(ds3, all_of(dsnames))

attr(admiral_ds, "label") <- "Disposition"

save(admiral_ds, file = "data/admiral_ds.rda", compress = "bzip2")
save(admiral_suppds, file = "data/admiral_suppds.rda", compress = "bzip2")
ds <- admiral_ds
suppds <- admiral_suppds
save(ds, file = "data/ds.rda", compress = "bzip2")
save(suppds, file = "data/suppds.rda", compress = "bzip2")
7 changes: 7 additions & 0 deletions data-raw/ex.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# from CDISC pilot study ----
library(haven)
library(admiral)
raw_ex <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/ex.xpt?raw=true") # nolint
ex <- convert_blanks_to_na(raw_ex)

usethis::use_data(ex, overwrite = TRUE)
7 changes: 4 additions & 3 deletions dev/ex_ophtha.R → data-raw/ex_ophtha.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
library(dplyr)
library(tidyselect)
library(pharmaversesdtm)
data("dm")
data("ex")

# Make ex_ophtha dataset
ex_ophtha <- admiral_dm %>%
ex_ophtha <- dm %>%
# Start by merging on ophtha_dm to use the SUBJID variable
select(USUBJID, SUBJID) %>%
right_join(admiral_ex, by = c("USUBJID"), multiple = "all") %>%
right_join(ex, by = c("USUBJID"), multiple = "all") %>%
# Create EXLOC & EXLAT, change EXROUTE & EXDOSFRM to something eye-related
mutate(
EXLOC = "EYE",
Expand Down
Loading

0 comments on commit 36bb03f

Please sign in to comment.