Skip to content

Commit

Permalink
Merge pull request #26 from Merck/parameter-default
Browse files Browse the repository at this point in the history
inherit paramter_term from all parameters of a metadata by default.
  • Loading branch information
wangben718 authored Dec 31, 2023
2 parents a2f36cf + d31950e commit 947eb3b
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 29 deletions.
5 changes: 3 additions & 2 deletions R/ae_forestly.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@
#' dataset_adsl = adsl,
#' dataset_adae = adae,
#' population_term = "apat",
#' observation_term = "wk12"
#' observation_term = "wk12",
#' parameter = "any;rel"
#' ) |>
#' prepare_ae_forestly(parameter = "any;rel") |>
#' prepare_ae_forestly() |>
#' format_ae_forestly() |>
#' ae_forestly()
#' }
Expand Down
5 changes: 3 additions & 2 deletions R/format_ae_forestly.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@
#' dataset_adsl = adsl,
#' dataset_adae = adae,
#' population_term = "apat",
#' observation_term = "wk12"
#' observation_term = "wk12",
#' parameter = "any;rel"
#' ) |>
#' prepare_ae_forestly(parameter = "any;rel")|>
#' prepare_ae_forestly()|>
#' format_ae_forestly()
format_ae_forestly <- function(
outdata,
Expand Down
7 changes: 4 additions & 3 deletions R/meta_forestly.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@
#' forestly_adsl,
#' forestly_adae,
#' population_term = "apat",
#' observation_term = "wk12"
#' observation_term = "wk12",
#' parameter_term = "any;rel"
#' )
meta_forestly <- function(
dataset_adsl,
dataset_adae,
population_term,
observation_term,
parameter_term = "any;rel",
population_subset = SAFFL == "Y",
observation_subset = SAFFL == "Y",
treatment_group = "TRTA",
parameter_term = "any;rel;ser") {
treatment_group = "TRTA") {
meta <- metalite::meta_adam(
population = as.data.frame(dataset_adsl),
observation = as.data.frame(dataset_adae)
Expand Down
15 changes: 11 additions & 4 deletions R/prepare_ae_forestly.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@
#' dataset_adsl = adsl,
#' dataset_adae = adae,
#' population_term = "apat",
#' observation_term = "wk12"
#' observation_term = "wk12",
#' parameter = "any;rel"
#' ) |>
#' prepare_ae_forestly(parameter = "any;rel")
#' prepare_ae_forestly()
prepare_ae_forestly <- function(
meta,
population = NULL,
observation = NULL,
parameter,
parameter = NULL,
reference_group = NULL,
ae_listing_display = c(
"SEX", "RACE", "AGE", "ASTDY", "AESEV", "AESER",
"AEREL", "AEACN", "AEOUT", "SITEID", "ADURN", "ADURU"
)) {
parameters <- unlist(strsplit(parameter, ";"))


if (is.null(population)) {
if (length(meta$population) == 1) {
Expand All @@ -64,6 +65,12 @@ prepare_ae_forestly <- function(
}
}

if( is.null(parameter)){
parameters <- names(meta$parameter)
}else{
parameters <- unlist(strsplit(parameter, ";"))
}

res <- lapply(parameters, function(x) {
# print(x)
metalite.ae::prepare_ae_specific(meta,
Expand Down
5 changes: 3 additions & 2 deletions man/ae_forestly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/format_ae_forestly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions man/meta_forestly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/prepare_ae_forestly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions vignettes/forestly.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ meta_forestly(
dataset_adsl = forestly_adsl,
dataset_adae = forestly_adae,
population_term = "apat",
observation_term = "wk12"
observation_term = "wk12",
parameter_term = "any;rel;ser"
) |>
prepare_ae_forestly(parameter = "any;rel;ser") |>
prepare_ae_forestly() |>
format_ae_forestly() |>
ae_forestly()
```
Expand Down Expand Up @@ -89,7 +90,8 @@ meta_forestly(
dataset_adsl = forestly_adsl,
dataset_adae = forestly_adae,
population_term = "apat",
observation_term = "wk12"
observation_term = "wk12",
parameter_term = "any;rel;ser"
)
```

Expand Down
6 changes: 3 additions & 3 deletions vignettes/layout.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ metadata <- meta_forestly(
dataset_adsl = forestly_adsl_3grp,
dataset_adae = forestly_adae_3grp,
population_term = "apat",
observation_term = "wk12"
observation_term = "wk12",
parameter_term = "any;rel;ser"
)
outdata <- metadata |> prepare_ae_forestly(parameter = "any;rel;ser")
outdata <- metadata |> prepare_ae_forestly()
outdata
```
Expand Down Expand Up @@ -121,7 +122,6 @@ listing_var <- c(
metadata |>
prepare_ae_forestly(
parameter = "any;rel;ser",
ae_listing_display = listing_var
) |>
format_ae_forestly() |>
Expand Down

0 comments on commit 947eb3b

Please sign in to comment.