Skip to content

Commit

Permalink
#32 first draft of combined metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Fanny-Gautier committed May 6, 2024
1 parent 9218e74 commit 701c7b0
Showing 1 changed file with 130 additions and 0 deletions.
130 changes: 130 additions & 0 deletions inst/templates/ad_advs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Name: ADVS
#
# Label: Vital Signs Analysis Dataset
#
# Input: adsl, vs
library(admiral)
library(pharmaversesdtm) # Contains example datasets from the CDISC pilot project
library(dplyr)
library(lubridate)
library(stringr)

#Modified ADVS template to be added here
#
#
#
#


# Creation of the Growth metadata combining WHO and CDC
# Default reference sources: WHO for children <2 yrs old (<730 days),
# and CDC for children >=2 yrs old (>= 730.5 days)
# Load WHO and CDC metadata datasets ----

message("Please be aware that our default reference source is in our metadata :
WHO for <2 yrs old children, and CDC for >=2 yrs old children.
The user could replace these metadata with their own chosen metadata")

## BMI for age
data(WHO_bmi_for_age_boys)
data(WHO_bmi_for_age_girls)
data(cdc_bmiage)

bmi_for_age <- who_bmi_for_age_boys %>%
filter(Day <= 729) %>%
mutate(SEX = "M") %>%
rbind(who_bmi_for_age_girls %>%
filter(Day <= 729) %>%
mutate(SEX = "F")) %>%
rename(AGE = Day) %>%
rbind(cdc_bmiage %>%
mutate(
SEX = case_when(
SEX == 1 ~ "M",
SEX == 2 ~ "F",
TRUE ~ NA_character_
),
AGE = AGE * 30.4375
)) %>%
arrange(AGE, SEX)

## HEIGHT for age
data(who_lgth_ht_for_age_boys)
data(who_lgth_ht_for_age_girls)
data(cdc_htage)

height_for_age <- who_lgth_ht_for_age_boys %>%
filter(Day <= 729) %>%
mutate(SEX = "M") %>%
rbind(who_lgth_ht_for_age_girls %>%
filter(Day <= 729) %>%
mutate(SEX = "F")) %>%
rename(AGE = Day) %>%
rbind(cdc_htage %>%
mutate(
SEX = case_when(
SEX == 1 ~ "M",
SEX == 2 ~ "F",
TRUE ~ NA_character_
),
AGE = AGE * 30.4375
)) %>%
arrange(AGE, SEX)

## WEIGHT for age
data(who_wt_for_age_boys)
data(who_wt_for_age_girls)
data(cdc_wtage)

weight_for_age <- who_wt_for_age_boys %>%
filter(Day <= 729) %>%
mutate(SEX = "M") %>%
rbind(who_wt_for_age_girls %>%
filter(Day <= 729) %>%
mutate(SEX = "F")) %>%
rename(AGE = Day) %>%
rbind(cdc_wtage %>%
mutate(
SEX = case_when(
SEX == 1 ~ "M",
SEX == 2 ~ "F",
TRUE ~ NA_character_
),
AGE = AGE * 30.4375
)) %>%
arrange(AGE, SEX)


## WHO - HEAD CIRCUMFERENCE for age
data(who_hc_for_age_boys)
data(who_hc_for_age_girls)

who_hc_for_age <- who_hc_for_age_boys %>%
filter(Day <= 729) %>%
mutate(SEX = "M") %>%
rbind(who_hc_for_age_girls %>%
filter(Day <= 729) %>%
mutate(SEX = "F")) %>%
rename(AGE = Day) %>%
arrange(AGE, SEX)

## WHO - WEIGHT/HEIGHT
data(who_wt_for_ht_boys)
data(who_wt_for_ht_girls)
data(who_wt_for_lgth_boys)
data(who_wt_for_lgth_girls)

who_wt_for_ht_lgth <- who_wt_for_ht_boys %>%
mutate(SEX = "M") %>%
rbind(who_wt_for_ht_girls %>%
mutate(SEX = "F")) %>%
mutate(MEASURE = "HEIGHT") %>%
rename(HEIGHT_LENGTH = Height) %>%
rbind(who_wt_for_lgth_boys %>%
mutate(SEX = "M") %>%
rbind(who_wt_for_lgth_girls %>%
mutate(SEX = "F")) %>%
mutate(MEASURE = "LENGTH") %>%
rename(HEIGHT_LENGTH = Length))


0 comments on commit 701c7b0

Please sign in to comment.