Skip to content

Commit

Permalink
#204 updates to derive_summary_records()
Browse files Browse the repository at this point in the history
  • Loading branch information
manciniedoardo committed Nov 10, 2023
1 parent cff98e2 commit f0b3404
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 22 deletions.
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 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 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
56 changes: 35 additions & 21 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")
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")
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")
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")
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")
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")
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")
set_values_to = exprs(
AVAL = sum(AVAL),
PARAMCD = "QBSCORE"
)
)

## Get visit info ----
Expand Down

0 comments on commit f0b3404

Please sign in to comment.