Skip to content

Improvement of format_ae_listing() #138

Description

@LittleBeannie

The following code works without AREL in the ae_listing_display =.... After a quick debuging, the error seems to come from format_ae_listing() (maybe from https://github.com/Merck/forestly/blob/main/R/ae_listing.R#L313-L398).

In format_ae_listing(), we defaultly requried some variables for AE listing, including the following:

Furthermore, we did some data manuplication (see below links), which is NOT required. We are suggested to display what's exactly the data. These manuplication can be time consuming.

adsl <- forestly_adsl 
adae <- forestly_adae

adsl$TRTA <- factor(forestly_adsl$TRT01A,
                    levels = c("Xanomeline Low Dose", "Placebo"),
                    labels = c("Low Dose", "Placebo")
)
adae$TRTA <- factor(forestly_adae$TRTA,
                    levels = c("Xanomeline Low Dose", "Placebo"),
                    labels = c("Low Dose", "Placebo")
)

meta <- meta_adam(population = adsl, observation = adae) |>
  define_plan(plan = plan(
    analysis = "ae_forestly",
    population = "apat",
    observation = "apat",
    parameter = "any;drug-related"
  )) |>
  define_analysis(name = "ae_forestly", label = "Interactive Forest Plot") |>
  define_population(
    name = "apat", group = "TRTA", id = "USUBJID",
    subset = SAFFL == "Y", label = "All Patient as Treated"
  ) |>
  define_observation(
    name = "apat", group = "TRTA",
    subset = SAFFL == "Y", label = "All Patient as Treated"
  ) |>
  define_parameter(
    name = "any",
    subset = NULL,
    label = "Any AEs",
    var = "AEDECOD", soc = "AEBODSYS"
  ) |>
  define_parameter(
    name = "drug-related",
    subset = toupper(AREL) == "RELATED",
    label = "Drug-related AEs",
    var = "AEDECOD", soc = "AEBODSYS"
  ) |>
  meta_build()

meta |>
  prepare_ae_forestly(ae_listing_display = c("USUBJID", "SITEID", "SEX", "RACE", "AGE", "AREL")) |>
  format_ae_forestly() |>
  ae_forestly()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions