Serious AE listing is not presented while it is included in the metadata
@LittleBeannie is already working on this.
Since Sep 18, 2026.
- Dominant language
- R
- Stars
- 22
- Forks
- 6
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 7
Description
The following code generates interactive AE forest plots for any AE, drug-related AE, and serious AE. For serious AEs, it shows that there are no records to be displayed.
```
# Load all required R packages, no changes needed.
library(metalite)
library(metalite.ae)
library(forestly)
library(dplyr)
library(tidyr)
library(haven)
```
```{r, CreateAEForestelyPlan}
# Create analysis plan for AE forestly
plan <- plan(
analysis = "ae_forestly",
population = "apat",
observation = "wk12",
parameter = "any;rel;ser"
)
# Create a metadata representation for ADaM data analysis
# For adverse event analyses: AE records in observation (adae), population info in population dataset (adsl)
# Assumes adae and adsl datasets are already loaded and prepared
adsl <- forestly::forestly_adsl
adae <- forestly::forestly_adae
# Factorize treatment groups
adsl$TRT01A <- factor(
adsl$TRT01A,
levels = c("Placebo", "Xanomeline Low Dose"),
labels = c("Placebo", "Xanomeline Low Dose")
)
adae$TRTA <- factor(
adae$TRTA,
levels = c("Placebo", "Xanomeline Low Dose"),
labels = c("Placebo", "Xanomeline Low Dose")
)
# Define metadata
meta <- meta_adam(observation = adae, population = adsl)
# Use the analysis plan created in meta-planning section
# Define analysis plan meta information for ADaM dataset
meta <- meta |> define_plan(plan)
# Define analysis meta information using user inputs from Shiny app
meta <- meta |>
# Define population meta information
define_population(
name = "apat",
var = c("USUBJID", "SAFFL", "TRT01A", "SITEID", "SEX", "RACE", "AGE"),
group = "TRT01A",
subset = SAFFL == 'Y',
label = "All Participants as Treated"
) |>
# Define observation meta information
define_observation(
name = "wk12",
var = c("USUBJID", "SAFFL", "TRTA", "AEDECOD", "AEBODSYS", "AEREL", "AESER", "AEOUT", "AEACN", "AESDTH", "ASTDT", "AENDT"),
group = "TRTA",
subset = SAFFL == 'Y',
label = "Weeks 0 to 12"
) |>
# Define parameter for AE forestly
define_parameter(
name = "any",
var = "AEDECOD",
soc = "AEBODSYS",
label = "All AEs"
) |>
define_parameter(
name = "rel",
subset = toupper(AREL) == "RELATED",
var = "AEDECOD",
soc = "AEBODSYS",
label = "Drug-related AEs"
) |>
define_parameter(
name = "ser",
subset = AESER == "Y",
var = "AEDECOD",
soc = "AEBODSYS",
label = "Serious AEs"
) |>
# Define analysis meta information for AE forestly
define_analysis(
name = "ae_forestly",
title = "Interactive Forest Plot for Adverse Events"
)
# Build complete meta information for AE forestly analysis
meta <- meta |> meta_build()
# Generate AE Interactive Forest Plot
meta |>
prepare_ae_forestly(
population = "apat",
observation = "wk12",
parameter = "any;rel;ser"
) |>
format_ae_forestly() |>
ae_forestly(
display_soc_toggle = TRUE,
display_diff_toggle = FALSE,
filter = c("prop", "n"),
width = 1400,
dowload_button = FALSE
)
```
However, there is 1 serious AE record, which should be provided in the drill down listing.
```
x <- meta |>
prepare_ae_forestly(
population = "apat",
observation = "wk12",
parameter = "any;rel;ser"
) |>
format_ae_forestly()
x$ae_listing |> filter(param == "ser")
> Adverse_Event SOC_Name Treatment_Group
7022 Syncope NERVOUS SYSTEM DISORDERS Xanomeline Low Dose
Unique_Participant_ID Site_Number Gender Race Age Relative_Day_of_Onset
7022 01-718-1170 718 F White 80 27
Serious Related Action_Taken Outcome Duration param
7022 Y Probable N/A Resolved 2 Day ser
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.