From 627aaf7a64442b0550802b4cc42f43e031883f2c Mon Sep 17 00:00:00 2001 From: Zelos Zhu Date: Wed, 16 Oct 2024 07:04:21 -0700 Subject: [PATCH] Closes #40 use pharmaversesdtm to host dm_peds and vs_peds (#84) * need staged dependencies to check everything still works * demo pharmaversesdtm works, if properly installed * check if this works * needs to be in import * can it be suggests? * remove pharmaversesdtm:: reference * can't be removed yet * does this work? * typo * use :: convention * only use :: formatting * missed a spot * missed one * slight inconsistencies are fixed * add news entry * Update NEWS.md Co-authored-by: Ross Farrugia <82581364+rossfarrugia@users.noreply.github.com> * fix error --------- Co-authored-by: Ross Farrugia <82581364+rossfarrugia@users.noreply.github.com> --- DESCRIPTION | 3 +- NEWS.md | 1 + R/data.R | 14 -- R/derive_params_growth_age.R | 5 +- R/derive_params_growth_height.R | 7 +- data-raw/adsl_peds.R | 4 +- data-raw/dm_peds.R | 47 ------ data-raw/vs_peds.R | 262 ----------------------------- data/dm_peds.rda | Bin 1084 -> 0 bytes data/vs_peds.rda | Bin 3913 -> 0 bytes inst/templates/ad_advs.R | 31 ++-- man/adsl_peds.Rd | 5 - man/derive_params_growth_age.Rd | 5 +- man/derive_params_growth_height.Rd | 7 +- man/dm_peds.Rd | 22 --- man/vs_peds.Rd | 22 --- staged_dependencies.yaml | 2 + vignettes/advs.Rmd | 16 +- 18 files changed, 46 insertions(+), 407 deletions(-) delete mode 100644 data-raw/dm_peds.R delete mode 100644 data-raw/vs_peds.R delete mode 100644 data/dm_peds.rda delete mode 100644 data/vs_peds.rda delete mode 100644 man/dm_peds.Rd delete mode 100644 man/vs_peds.Rd diff --git a/DESCRIPTION b/DESCRIPTION index dbcd7f45..c85719b6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -48,11 +48,12 @@ Imports: Suggests: knitr, lubridate (>= 1.7.4), - pharmaversesdtm (>= 0.2.0), + pharmaversesdtm, rmarkdown, stringr (>= 1.4.0), testthat (>= 3.0.0), tibble +Remotes: pharmaverse/pharmaversesdtm@admiralpeds_data_migration VignetteBuilder: knitr Config/testthat/edition: 3 diff --git a/NEWS.md b/NEWS.md index 3b96a965..a6592c41 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,7 @@ ## Documentation - Added CRAN installation instructions to README (#10). +- Subject based test data (e.g. DM, VS) has been migrated out of `{admiralpeds}` to `{pharmaversesdtm}` (#40) ## Various diff --git a/R/data.R b/R/data.R index 3e8083b7..ac7886ea 100644 --- a/R/data.R +++ b/R/data.R @@ -193,20 +193,6 @@ #' @source \url{https://www.cdc.gov/growthcharts/percentile_data_files.htm} "cdc_bmiage" -#' Demographic Dataset-pediatrics -#' -#' An updated SDTM DM dataset with pediatric patients -#' @keywords datasets -#' @family datasets -"dm_peds" - -#' Vital signs Dataset-pediatrics -#' -#' An updated SDTM VS dataset with anthropometric measurements for pediatric patients -#' @keywords datasets -#' @family datasets -"vs_peds" - #' Subject Level Analysis Dataset-pediatrics #' #' An updated ADaM ADSL dataset with pediatric patients diff --git a/R/derive_params_growth_age.R b/R/derive_params_growth_age.R index 9c033631..c56b9b05 100644 --- a/R/derive_params_growth_age.R +++ b/R/derive_params_growth_age.R @@ -116,10 +116,11 @@ #' library(lubridate, warn.conflicts = FALSE) #' library(rlang, warn.conflicts = FALSE) #' library(admiral, warn.conflicts = FALSE) +#' library(pharmaversesdtm, warn.conflicts = FALSE) #' -#' advs <- dm_peds %>% +#' advs <- pharmaversesdtm::dm_peds %>% #' select(USUBJID, BRTHDTC, SEX) %>% -#' right_join(., vs_peds, by = "USUBJID") %>% +#' right_join(., pharmaversesdtm::vs_peds, by = "USUBJID") %>% #' mutate( #' VSDT = ymd(VSDTC), #' BRTHDT = ymd(BRTHDTC) diff --git a/R/derive_params_growth_height.R b/R/derive_params_growth_height.R index 1c33767c..89572ba5 100644 --- a/R/derive_params_growth_height.R +++ b/R/derive_params_growth_height.R @@ -114,12 +114,13 @@ #' library(lubridate, warn.conflicts = FALSE) #' library(rlang, warn.conflicts = FALSE) #' library(admiral, warn.conflicts = FALSE) +#' library(pharmaversesdtm, warn.conflicts = FALSE) #' #' # derive weight for height/length only for those under 2 years old using WHO #' # weight for length reference file -#' advs <- dm_peds %>% +#' advs <- pharmaversesdtm::dm_peds %>% #' select(USUBJID, BRTHDTC, SEX) %>% -#' right_join(., vs_peds, by = "USUBJID") %>% +#' right_join(., pharmaversesdtm::vs_peds, by = "USUBJID") %>% #' mutate( #' VSDT = ymd(VSDTC), #' BRTHDT = ymd(BRTHDTC) @@ -132,7 +133,7 @@ #' out_unit = "days" #' ) #' -#' heights <- vs_peds %>% +#' heights <- pharmaversesdtm::vs_peds %>% #' filter(VSTESTCD == "HEIGHT") %>% #' select(USUBJID, VSSTRESN, VSSTRESU, VSDTC) %>% #' rename( diff --git a/data-raw/adsl_peds.R b/data-raw/adsl_peds.R index f5adc1f2..75934740 100644 --- a/data-raw/adsl_peds.R +++ b/data-raw/adsl_peds.R @@ -11,8 +11,8 @@ library(stringr) # Create a basic ADSL for pediatrics ---- # Read in input data ---- -data("dm_peds") -data("ex") +dm_peds <- pharmaversesdtm::dm_peds +ex <- pharmaversesdtm::ex # Derivations ---- diff --git a/data-raw/dm_peds.R b/data-raw/dm_peds.R deleted file mode 100644 index b4edc65c..00000000 --- a/data-raw/dm_peds.R +++ /dev/null @@ -1,47 +0,0 @@ -# Dataset: dm_peds -# Description: Create DM test SDTM dataset for pediatric studies - -# Load libraries ----- -library(dplyr) -library(admiral) -library(pharmaversesdtm) - -# Read input test data from pharmaversesdtm ---- -data("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 deleted file mode 100644 index 538a1176..00000000 --- a/data-raw/vs_peds.R +++ /dev/null @@ -1,262 +0,0 @@ -# Dataset: vs_peds -# Description: Create VS test SDTM dataset for pediatric studies - -# Load libraries ----- -library(dplyr) -library(admiral) -library(pharmaversesdtm) - -# Read input test data from pharmaversesdtm ---- -data("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 %>% - mutate( - VSSEQ = row_number(), - 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 deleted file mode 100644 index 362c2ec0d6bf9d6d08ec6d882e459e55394f3188..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1084 zcmV-C1jGA6T4*^jL0KkKS(&>XLjVRBf5iX)-?s1v|M36!-r&FY|KLCXKmb4q&;(xW zwGxe}kSG#JNs340Q`G#Z)5>}_lntPUOqm8o)XhUDqBBU%5YrIjLnfMJ&;Y>zXfkL3 z88iR@44DAXNQ6?4Q1u!ELqlyy00001plAcs8&Ci^(8;EmGypI_8Vs5M22B6}113N; z5-6DhRR2MvK~u@Z4Fy1;5;MD?%+L}_6c`n$90v|h(T|>3a&q*u`ejnYI!1e) zFK1P8AaY31VaXX{6HdrOYQg(^o0vFpc61q1oDTTeW`@()fg(Z!1|%Z+S&@WTADrdE z_%lv`SKaFB`JNhodg0}C1zN$$TuNW8afYKsm)Bu3!mjs@bjd+w>+E5UVUg-)jX5-k z(%u&$tDjp998SSoBBIg}rv}ixgi{5z330IkIz)jDAOzA$paL497JvofVo+!jJ@yGC zZD0m=g-Fno0W^wQLA+x*c)z^^hd{_2-0_DvZ!}Rk)S~w-oeqqsf{RfD$s}~LK`k3O zs|ME(d8wy{4G^fRibe^gI*i{#37km0N|C%$N+xtLPGB8=)L$2uj>5k;5 zd+0Qq7*K67C}79^B0Zr%aEk8+ZqoEyS~`(%jJBh+wg}vZaLRKg8IGnvo<(nG%8ZaixdV_P?d3-&;Uk%|Dh)cPS%NbngiUqGu~gNfts=kN=6O>YFVY65 zuUEiaL2RH@yt`=`mAVjDB6)6lQJ140nk4p3aJDW0^OjS7h??}`xFx=>Q72Wa-iLJcMky|r$K-+_wfe!S+ekmNI6hq z)G7tDIbWyKgk`Z9I|s$a6|#7WMV!PM;bsUZh_RFth)IzatWr4%iy6m*`LR$U zm#c<01(I*VGBnUwC}SXoE%#$-#>|4VuhL<^{PO}$B@qdL5Wyw?i@744C`e4*j-i12 CN#VHw diff --git a/data/vs_peds.rda b/data/vs_peds.rda deleted file mode 100644 index db1d926abb9aa01b773d72fe0cd72989649e1ddf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3913 zcmZvZc{CJ^*T*L&Q8Th-eJq1)AsQxb0Qru&HyYf{`r6F zH+AGsME3eGy(7&24ELYY11;+S0MEp|NWlLT3ug7B0tSUIiR4N*l7xK`geR+&4ch!D z-#6OM_3j#nntH1%T>sQMWVoLxLm-g zGAl5EW|Dj2D_Ta(0J~n7Z`iC=pn!rfUwvL z6aWlhwYJkgAr$?Aa_?A+4~CcixOh>)J7w-_qm=Ycc(=|Mod8S?rVTR}vTew}8T8AciTCnzWaG zh9Gk9H$Ji(F4r#Fcy$W&?kUG<5eF#H;jNVYTjbqWdFjaRPeMC=G1Uu~UR344B)9-k z(UkgmZPf^^ZHJge6F2cBQg+6|7_!^EOF%bbNAZX72kUgSoQy zb8~xl@8IaqDb~|xIL?7I9&5^T2)^(7#$ap$&CLwVx?SmRRLcw*fJ7t!$Z>F1SW@c> z3{NaCZy&NBc1WsxT~+;tTvJ>3_Fet^hQ_83&4O}((;EPedK3P`rwQ@l*PZ3a{t5P4 z`p~!Qzwb^HCCYN#nCM7)`K{CSo_Wv{Wanx_ziGcL}~VeFUePq&ljV3JqTGTS`E;W!d&kDAFy^^crd<%@R+wnt1ay zOQjY`uw7QO#8c)D#HI|y#055vO}pMTKp1$#@FX=8cLF5A?t0R_I2 z%X52wc%P)2dTR0ZA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ve5-Fi z@R|B*YvAu=|NVjU4dJ){_8G`Y4m{H1;I?7k{LR6>p|%YXKerGVXA<^>)WrDJYI1m~ z?~&!!eCQo}sUH*0i{;;@+H}tyfuFf7hX39h9gP8~e8k!R{1Rofy~~A8HuCX|Vi-bh z05fk&CH8-vxxHj;AKRrL8?~Lx->F(oRH(7Nt6RjPN*Kp)us|mzO{SO-an_-IGt;rd z=Ad84^AozhKZ*nb3SoHrJLXqkA>|DuRQTk$eJboYo?jRWD$^NZ0eS-2JC+w|#$u^# z$;LS#98W|bh$QO)WG^8|T(dVKT05!VVq$NH?Wii*ld7jb#L=UB?DuRQ$X)*kBHh^v z*_JS>vx)hW(}swF+mA9fmdJK!6_kF0k{T7Y6o#}xSt$G#{O&I*UfN|URvUc zNNpyfo!rjtfm+B9ZeB#tVVCWK9CIh>$B&;&jBvHIQeZW`9{ zo|}QvShIF=p1+G6JJ)y~?3K%*w|=@%4wUqHd|N}?u^a|K`LDHjWJo2nmCl4U>Eb|- zU$)$R9q@NUtnk*{PDkb7$ z;K3^LmO>{t^Ge)E-+l;hR#5Yl=ipZA zkHVEy#4rz9+R7O&7CP;h>S?>qV;LA_UFzlZv^JyM^{r=Tq=GiRB=}U74elL80dE_K zZKDfFJB9D!ZYpI~f6`%VNDIXrdX`$>*KGV~d1`J|AIM&FQNr-@o`j*^vGVr>|00O> I&LHQ1086%b=>Px# diff --git a/inst/templates/ad_advs.R b/inst/templates/ad_advs.R index 154b6be7..1193fa12 100644 --- a/inst/templates/ad_advs.R +++ b/inst/templates/ad_advs.R @@ -10,6 +10,7 @@ # who_wt_for_lgth_boys, who_wt_for_lgth_girls library(admiral) +library(pharmaversesdtm) library(admiralpeds) library(dplyr) library(lubridate) @@ -29,9 +30,9 @@ The user could replace these metadata with their own chosen metadata") # For weight-based indicators we keep WHO and CDC separate due to the WHO # adjustment (restricted application of the LMS method) needed for the # anthropometric indicator derivations -data(WHO_bmi_for_age_boys) -data(WHO_bmi_for_age_girls) -data(cdc_bmiage) +who_bmi_for_age_boys <- admiralpeds::who_bmi_for_age_boys +who_bmi_for_age_girls <- admiralpeds::who_bmi_for_age_girls +cdc_bmiage <- admiralpeds::cdc_bmiage who_bmi_for_age <- who_bmi_for_age_boys %>% mutate(SEX = "M") %>% @@ -70,9 +71,9 @@ cdc_bmi_for_age <- cdc_bmiage %>% # Default reference sources: WHO for children <2 yrs old (< 730.5 days), # and CDC for children >=2 yrs old (>= 730.5 days) # Combine WHO and CDC metadata -data(who_lgth_ht_for_age_boys) -data(who_lgth_ht_for_age_girls) -data(cdc_htage) +who_lgth_ht_for_age_boys <- admiralpeds::who_lgth_ht_for_age_boys +who_lgth_ht_for_age_girls <- admiralpeds::who_lgth_ht_for_age_girls +cdc_htage <- admiralpeds::cdc_htage height_for_age <- who_lgth_ht_for_age_boys %>% mutate(SEX = "M") %>% @@ -111,9 +112,9 @@ height_for_age <- who_lgth_ht_for_age_boys %>% # For weight-based indicators we keep WHO and CDC separate due to the WHO # adjustment (restricted application of the LMS method) needed for the # anthropometric indicator derivations -data(who_wt_for_age_boys) -data(who_wt_for_age_girls) -data(cdc_wtage) +who_wt_for_age_boys <- admiralpeds::who_wt_for_age_boys +who_wt_for_age_girls <- admiralpeds::who_wt_for_age_girls +cdc_wtage <- admiralpeds::cdc_wtage who_wt_for_age <- who_wt_for_age_boys %>% mutate(SEX = "M") %>% @@ -150,8 +151,8 @@ cdc_wt_for_age <- cdc_wtage %>% ## WHO - HEAD CIRCUMFERENCE for age ---- # Default reference sources: WHO for children up to 5 yrs old -data(who_hc_for_age_boys) -data(who_hc_for_age_girls) +who_hc_for_age_boys <- admiralpeds::who_hc_for_age_boys +who_hc_for_age_girls <- admiralpeds::who_hc_for_age_girls who_hc_for_age <- who_hc_for_age_boys %>% mutate(SEX = "M") %>% @@ -164,8 +165,8 @@ who_hc_for_age <- who_hc_for_age_boys %>% ## WHO - WEIGHT for LENGTH ---- # Default reference sources: WHO for children <2 yrs old (< 730.5 days) -data(who_wt_for_lgth_boys) -data(who_wt_for_lgth_girls) +who_wt_for_lgth_boys <- admiralpeds::who_wt_for_lgth_boys +who_wt_for_lgth_girls <- admiralpeds::who_wt_for_lgth_girls who_wt_for_lgth <- who_wt_for_lgth_boys %>% mutate(SEX = "M") %>% @@ -180,8 +181,8 @@ who_wt_for_lgth <- who_wt_for_lgth_boys %>% # as needed and assign to the variables below. # For illustration purposes read in admiral test data -data("vs_peds") -data("adsl_peds") +vs_peds <- pharmaversesdtm::vs_peds +adsl_peds <- admiralpeds::adsl_peds vs <- vs_peds adsl <- adsl_peds %>% select(-DOMAIN) diff --git a/man/adsl_peds.Rd b/man/adsl_peds.Rd index fdc44002..919f8926 100644 --- a/man/adsl_peds.Rd +++ b/man/adsl_peds.Rd @@ -13,10 +13,5 @@ adsl_peds \description{ An updated ADaM ADSL dataset with pediatric patients } -\seealso{ -Datasets -\code{\link{dm_peds}}, -\code{\link{vs_peds}} -} \concept{datasets} \keyword{datasets} diff --git a/man/derive_params_growth_age.Rd b/man/derive_params_growth_age.Rd index 9f1a05ba..b6a21e6e 100644 --- a/man/derive_params_growth_age.Rd +++ b/man/derive_params_growth_age.Rd @@ -130,10 +130,11 @@ library(dplyr, warn.conflicts = FALSE) library(lubridate, warn.conflicts = FALSE) library(rlang, warn.conflicts = FALSE) library(admiral, warn.conflicts = FALSE) +library(pharmaversesdtm, warn.conflicts = FALSE) -advs <- dm_peds \%>\% +advs <- pharmaversesdtm::dm_peds \%>\% select(USUBJID, BRTHDTC, SEX) \%>\% - right_join(., vs_peds, by = "USUBJID") \%>\% + right_join(., pharmaversesdtm::vs_peds, by = "USUBJID") \%>\% mutate( VSDT = ymd(VSDTC), BRTHDT = ymd(BRTHDTC) diff --git a/man/derive_params_growth_height.Rd b/man/derive_params_growth_height.Rd index f7c0026f..51f3513e 100644 --- a/man/derive_params_growth_height.Rd +++ b/man/derive_params_growth_height.Rd @@ -127,12 +127,13 @@ library(dplyr, warn.conflicts = FALSE) library(lubridate, warn.conflicts = FALSE) library(rlang, warn.conflicts = FALSE) library(admiral, warn.conflicts = FALSE) +library(pharmaversesdtm, warn.conflicts = FALSE) # derive weight for height/length only for those under 2 years old using WHO # weight for length reference file -advs <- dm_peds \%>\% +advs <- pharmaversesdtm::dm_peds \%>\% select(USUBJID, BRTHDTC, SEX) \%>\% - right_join(., vs_peds, by = "USUBJID") \%>\% + right_join(., pharmaversesdtm::vs_peds, by = "USUBJID") \%>\% mutate( VSDT = ymd(VSDTC), BRTHDT = ymd(BRTHDTC) @@ -145,7 +146,7 @@ advs <- dm_peds \%>\% out_unit = "days" ) -heights <- vs_peds \%>\% +heights <- pharmaversesdtm::vs_peds \%>\% filter(VSTESTCD == "HEIGHT") \%>\% select(USUBJID, VSSTRESN, VSSTRESU, VSDTC) \%>\% rename( diff --git a/man/dm_peds.Rd b/man/dm_peds.Rd deleted file mode 100644 index da99dfb8..00000000 --- a/man/dm_peds.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% 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. -} -\usage{ -dm_peds -} -\description{ -An updated SDTM DM dataset with pediatric patients -} -\seealso{ -Datasets -\code{\link{adsl_peds}}, -\code{\link{vs_peds}} -} -\concept{datasets} -\keyword{datasets} diff --git a/man/vs_peds.Rd b/man/vs_peds.Rd deleted file mode 100644 index 681ade11..00000000 --- a/man/vs_peds.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% 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. -} -\usage{ -vs_peds -} -\description{ -An updated SDTM VS dataset with anthropometric measurements for pediatric patients -} -\seealso{ -Datasets -\code{\link{adsl_peds}}, -\code{\link{dm_peds}} -} -\concept{datasets} -\keyword{datasets} diff --git a/staged_dependencies.yaml b/staged_dependencies.yaml index 734bdadb..304b872c 100644 --- a/staged_dependencies.yaml +++ b/staged_dependencies.yaml @@ -4,6 +4,8 @@ upstream_repos: host: https://github.com - repo: pharmaverse/admiraldev host: https://github.com + - repo: pharmaverse/pharmaversesdtm + host: https://github.com downstream_repos: diff --git a/vignettes/advs.Rmd b/vignettes/advs.Rmd index 0df866cb..e35254c9 100644 --- a/vignettes/advs.Rmd +++ b/vignettes/advs.Rmd @@ -15,6 +15,7 @@ knitr::opts_chunk$set( ) library(admiral) library(admiraldev) +library(rlang) ``` # Introduction @@ -46,6 +47,7 @@ Once the required packages have been loaded, the first step is preparing the met ```{r message=FALSE} library(admiral) +library(pharmaversesdtm, warn.conflicts = FALSE) library(admiralpeds) library(dplyr, warn.conflicts = FALSE) library(lubridate) @@ -106,9 +108,9 @@ We do this pre-processing of the metadata using the following code for BMI as an example: ```{r eval=TRUE} -data(WHO_bmi_for_age_boys) -data(WHO_bmi_for_age_girls) -data(cdc_bmiage) +who_bmi_for_age_boys <- admiralpeds::who_bmi_for_age_boys +who_bmi_for_age_girls <- admiralpeds::who_bmi_for_age_girls +cdc_bmiage <- admiralpeds::cdc_bmiage who_bmi_for_age <- who_bmi_for_age_boys %>% mutate(SEX = "M") %>% @@ -193,8 +195,8 @@ files if preferred. We do this using the following code: ```{r eval=TRUE} -data(who_wt_for_lgth_boys) -data(who_wt_for_lgth_girls) +who_wt_for_lgth_boys <- admiralpeds::who_wt_for_lgth_boys +who_wt_for_lgth_girls <- admiralpeds::who_wt_for_lgth_girls who_wt_for_lgth <- who_wt_for_lgth_boys %>% mutate(SEX = "M") %>% @@ -230,8 +232,8 @@ include the pediatrics-specific parameters as needed - for example: | BMIPCTL | BMI-for-age percentile | 10 | Subject Characteristic | 1 | ```{r echo=FALSE, message=FALSE} -data("vs_peds") -data("adsl_peds") +vs_peds <- pharmaversesdtm::vs_peds +adsl_peds <- admiralpeds::adsl_peds vs <- convert_blanks_to_na(vs_peds) adsl <- adsl_peds %>% select(-DOMAIN)