Skip to content

Update react_base_char by incorporating population and observation from both baseline characteristics table and AE specific table #120

@LittleBeannie

Description

@LittleBeannie

The current react_base_char asks only one population and one observation.

react_base_char(
  metadata_sl,
  metadata_ae,
  population = "apat",
  observation = "wk12",
  display_total = TRUE,
  sl_parameter = "age;gender;race",
  ae_subgroup = c("gender", "race"),
  ae_specific = "rel",
  width = 1200
)

However, the population and observation of the baseline characteristics table can be different from that of the AE specific table. For example, the baseline characteristics table usually is on the ITT population, while the AE specific table is usually on the APAT population. We need to update react_base_char to allow one population for baseline characteristics, one population for AE specific; one observation for baseline characteristics, one observation for AE specific.

react_base_char(
  metadata_sl,
  metadata_ae,
  population_sl,
  observation_sl,
  population_ae,
  observation_ae,
  display_total = TRUE,
  sl_parameter = "age;gender;race",
  ae_subgroup = c("gender", "race"),
  ae_specific = "rel",
  width = 1200
)

Here is an example that can be used for testing when the development is finished.

adsl <- r2rtf::r2rtf_adsl |> 
  filter(TRT01P %in% c("Placebo", "Xanomeline High Dose")) |>
  mutate(TRT01P = factor(TRT01P,
                         levels = c("Placebo", "Xanomeline High Dose"),
                         labels = c("Control", "Experimental")),
         TRT01A = factor(TRT01A,
                         levels = c("Placebo", "Xanomeline High Dose"),
                         labels = c("Control", "Experimental")),
         RACE = stringr::str_to_sentence(RACE))

adae <- forestly_adae |> 
  filter(TRTA %in% c("Placebo", "Xanomeline High Dose")) |>
  rename(TRT01A = TRTA) |>
  mutate(TRT01A = factor(TRT01A,
                         levels = c("Placebo", "Xanomeline High Dose"),
                         labels = c("Control", "Experimental"))) |>
  left_join(adsl |> select(USUBJID, SUBJID, TRT01P, EFFFL))

meta_base_char <- meta_adam(population = adsl,
                            observation = adsl) |>
  define_plan(plan = plan(analysis = "base_char", 
                          population = "itt",
                          observation = "itt", 
                          parameter = "age;gender;race")) |>
  define_population(name = "itt",
                    group = "TRT01P",
                    subset = EFFFL == "Y",
                    var = c("USUBJID", "TRT01P", "EFFFL", "AGEGR1", "SEX", "RACE"),
                    label = "ITT population") |>
  define_observation(name = "itt",
                     group = "TRT01P",
                     subset = EFFFL == "Y",
                     var = c("USUBJID", "TRT01P", "EFFFL", "AGEGR1", "SEX", "RACE"),
                     label = "ITT") |>
  define_parameter(name = "age",
                   var = "AGE",
                   label = "Age (years)",
                   vargroup = "AGEGR1") |>
  define_parameter(name = "gender",
                   var = "SEX",
                   label = "Gender") |>
  define_parameter(name = "race",
                   var = "RACE",
                   label = "Race") |>
  define_analysis(name = "base_char",
                  title = "Participant Baseline Characteristics by Treatment Group",
                  label = "baseline characteristic table") |>
  meta_build()

subject_itt_apat_both <- adsl |> filter(EFFFL == 'Y', SAFFL == "Y") |> pull(USUBJID)

meta_base_char_subgrp_ae <- meta_adam(population = adsl,
                                      observation = adae) |>
  define_plan(plan = plan(analysis = "ae_specific", 
                          population = "itt-overlap-with-apat",
                          observation = "itt-overlap-with-apat", 
                          parameter = "serious")) |>
  define_population(name = "itt-overlap-with-apat",
                    group = "TRT01P",
                    subset = USUBJID %in% subject_itt_apat_both ,
                    label = "ITT overlap with APAT") |>
  define_observation(name = "itt-overlap-with-apat",
                     group = "TRT01P",
                     subset = USUBJID %in% subject_itt_apat_both,
                     label = "ITT overlap with APAT") |>
  define_parameter(name = "serious",
                   subset = AESER == "Y",
                   label = "Serious AEs",
                   var = "AEDECOD", soc = "AEBODSYS",
                   term1 = "Serious", term2 = "")|>
  define_analysis(name = "ae_specific",
                  title = "AE specific analysis") |>
  meta_build()

react_base_char(metadata_sl = meta_base_char,
                metadata_ae = meta_base_char_subgrp_ae,
                population_sl = "itt",
                observation_sl = "itt",
                population_ae = "itt-overlap-with-apat",
                observation_ae= "itt-overlap-with-apat",
                sl_parameter = "age;gender;race",
                ae_subgroup = c("age", "gender"),
                ae_specific = "serious",
                width = 1200,
                display_total = TRUE)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions