Improvement of `format_ae_listing()`
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 22
- Forks
- 6
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 7
Description
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:
- https://github.com/Merck/forestly/blob/main/R/ae_listing.R#L206-L216
- https://github.com/Merck/forestly/blob/main/R/ae_listing.R#L226-L275
- https://github.com/Merck/forestly/blob/main/R/ae_listing.R#L298-L311
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.
- https://github.com/Merck/forestly/blob/main/R/ae_listing.R#L277-L296
- https://github.com/Merck/forestly/blob/main/R/ae_listing.R#L313-L398
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()
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.
Research direction
Start in R/ae_listing.R, especially format_ae_listing() and the linked ranges around lines 206-398, then reproduce the example using prepare_ae_forestly() and format_ae_forestly(). Check which required variables and data manipulations break listings without AREL; done means the listing works with the shown inputs and displays the source data without unnecessary transformations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100