Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: derive_param_tte() fails if dataset and by_vars is specified #2336

Closed
bundfussr opened this issue Feb 14, 2024 · 8 comments · Fixed by #2353 or #2363
Closed

Bug: derive_param_tte() fails if dataset and by_vars is specified #2336

bundfussr opened this issue Feb 14, 2024 · 8 comments · Fixed by #2353 or #2363
Assignees
Labels
bug Something isn't working programming

Comments

@bundfussr
Copy link
Collaborator

bundfussr commented Feb 14, 2024

What happened?

derive_param_tte() fails if dataset and by_vars is specified because the check on duplicate parameter codes fails.

Session Information

No response

Reproducible Example

library(dplyr)
library(lubridate)
library(admiral)
adsl <- tibble::tribble(
  ~USUBJID, ~TRTSDT,           ~TRTEDT,           ~EOSDT,
  "01",     ymd("2020-12-06"), ymd("2021-03-02"), ymd("2021-03-06"),
  "02",     ymd("2021-01-16"), ymd("2021-01-20"), ymd("2021-02-03")
) %>%
  mutate(STUDYID = "AB42")

ae <- tibble::tribble(
  ~USUBJID, ~AESTDTC,     ~AESEQ, ~AEDECOD,
  "01",     "2021-01-03",      1, "Flu",
  "01",     "2021-03-04",      2, "Cough",
  "01",     "2021-01-01",      3, "Flu"
) %>%
  mutate(
    STUDYID = "AB42",
    AESTDT = ymd(AESTDTC)
  )

ttae <- event_source(
  dataset_name = "ae",
  date = AESTDT,
  set_values_to = exprs(
    EVENTDESC = "AE",
    SRCDOM = "AE",
    SRCVAR = "AESTDTC",
    SRCSEQ = AESEQ
  )
)

eot <- censor_source(
  dataset_name = "adsl",
  date = pmin(TRTEDT + days(10), EOSDT),
  censor = 1,
  set_values_to = exprs(
    EVENTDESC = "END OF TRT",
    SRCDOM = "ADSL",
    SRCVAR = "TRTEDT"
  )
)

  derive_param_tte(
    dataset = adsl %>% select(STUDYID, USUBJID) %>% mutate(PARAMCD = "XYZ"),
    dataset_adsl = adsl,
    by_vars = exprs(AEDECOD),
    start_date = TRTSDT,
    event_conditions = list(ttae),
    censor_conditions = list(eot),
    source_datasets = list(adsl = adsl, ae = ae),
    set_values_to = exprs(
      PARAMCD = paste0("TTAE", as.numeric(as.factor(AEDECOD))),
      PARAM = paste("Time to First", AEDECOD, "Adverse Event"),
      PARCAT1 = "TTAE",
      PARCAT2 = AEDECOD
    )
  )

results in

Error in match(x, table, nomatch = 0L) : 
  'match' requires vector arguments
@bundfussr bundfussr added bug Something isn't working programming labels Feb 14, 2024
@bms63
Copy link
Collaborator

bms63 commented Feb 14, 2024

Is this a critical bug or one that we can wait on for a while?

@bundfussr
Copy link
Collaborator Author

As a work-around you could not specify the dataset argument, create separate datasets for each derive_param_tte() call, and bind them all together using bind_rows().
So it is not super-critical. However, I am not sure if we should wait until June.

@bms63
Copy link
Collaborator

bms63 commented Feb 15, 2024

I will add to agenda for next week's meeting.

@millerg23
Copy link
Collaborator

@bms63 I looked at the Hotfix release page, do you create the patch branch that I should take feature branch from to fix this?

@bms63
Copy link
Collaborator

bms63 commented Feb 23, 2024

I think we should create a patch branch off the latest release tag and then branch off the patch to make the fix. whew!! @zdz2101

@millerg23
Copy link
Collaborator

OK thanks, I have created a branch called patch from tag 1.0.1 on GItHub

@bundfussr
Copy link
Collaborator Author

Our documentation is inconsistent. On the one hand it requires that the patch branch is protected and updated after each release. On the other hand it suggests to create the patch branch from a release tag.

And the formatting of the "Hot Fix Release" section got mixed up:
image

@bms63
Copy link
Collaborator

bms63 commented Feb 23, 2024

Our documentation is inconsistent. On the one hand it requires that the patch branch is protected and updated after each release. On the other hand it suggests to create the patch branch from a release tag.

And the formatting of the "Hot Fix Release" section got mixed up: image

Thanks Stefan I created a new issue pharmaverse/admiraldev#365

@millerg23 millerg23 linked a pull request Feb 26, 2024 that will close this issue
15 tasks
bms63 pushed a commit that referenced this issue Mar 4, 2024
* 2336 fix bug

* 2236 fix STYLER and LINTR

* 2236 fix (reword) NEWS item

* Update NEWS.md

Co-authored-by: Stefan Bundfuss <[email protected]>

* 2336 select unique PARAMCD before check

* 2336 update NEWS item to be more informative

* 2336 fix typo

---------

Co-authored-by: Stefan Bundfuss <[email protected]>
@bms63 bms63 linked a pull request Mar 6, 2024 that will close this issue
bms63 added a commit that referenced this issue Mar 6, 2024
* Closes #2311 attend to `derive_vars_query()` bug (#2313)

* new branch here

* fix typo in news

* 2311 updated unit test to have mixed case

* missing the toupper part

* add more detail to news

* fix links

* add documentation on case insensitivity

---------

Co-authored-by: Gordon Miller <[email protected]>

* chore: #2311 remove renv to get website to build

* [actions skip] Add/Update README.md for patch

* Closes #2336 fix bug in derive_param_tte (#2353)

* 2336 fix bug

* 2236 fix STYLER and LINTR

* 2236 fix (reword) NEWS item

* Update NEWS.md

Co-authored-by: Stefan Bundfuss <[email protected]>

* 2336 select unique PARAMCD before check

* 2336 update NEWS item to be more informative

* 2336 fix typo

---------

Co-authored-by: Stefan Bundfuss <[email protected]>

* chore: remove readme render in actions

---------

Co-authored-by: Zelos Zhu <[email protected]>
Co-authored-by: Gordon Miller <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
Co-authored-by: Gordon Miller <[email protected]>
Co-authored-by: Stefan Bundfuss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working programming
3 participants