diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e19b8b2..4bc6dc5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -19,3 +19,6 @@ data-raw/oe_ophtha.R @manciniedoardo data-raw/qs_ophtha.R @manciniedoardo data-raw/sc_ophtha.R @manciniedoardo +# admiralpeds +data-raw/dm_peds.R @fanny-gautier +data-raw/vs_peds.R @fanny-gautier diff --git a/NEWS.md b/NEWS.md index 25d0152..442c489 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# pharmaversesdtm (development version) + +## New Features + +- Pediatrics data for anthropometric measures (`dm_peds` and `vs_peds`) was added (#88). + # pharmaversesdtm 1.0.0 ## New Features diff --git a/R/data.R b/R/data.R index 7569331..18e6d25 100644 --- a/R/data.R +++ b/R/data.R @@ -316,3 +316,17 @@ #' #' @source Constructed by `{admiralvaccine}` developers "suppis_vaccine" + +#' Demographic Dataset-pediatrics +#' +#' An updated SDTM DM dataset with pediatric patients +#' +#' @source Constructed by `{admiralpeds}` developers +"dm_peds" + +#' Vital signs Dataset-pediatrics +#' +#' An updated SDTM VS dataset with anthropometric measurements for pediatric patients +#' +#' @source Constructed by `{admiralpeds}` developers +"vs_peds" diff --git a/data-raw/batch_run.sh b/data-raw/batch_run.sh index 049b95e..08c5212 100644 --- a/data-raw/batch_run.sh +++ b/data-raw/batch_run.sh @@ -32,3 +32,7 @@ Rscript data-raw/sc_ophtha.R Rscript data-raw/tr_onco.R Rscript data-raw/tu_onco.R Rscript data-raw/rs_onco.R + +# admiralpeds build from program +Rscript data-raw/dm_peds.R +Rscript data-raw/vs_peds.R diff --git a/data-raw/dm_peds.R b/data-raw/dm_peds.R new file mode 100644 index 0000000..7e3eab8 --- /dev/null +++ b/data-raw/dm_peds.R @@ -0,0 +1,46 @@ +# Dataset: dm_peds +# Description: Create DM test SDTM dataset for pediatric studies + +# Load libraries ----- +library(dplyr) +library(admiral) + +# Read input test data from pharmaversesdtm ---- +dm <- pharmaversesdtm::dm + +# Convert blank to NA ---- +dm <- convert_blanks_to_na(dm) + +# Subset to first 5 patients only (which is enough for our examples) ---- +dm_subset <- dm %>% + filter(USUBJID %in% c( + "01-701-1015", "01-701-1023", "01-701-1028", + "01-701-1033", "01-701-1034" + )) + +# Add birth dates/age realistic for pediatrics in line with treatment dates ---- +dm_peds <- dm_subset %>% + mutate(BRTHDTC = case_when( + USUBJID == "01-701-1015" ~ "2013-01-02", + USUBJID == "01-701-1023" ~ "2010-08-05", + USUBJID == "01-701-1028" ~ "2010-07-19", + USUBJID == "01-701-1033" ~ "2014-01-01", + USUBJID == "01-701-1034" ~ "2014-06-01" + )) %>% + mutate(AGE = case_when( + USUBJID == "01-701-1015" ~ 1, + USUBJID == "01-701-1023" ~ 2, + USUBJID == "01-701-1028" ~ 3, + USUBJID == "01-701-1033" ~ 0, + USUBJID == "01-701-1034" ~ 0 + )) + +# Variable labels ---- +attr(dm_peds$BRTHDTC, "label") <- "Date/Time of Birth" +attr(dm_peds$AGE, "label") <- "Age" + +# Label dataset ---- +attr(dm_peds, "label") <- "Demographics" + +# Save dataset ---- +usethis::use_data(dm_peds, overwrite = TRUE) diff --git a/data-raw/vs_peds.R b/data-raw/vs_peds.R new file mode 100644 index 0000000..2e54fd7 --- /dev/null +++ b/data-raw/vs_peds.R @@ -0,0 +1,263 @@ +# Dataset: vs_peds +# Description: Create VS test SDTM dataset for pediatric studies + +# Load libraries ----- +library(dplyr) +library(admiral) + +# Read input test data from pharmaversesdtm ---- +vs <- pharmaversesdtm::vs + +# Convert blank to NA ---- +vs <- convert_blanks_to_na(vs) + +# Subset to 5 patients present in dm_peds and only keep WEIGHT records ---- +vs_subset <- vs %>% + filter(USUBJID %in% c( + "01-701-1015", "01-701-1023", "01-701-1028", + "01-701-1033", "01-701-1034" + ) & + VSTESTCD %in% c("WEIGHT")) + +# Create placeholder records for HEIGHT, BMI and HDCIRC from the WEIGHT records +vs_subset_height <- vs_subset %>% + mutate(VSTESTCD = "HEIGHT") +vs_subset_bmi <- vs_subset %>% + mutate(VSTESTCD = "BMI") +vs_subset_hdcirc <- vs_subset %>% + mutate(VSTESTCD = "HDCIRC") + +# Bind new parameter records to original dataset +vs_subset_full <- bind_rows( + vs_subset, + vs_subset_height, + vs_subset_bmi, + vs_subset_hdcirc +) %>% + arrange(USUBJID, VSTESTCD, VISITNUM, VSDY) + +# Updating each parameters values and units to be consistent with the ages of these dummy patients +vs_peds <- vs_subset_full %>% + mutate(VSSTRESN = case_when( + USUBJID == "01-701-1015" & VSTESTCD == "WEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 9.11, + VISIT == "BASELINE" ~ 9.2, + VISIT == "WEEK 2" ~ 9.32, + VISIT == "WEEK 4" ~ 9.54, + VISIT == "WEEK 6" ~ 9.7, + VISIT == "WEEK 8" ~ 9.91, + VISIT == "WEEK 12" ~ 10.3, + VISIT == "WEEK 16" ~ 10.7, + VISIT == "WEEK 20" ~ 11.1, + VISIT == "WEEK 24" ~ 11.56, + VISIT == "WEEK 26" ~ 11.71, + ), + USUBJID == "01-701-1015" & VSTESTCD == "HEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 74.13, + VISIT == "BASELINE" ~ 74.41, + VISIT == "WEEK 2" ~ 74.71, + VISIT == "WEEK 4" ~ 75.32, + VISIT == "WEEK 6" ~ 75.93, + VISIT == "WEEK 8" ~ 76.54, + VISIT == "WEEK 12" ~ 77.72, + VISIT == "WEEK 16" ~ 78.96, + VISIT == "WEEK 20" ~ 80.22, + VISIT == "WEEK 24" ~ 81.43, + VISIT == "WEEK 26" ~ 82.03 + ), + USUBJID == "01-701-1015" & VSTESTCD == "HDCIRC" ~ case_when( + VISIT == "SCREENING 1" ~ 35.61, + VISIT == "BASELINE" ~ 37.24, + VISIT == "WEEK 2" ~ 38.57, + VISIT == "WEEK 4" ~ 39.84, + VISIT == "WEEK 6" ~ 40.95, + VISIT == "WEEK 8" ~ 42.14, + VISIT == "WEEK 12" ~ 43.67, + VISIT == "WEEK 16" ~ 44.79, + VISIT == "WEEK 20" ~ 45.92, + VISIT == "WEEK 24" ~ 46.88, + VISIT == "WEEK 26" ~ 47.56 + ), + USUBJID == "01-701-1023" & VSTESTCD == "WEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 12.47, + VISIT == "BASELINE" ~ 12.89, + VISIT == "WEEK 2" ~ 13.14, + VISIT == "WEEK 4" ~ 13.45 + ), + USUBJID == "01-701-1023" & VSTESTCD == "HEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 87.65, + VISIT == "BASELINE" ~ 88.25, + VISIT == "WEEK 2" ~ 88.75, + VISIT == "WEEK 4" ~ 89.23 + ), + USUBJID == "01-701-1023" & VSTESTCD == "HDCIRC" ~ case_when( + VISIT == "SCREENING 1" ~ 48.34, + VISIT == "BASELINE" ~ 48.71, + VISIT == "WEEK 2" ~ 49.12, + VISIT == "WEEK 4" ~ 49.56 + ), + USUBJID == "01-701-1028" & VSTESTCD == "HEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 98.32, + VISIT == "BASELINE" ~ 98.95, + VISIT == "WEEK 2" ~ 99.34, + VISIT == "WEEK 4" ~ 99.68, + VISIT == "WEEK 6" ~ 100.13, + VISIT == "WEEK 8" ~ 100.45, + VISIT == "WEEK 12" ~ 101.02, + VISIT == "WEEK 16" ~ 101.48, + VISIT == "WEEK 20" ~ 101.97, + VISIT == "WEEK 24" ~ 102.44, + VISIT == "WEEK 26" ~ 102.82 + ), + USUBJID == "01-701-1028" & VSTESTCD == "WEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 14.65, + VISIT == "BASELINE" ~ 14.95, + VISIT == "WEEK 2" ~ 15.17, + VISIT == "WEEK 4" ~ 15.43, + VISIT == "WEEK 6" ~ 15.66, + VISIT == "WEEK 8" ~ 15.84, + VISIT == "WEEK 12" ~ 16.34, + VISIT == "WEEK 16" ~ 16.73, + VISIT == "WEEK 20" ~ 17.11, + VISIT == "WEEK 24" ~ 17.56, + VISIT == "WEEK 26" ~ 17.85 + ), + USUBJID == "01-701-1028" & VSTESTCD == "HDCIRC" ~ case_when( + VISIT == "SCREENING 1" ~ 51.34, + VISIT == "BASELINE" ~ 51.71, + VISIT == "WEEK 2" ~ 52.12, + VISIT == "WEEK 4" ~ 52.56, + VISIT == "WEEK 6" ~ 52.93, + VISIT == "WEEK 8" ~ 53.45, + VISIT == "WEEK 12" ~ 54.02, + VISIT == "WEEK 16" ~ 54.48, + VISIT == "WEEK 20" ~ 54.97, + VISIT == "WEEK 24" ~ 55.44, + VISIT == "WEEK 26" ~ 55.82 + ), + USUBJID == "01-701-1033" & VSTESTCD == "HEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 59.45, + VISIT == "BASELINE" ~ 60.53, + VISIT == "WEEK 2" ~ 61.72, + VISIT == "WEEK 4" ~ 62.91 + ), + USUBJID == "01-701-1033" & VSTESTCD == "WEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 5.62, + VISIT == "BASELINE" ~ 5.89, + VISIT == "WEEK 2" ~ 6.17, + VISIT == "WEEK 4" ~ 6.45 + ), + USUBJID == "01-701-1033" & VSTESTCD == "HDCIRC" ~ case_when( + VISIT == "SCREENING 1" ~ 40.34, + VISIT == "BASELINE" ~ 40.71, + VISIT == "WEEK 2" ~ 41.12, + VISIT == "WEEK 4" ~ 41.56 + ), + USUBJID == "01-701-1034" & VSTESTCD == "HEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 53.65, + VISIT == "BASELINE" ~ 54.78, + VISIT == "WEEK 2" ~ 55.95, + VISIT == "WEEK 4" ~ 57.14, + VISIT == "WEEK 6" ~ 58.23, + VISIT == "WEEK 8" ~ 59.45, + VISIT == "WEEK 12" ~ 60.67, + VISIT == "WEEK 16" ~ 61.79, + VISIT == "WEEK 20" ~ 62.91, + VISIT == "WEEK 24" ~ 64.03, + VISIT == "WEEK 26" ~ 65.15 + ), + USUBJID == "01-701-1034" & VSTESTCD == "WEIGHT" ~ case_when( + VISIT == "SCREENING 1" ~ 4.25, + VISIT == "BASELINE" ~ 4.56, + VISIT == "WEEK 2" ~ 4.84, + VISIT == "WEEK 4" ~ 5.15, + VISIT == "WEEK 6" ~ 5.47, + VISIT == "WEEK 8" ~ 5.79, + VISIT == "WEEK 12" ~ 6.11, + VISIT == "WEEK 16" ~ 6.43, + VISIT == "WEEK 20" ~ 6.75, + VISIT == "WEEK 24" ~ 7.07, + VISIT == "WEEK 26" ~ 7.39 + ), + USUBJID == "01-701-1034" & VSTESTCD == "HDCIRC" ~ case_when( + VISIT == "SCREENING 1" ~ 38.45, + VISIT == "BASELINE" ~ 38.92, + VISIT == "WEEK 2" ~ 39.34, + VISIT == "WEEK 4" ~ 39.78, + VISIT == "WEEK 6" ~ 40.23, + VISIT == "WEEK 8" ~ 40.65, + VISIT == "WEEK 12" ~ 41.07, + VISIT == "WEEK 16" ~ 41.48, + VISIT == "WEEK 20" ~ 41.89, + VISIT == "WEEK 24" ~ 42.30, + VISIT == "WEEK 26" ~ 42.72 + ), + TRUE ~ VSSTRESN + )) + +# Derive BMI values ---- +vs_peds <- vs_peds %>% + arrange(USUBJID, VISITNUM, VSTESTCD, VSDY) %>% + group_by(USUBJID, VISITNUM) %>% + mutate( + VSSTRESN = case_when( + VSTESTCD == "BMI" ~ { + weight <- VSSTRESN[VSTESTCD == "WEIGHT"] + height <- VSSTRESN[VSTESTCD == "HEIGHT"] / 100 # Convert height from cm to m + as.numeric(weight / (height^2)) # BMI calculation + }, + TRUE ~ VSSTRESN + ) + ) %>% + ungroup() + +# Formatting the output dataset ---- +vs_peds <- vs_peds %>% + group_by(STUDYID, USUBJID) %>% + mutate(VSSEQ = row_number()) %>% + ungroup() %>% + mutate( + VSPOS = NA_character_, + VSORRESU = case_when( + VSTESTCD == "HEIGHT" ~ "cm", + VSTESTCD == "WEIGHT" ~ "kg", + VSTESTCD == "BMI" ~ "kg/m2", + VSTESTCD == "HDCIRC" ~ "cm", + TRUE ~ NA_character_ + ), + VSTEST = case_when( + VSTESTCD == "HEIGHT" ~ "Height", + VSTESTCD == "WEIGHT" ~ "Weight", + VSTESTCD == "BMI" ~ "BMI", + VSTESTCD == "HDCIRC" ~ "Head Circumference", + TRUE ~ NA_character_ + ), + VSSTRESC = as.character(VSSTRESN), + VSORRES = VSSTRESC, + VSSTRESU = VSORRESU, + VSSTAT = NA_character_, + VSLOC = NA_character_, + VSBLFL = if_else(VISITNUM == 2, "Y", NA_character_), + VISITDY = NA_integer_, + VSDY = NA_integer_, + VSEVAL = NA_character_, + EPOCH = "Epoch" + ) %>% + arrange(USUBJID, VSTESTCD, VISITNUM, VSDY) + +# Get common column names with VS +common_cols <- intersect(names(vs), names(vs_peds)) + +# Copy attributes (including labels) from vs to vs_peds for common columns +for (col in common_cols) { + attributes(vs_peds[[col]]) <- attributes(vs[[col]]) +} +# Set the labels for non-commn variables +attr(vs_peds$VSEVAL, "label") <- "Evaluator" +attr(vs_peds$EPOCH, "label") <- "Epoch" + +# Label dataset ---- +attr(vs_peds, "label") <- "Vital Signs" + +# Save dataset ---- +usethis::use_data(vs_peds, overwrite = TRUE) diff --git a/data/dm_peds.rda b/data/dm_peds.rda new file mode 100644 index 0000000..4683e01 Binary files /dev/null and b/data/dm_peds.rda differ diff --git a/data/vs_peds.rda b/data/vs_peds.rda new file mode 100644 index 0000000..971fb28 Binary files /dev/null and b/data/vs_peds.rda differ diff --git a/inst/WORDLIST b/inst/WORDLIST index bd2a8e6..0dc44e8 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -12,12 +12,11 @@ Immunogenicity MH MedDRA NEI +ONCO ORCID Pharmacokinetic -Pharmacokinetics Pharmaverse RECIST -Rodriguez Rohan SDG SDTM @@ -37,7 +36,7 @@ VFQ Vegesna Vinh anonymized +anthropometric iRECIST nolint -ONCO pharmaverse diff --git a/man/dm_peds.Rd b/man/dm_peds.Rd new file mode 100644 index 0000000..a8e4dea --- /dev/null +++ b/man/dm_peds.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{dm_peds} +\alias{dm_peds} +\title{Demographic Dataset-pediatrics} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 5 rows and 26 columns. +} +\source{ +Constructed by \code{{admiralpeds}} developers +} +\usage{ +dm_peds +} +\description{ +An updated SDTM DM dataset with pediatric patients +} +\keyword{datasets} diff --git a/man/vs_peds.Rd b/man/vs_peds.Rd new file mode 100644 index 0000000..b8b733b --- /dev/null +++ b/man/vs_peds.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{vs_peds} +\alias{vs_peds} +\title{Vital signs Dataset-pediatrics} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 164 rows and 26 columns. +} +\source{ +Constructed by \code{{admiralpeds}} developers +} +\usage{ +vs_peds +} +\description{ +An updated SDTM VS dataset with anthropometric measurements for pediatric patients +} +\keyword{datasets} diff --git a/staged_dependencies.yaml b/staged_dependencies.yaml index c941541..8f379e5 100644 --- a/staged_dependencies.yaml +++ b/staged_dependencies.yaml @@ -12,4 +12,7 @@ downstream_repos: host: https://github.com - repo: pharmaverse/admiralophtha host: https://github.com + - repo: pharmaverse/admiralpeds + host: https://github.com +