admiral
admiral copied to clipboard
Enhancing `derive_var_trtemfl()` to deal with AEs recorded on multiple lines
Background Information
(Courtesy of @kaz462)
Currently, derive_var_trtemfl derives TEAE flag with the assumption that AEs are recorded as a single line for each event (one record in the database). But some studies record one episode of AE with multiple lines using a grouping variable - could we take the grouping variable into consideration when AE data is collected this way e.g., the following subject ABC-1 has two episodes of AE:
- AEGRPID = 1, ASEQ = 1,2,3
- AEGRPID = 2, ASEQ = 4,5,6
Some other examples with a grouping variable:
- Detecting Treatment Emergent Adverse Events (TEAEs) Table 3 on page 10 (AEGRPID)
- TEAE: Did I flag it right? SCENARIO 3 on page 2 (AESPID)
Definition of Done
derive_var_trtemfl()
enhanced to deal with these cases also, without breaking backwards compatibility.
Hi @ashachakma - how is this one going? any questions? Do you think you will be able to finish before our "other works" gets busy or do you want to hold off until afterwards?
@ashachakma @bms63 thanks for picking up this issue and following up
@pharmaverse/admiral What do you think of adding a new argument for grouping variable - derive_var_trtemfl(..., group_var)
?
-
if
group_var
is missing, the function will remain the same as the current derivation, assuming AE data collection method as single record per AE -
if
group_var
is populated, we assume AE data collection involves multiple records per AE. In this case, we flag TEAE with two scenarios below: 1. new AE: records with missingAEITOXGR
2. if an AE exists beforeTRTSDT
, any records after the 1st worsen date post-TRTSDT and within TEAE window
@ashachakma @bms63 thanks for picking up this issue and following up @pharmaverse/admiral What do you think of adding a new argument for grouping variable -
derive_var_trtemfl(..., group_var)
?
- if
group_var
is missing, the function will remain the same as the current derivation, assuming AE data collection method as single record per AE- if
group_var
is populated, we assume AE data collection involves multiple records per AE. In this case, we flag TEAE with two scenarios below:
- new AE: records with missing
AEITOXGR
- if an AE exists before
TRTSDT
, any records after the 1st worsen date post-TRTSDT and within TEAE window
I like this idea as it doesn't impact the function's original purpose. Do you mind putting on the agenda for Wednesday and we can make final decision? Others please add thoughts too!!
Hi @ashachakma - how is this one going? any questions? Do you think you will be able to finish before our "other works" gets busy or do you want to hold off until afterwards?
Hi Ben, this is my first time working on a function enhancement so, I might take some time to finish it. Till now, I looked into the document and, trying to understand how the function is working. My study has SAC work from next week so, I will try to finish it by this week else I will continue after my study work finishes.
I also liked @kaz462 suggestion but I will wait till the final decision on Wednesday.
Awesome!! It is a good one for you. We can help - so don't hesitate on asking questions!!
Awesome!! It is a good one for you. We can help - so don't hesitate on asking questions!!
Sure Ben, thanks. As I progress I will have more questions, for now, @gg106046 is helping me with the basic ones.
Hi @manciniedoardo @kaz462 @bms63 , can you provide me with an example of how the AEITOXGR will look if the grouping variable is present in the AE data? The above example shows without AEITOXGR, it's quite puzzling how to consider the worsening condition if both AEITOXGR and AETOXGR are present. Thanks!
Is my understanding correct?- once a record within a grouped AE is flagged as a TEAE within the window, then any subsequent record should also be a TEAE regardless of the severity and when it starts relative to the window.
@kaz462 I have not heard any grumblings about this enhancement - so I think we can go ahead with your proposal. Is it possible to supply Asha with some additional examples?
Is my understanding correct?- once a record within a grouped AE is flagged as a TEAE within the window, then any subsequent record should also be a TEAE regardless of the severity and when it starts relative to the window.
@ashachakma thanks for looking into it! Your understanding is correct, we assign ASEQ =6
as TEAE at Bayer in the example below, I'm not sure if Roche/GSK have the same handling
Example with AEITOXGR added: (Initial severity with grouping variable can be derived as last AE severity before TRTSDT)
# A tibble: 6 × 10
USUBJID AEGRPID ASEQ AETERM ASTDT TRTSDT TRTEDT AETOXGR TRTEMFL AEITOXGR
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 ABC-1 1 1 Headache 2020-01-01 2020-01-05 2020-03-05 2 NA 2
2 ABC-1 1 2 Headache 2020-01-15 2020-01-05 2020-03-05 1 NA 2
3 ABC-1 1 3 Headache 2020-02-15 2020-01-05 2020-03-05 2 Y 2
4 ABC-1 2 4 Fever 2020-01-01 2020-01-05 2020-03-05 2 NA 2
5 ABC-1 2 5 Fever 2020-01-15 2020-01-05 2020-03-05 3 Y 2
6 ABC-1 2 6 Fever 2020-02-15 2020-01-05 2020-03-05 1 Y 2
I summarized our internal spec into the following workflow, do you think we can apply it when enhance this function?
flowchart TB
AEITOXGR["AEITOXGR"] -->|"missing AEITOXGR: \n AE not exist before TRTSDT"| arise1["New AE records \n within TEAE window"] --> |New|TEAE[Step 3: Flag records identified above as TEAE]
AEITOXGR -->|"non-missing AEITOXGR: \n AE exist before TRTSDT"|Worsen1["Step 1: Identify worsened records \n (compare with the previous record) \nafter TRTSDT"]--> Worsen2["Step 2: Get the first worsen date \n after TRTSDT"]-->worsen3["All records after \n the 1st worsen date \n and within TEAE window"]--> |Worsen|TEAE
style TEAE fill:#b3ffb3,stroke:#4CAF50,stroke-width:2px
style Worsen1 fill:#b3ffb3,stroke:#4CAF50,stroke-width:2px
style Worsen2 fill:#b3ffb3,stroke:#4CAF50,stroke-width:2px
Hi @kaz462, thanks for your response and the flowchart, this is very helpful. Yeah, I think this can be applied while enhancing the function. Thanks!
I am facing this issue while running pkgdown::build_site()-
Umm...we have seen this issue in another PR. https://github.com/pharmaverse/admiral/pull/2350
@sheramin did this ever get resolved?
@ashachakma I am able to rebuild the site from your branch
Umm...we have seen this issue in another PR. #2350
@sheramin did this ever get resolved?
@bms63 nope, we discussed it a little bit on Slack, but those solution didn't work either. It's interesting that it works on your end. It looks like the problem is on our end, not the branch. I removed it a few times and downloaded everything from scratch, but no luck. I'll do it again. Can it be R version issue? My R is 4.2.1
Can you do a session info dump here please. @ashachakma be nice for you to do as well
Can you do a session info dump here please. @ashachakma be nice for you to do as well
Sure, here it is:
Can you do a session info dump here please. @ashachakma be nice for you to do as well
Sure-
I have the same situation as #2350 .Rmd file do not have analysis_var but I see this parameter in .R file.
I restarted my laptop and tried again running pkgdown::build_site(), it ran successfully :) but other checks are failing so, checking those issues now.