Cause an error when non-existing columns are selected in `collect_observation_record(var=...)`
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 18
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
The following code returns an error because "AGEU" is not included in meta$data_observation. It would be better to raise an error message for this situation.
library(metalite)
library(forestly)
adsl <- forestly_adsl
adae <- forestly_adae
adsl$TRTA <- factor(adsl$TRTA, levels = c("Placebo", "Xanomeline Low Dose"))
adae$TRTA <- factor(adae$TRTA, levels = c("Placebo", "Xanomeline Low Dose"))
meta <- meta_adam(population = adsl, observation = adae) |>
define_plan(plan = plan(analysis = "ae_forest_plot",
population = "apat",
observation = "oapat",
parameter = "any-AE"
)) |>
define_population(name = "apat",
group = "TRTA",
subset = SAFFL == "Y" ,
label = "All Participants as Treated Population",
var = c("USUBJID", "TRTA", "RACE", "SEX", "AGE", "AGEU")) |>
define_observation(name = "oapat",
group = "TRTA",
subset = SAFFL == "Y" ,
label = "All Participants as Treated Population") |>
define_analysis(name = "ae_forest_plot",
label = "Interactive AE Forest Plot") |>
define_parameter(name = "any-AE",
subset = SAFFL == "Y",
label = "Any AEs",
var = "AEDECOD", soc = "AEBODSYS", term1 = "", term2 = "") |>
meta_build()
collect_observation_record(meta, "apat", "oapat", "any-AE", var = c("USUBJID", "TRTA", **"AGEU"**))
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 at the collect_observation_record() entry point and trace how the var argument is checked against the observation metadata. Reproduce the example with AGEU, then add coverage for a missing column and verify that the function raises a clear error identifying the unavailable variable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100