Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

204 admiral updates #213

Merged
merged 8 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: admiralophtha
Type: Package
Title: ADaM in R Asset Library - Ophthalmology
Version: 0.3.0.9002
Version: 0.3.0.9003
Authors@R: c(
person("Edoardo", "Mancini", email = "[email protected]", role = c("aut", "cre")),
person("Ritika", "Aggarwal", email = "[email protected]", role = c("aut")),
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@

- Removed `analysis_value` argument in the calls to `derive_param_computed()` in ADBCVA template in line with the deprecation of this argument in the new version of `{admiral}`. Variable values for parameters of interest are now all populated through the `set_values_to` argument (#207).

- Modified calls to `derive_summary_records()` in ADVFQ template in line with the updates to this function in the new version of the `{admiral}` package. The `filter` argument is now renamed to `filter_add`, the argument `dataset_add` is now always specified and the variable values are now all populated through the `set_values_to` argument (#204).

## Updates to Documentation

- Added release date for `{admiralophtha}` 1.0 to the front page (#203).

- Removed `analysis_value` argument in the calls to `derive_param_computed()` in ADBCVA vignette in line with the deprecation of this argument in the new version of `{admiral}`. Variable values for parameters of interest are now all populated through the `set_values_to` argument (#207).

- Modified calls to `derive_summary_records()` in ADVFQ vignette in line with the updates to this function in the new version of the `{admiral}` package. The `filter` argument is now renamed to `filter_add`, the argument `dataset_add` is now always specified and the variable values are now all populated through the `set_values_to` argument (#204).

## Various

- Website now has button/links to Slack channel and GitHub Issues (#206).
Expand Down
81 changes: 49 additions & 32 deletions inst/templates/ad_advfq.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ advfq_aval <- advfq_dtdy %>%
# else set to 0 if [advfq.AVAL] = 5
advfq_qr01 <- advfq_aval %>%
derive_summary_records(
dataset_add = advfq_aval,
by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, PARAMCD, VISITNUM, VISIT, ADT, ADY),
filter = QSTESTCD == "VFQ1" & !is.na(AVAL),
analysis_var = AVAL,
summary_fun = identity,
set_values_to = exprs(PARAMCD = "QR01")
filter_add = QSTESTCD == "VFQ1" & !is.na(AVAL),
set_values_to = exprs(
AVAL = identity(AVAL),
PARAMCD = "QR01"
)
) %>%
mutate(AVAL = ifelse(PARAMCD == "QR01",
case_when(
Expand All @@ -101,11 +103,13 @@ advfq_qr01 <- advfq_aval %>%
# else set to 0 if [advfq.AVAL] = 6
advfq_qr02 <- advfq_qr01 %>%
derive_summary_records(
dataset_add = advfq_qr01,
by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, PARAMCD, VISITNUM, VISIT, ADT, ADY),
filter = QSTESTCD == "VFQ2" & !is.na(AVAL),
analysis_var = AVAL,
summary_fun = identity,
set_values_to = exprs(PARAMCD = "QR02")
filter_add = QSTESTCD == "VFQ2" & !is.na(AVAL),
set_values_to = exprs(
AVAL = identity(AVAL),
PARAMCD = "QR02"
)
) %>%
mutate(AVAL = ifelse(PARAMCD == "QR02",
case_when(
Expand All @@ -127,11 +131,13 @@ advfq_qr02 <- advfq_qr01 %>%
# else set to 0 if [advfq.AVAL] = 1
advfq_qr03 <- advfq_qr02 %>%
derive_summary_records(
dataset_add = advfq_qr02,
by_vars = exprs(STUDYID, USUBJID, PARAMCD, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY),
filter = QSTESTCD == "VFQ3" & !is.na(AVAL),
analysis_var = AVAL,
summary_fun = identity,
set_values_to = exprs(PARAMCD = "QR03")
filter_add = QSTESTCD == "VFQ3" & !is.na(AVAL),
set_values_to = exprs(
AVAL = identity(AVAL),
PARAMCD = "QR03"
)
) %>%
mutate(AVAL = ifelse(PARAMCD == "QR03",
case_when(
Expand All @@ -153,11 +159,13 @@ advfq_qr03 <- advfq_qr02 %>%
# else set to 0 if [advfq.AVAL] = 1
advfq_qr04 <- advfq_qr03 %>%
derive_summary_records(
dataset_add = advfq_qr03,
by_vars = exprs(STUDYID, USUBJID, PARAMCD, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY),
filter = QSTESTCD == "VFQ4" & !is.na(AVAL),
analysis_var = AVAL,
summary_fun = identity,
set_values_to = exprs(PARAMCD = "QR04")
filter_add = QSTESTCD == "VFQ4" & !is.na(AVAL),
set_values_to = exprs(
AVAL = identity(AVAL),
PARAMCD = "QR04"
)
) %>%
mutate(AVAL = ifelse(PARAMCD == "QR04",
case_when(
Expand All @@ -175,23 +183,27 @@ advfq_qr04 <- advfq_qr03 %>%
# Average of QR01 and QR02 records
advfq_qsg01 <- advfq_qr04 %>%
derive_summary_records(
dataset_add = advfq_qr04,
by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY),
filter = PARAMCD %in% c("QR01", "QR02") & !is.na(AVAL),
analysis_var = AVAL,
summary_fun = mean,
set_values_to = exprs(PARAMCD = "QSG01")
filter_add = PARAMCD %in% c("QR01", "QR02") & !is.na(AVAL),
set_values_to = exprs(
AVAL = mean(AVAL),
PARAMCD = "QSG01"
)
)

## Derive a new record as a summary record ----
## QSG02 General Score 02
# Average of QR03 and QR04 records
advfq_qsg02 <- advfq_qsg01 %>%
derive_summary_records(
dataset_add = advfq_qsg01,
by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY),
filter = PARAMCD %in% c("QR03", "QR04") & !is.na(AVAL),
analysis_var = AVAL,
summary_fun = mean,
set_values_to = exprs(PARAMCD = "QSG02")
filter_add = PARAMCD %in% c("QR03", "QR04") & !is.na(AVAL),
set_values_to = exprs(
AVAL = mean(AVAL),
PARAMCD = "QSG02"
)
)


Expand All @@ -200,11 +212,13 @@ advfq_qsg02 <- advfq_qsg01 %>%
# Average of QSG01 and QSG02 records
advfq_qbcs <- advfq_qsg02 %>%
derive_summary_records(
dataset_add = advfq_qsg02,
by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY),
filter = PARAMCD %in% c("QSG01", "QSG02") & !is.na(AVAL),
analysis_var = AVAL,
summary_fun = sum,
set_values_to = exprs(PARAMCD = "QBCSCORE")
filter_add = PARAMCD %in% c("QSG01", "QSG02") & !is.na(AVAL),
set_values_to = exprs(
AVAL = sum(AVAL),
PARAMCD = "QBCSCORE"
)
)

## Get visit info ----
Expand All @@ -220,11 +234,14 @@ advfq_visit <- advfq_qbcs %>%
!is.na(VISIT) ~ str_to_title(VISIT),
TRUE ~ NA_character_
),
AVISITN = as.numeric(case_when(
AVISITN = case_when(
VISIT == "BASELINE" ~ "0",
str_detect(VISIT, "WEEK") ~ str_trim(str_replace(VISIT, "WEEK", "")),
TRUE ~ NA_character_
))
str_detect(VISIT, "WEEK") ~ VISIT %>%
str_replace("WEEK", "") %>%
str_replace("\\(T\\)", "") %>%
str_trim(),
TRUE ~ NA
),
)

advfq_ontrt <- advfq_visit %>%
Expand Down
20 changes: 12 additions & 8 deletions vignettes/advfq.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,13 @@ Run this section of code for every question that you need recoding. This gives a
# else set to 0 if [advfq.AVAL] = 5
advfq <- advfq %>%
derive_summary_records(
dataset_add = advfq,
by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, PARAMCD, VISITNUM, VISIT),
filter = QSTESTCD == "VFQ1" & !is.na(AVAL),
analysis_var = AVAL,
summary_fun = identity,
set_values_to = exprs(PARAMCD = "QR01")
filter_add = QSTESTCD == "VFQ1" & !is.na(AVAL),
set_values_to = exprs(
AVAL = identity(AVAL),
PARAMCD = "QR01"
)
) %>%
mutate(AVAL = ifelse(PARAMCD == "QR01",
case_when(
Expand All @@ -152,11 +154,13 @@ Next, the programmer should create summary records as average of recoded questio
# Average of QR01 and QR02 records
advfq <- advfq %>%
derive_summary_records(
dataset_add = advfq,
by_vars = exprs(STUDYID, USUBJID, !!!adsl_vars, VISITNUM, VISIT, ADT, ADY),
filter = PARAMCD %in% c("QR01", "QR02") & !is.na(AVAL),
analysis_var = AVAL,
summary_fun = mean,
set_values_to = exprs(PARAMCD = "QSG01")
filter_add = PARAMCD %in% c("QR01", "QR02") & !is.na(AVAL),
set_values_to = exprs(
AVAL = mean(AVAL),
PARAMCD = "QSG01"
)
)
```

Expand Down
Loading