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

Documentation: diagrams for derive_var_trtemfl #2455

Open
kaz462 opened this issue Jun 4, 2024 · 8 comments
Open

Documentation: diagrams for derive_var_trtemfl #2455

kaz462 opened this issue Jun 4, 2024 · 8 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@kaz462
Copy link
Collaborator

kaz462 commented Jun 4, 2024

Please select a category the issue is focused on?

Function Documentation

Let us know where something needs a refresh or put your idea here!

Clean up the following diagram and place it in the derive_var_trtemfl documentation

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
Loading
Copy link

github-actions bot commented Sep 2, 2024

This issue is stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the stale label Sep 2, 2024
@bms63 bms63 removed the stale label Sep 3, 2024
@bms63
Copy link
Collaborator

bms63 commented Sep 3, 2024

@kaz462 do you think you could add these in. I think they are super handy. The Stale Bot got us!!

@kaz462 kaz462 self-assigned this Sep 3, 2024
@bms63
Copy link
Collaborator

bms63 commented Sep 30, 2024

@bms63
Copy link
Collaborator

bms63 commented Oct 25, 2024

Any takers for this @pharmaverse/admiral @pharmaverse/admiral_comm? The content is there - just making the diagram fit in our documentation would be very helpful.

I really like Lucid

@bms63 bms63 moved this from In Progress to Backlog in admiral (sdtm/adam, dev, ci, template, core) Jan 7, 2025
Copy link

This issue is stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the stale label Jan 24, 2025
@manciniedoardo
Copy link
Collaborator

Possibly a candidate for a potential examples rework working group?

@bms63
Copy link
Collaborator

bms63 commented Jan 24, 2025

not sure if we need a working group - @rossfarrugia also wanted us to review this paper https://phuse.s3.eu-central-1.amazonaws.com/Deliverables/Safety+Analytics/[WP-087+Recommended+Definition+of++Treatment-Emergent+Adverse+Events+in+Clinical+Trials+.pdf](https://phuse.s3.eu-central-1.amazonaws.com/Deliverables/Safety+Analytics/WP-087+Recommended+Definition+of++Treatment-Emergent+Adverse+Events+in+Clinical+Trials+.pdf)

it is our oldest issue that we should resolve! maybe we can just hammer out in our core calls

@github-actions github-actions bot removed the stale label Jan 25, 2025
@manciniedoardo manciniedoardo self-assigned this Feb 17, 2025
@manciniedoardo
Copy link
Collaborator

I had a look at the whitepaper and coded up all the examples:

adae <- tribble(
    ~USUBJID, ~TRTSDTM,           ~TRTEDTM,           ~ASTDTM,            ~AENDTM,            ~AEITOXGR, ~AETOXGR,
    # Patient 1: Pre treatment AE
    "1",      "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-20T00:00", "2020-12-21T00:00", "2",       "2",
    # Patient 2: On-treatment AE
    "2",      "2021-01-01T00:01", "2021-12-31T23:59", "2021-12-20T00:00", "2021-12-21T00:00", "2",       "2",
    # Patient 3: Pre-treatment AE, then on-treatment AE at same intensity
    "3",      "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-20T00:00", "2020-12-21T00:00", "2",       "2",
    "3",      "2021-01-01T00:01", "2021-12-31T23:59", "2021-12-20T00:00", "2021-12-21T00:00", "2",       "2",
    # Patient 4: Pre-treatment AE, then on-treatment AE at worsened intensity
    "4",      "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-20T00:00", "2020-12-21T00:00", "2",       "2",
    "4",      "2021-01-01T00:01", "2021-12-31T23:59", "2021-12-20T00:00", "2021-12-21T00:00", "2",       "3",
    # Patient 5: Pre-treatment AE, then on-treatment AE at improved intensity
    "5",      "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-20T00:00", "2020-12-21T00:00", "2",       "2",
    "5",      "2021-01-01T00:01", "2021-12-31T23:59", "2021-12-20T00:00", "2021-12-21T00:00", "2",       "1",
    # Patient 6: AE starting pre-treatment and continuing on-treatment, then second AE at same intensity
    "6",      "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-23T00:00", "2021-01-21T00:00", "2",       "2",
    "6",      "2021-01-01T00:01", "2021-12-31T23:59", "2021-12-20T00:00", "2021-12-21T00:00", "2",       "2",
    # Patient 7: AE starting pre-treatment and continuing on-treatment, then second AE at worsened intensity
    "7",      "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-23T00:00", "2021-01-21T00:00", "2",       "2",
    "7",      "2021-01-01T00:01", "2021-12-31T23:59", "2021-12-20T00:00", "2021-12-21T00:00", "2",       "3",
    # Patient 8: AE starting pre-treatment and continuing on-treatment, then second AE at improved intensity
    "8",      "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-23T00:00", "2021-01-21T00:00", "2",       "2",
    "8",      "2021-01-01T00:01", "2021-12-31T23:59", "2021-12-20T00:00", "2021-12-21T00:00", "2",       "1",
    # Patient 9: AE starting pre-treatment and continuing on-treatment, and no change in intensity
    "9",      "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-23T00:00", "2021-01-21T00:00", "2",       "2",
    # Patient 10: AE starting pre-treatment and continuing on-treatment, and worsening intensity
    "10",     "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-23T00:00", "2021-01-21T00:00", "2",       "4",
    # Patient 11: AE starting pre-treatment and continuing on-treatment, and improving intensity
    "11",     "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-23T00:00", "2021-01-21T00:00", "2",       "1",
    # Patient 12: AE starting pre-treatment, worsening, then improving
    "12",     "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-23T00:00", "2021-01-21T00:00", "3",       "2",
    # Patient 13: AE starting pre-treatment, improving, then worsening
    "13",     "2021-01-01T00:01", "2021-12-31T23:59", "2020-12-23T00:00", "2021-01-21T00:00", "1",       "2",
  ) %>%
  mutate(
    ASTDTM = ymd_hm(ASTDTM),
    AENDTM = ymd_hm(AENDTM),
    TRTSDTM = ymd_hm(TRTSDTM),
    TRTEDTM = ymd_hm(TRTEDTM),
  )

derive_var_trtemfl(
    adae,
    new_var = TRTEMFL,
    trt_end_date = TRTEDTM,
    end_window = 0,
    initial_intensity = AEITOXGR,
    intensity = AETOXGR,
    subject_keys = exprs(USUBJID)
  ) %>%
  select(USUBJID, TRTSDTM, TRTEDTM, ASTDTM, AENDTM, AEITOXGR, AETOXGR, TRTEMFL)

Output:
Image

Excluding the cases where an AE is recorded on multiple lines, I think derive_var_trtemfl() matches what the whitepaper does. If an AE is encoded on multiple lines, then I think it's ambiguous. I can go ahead an make the diagrams as described at the start of the issue, if we are all happy.

Thanks @bundfussr for discussing this with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Development

No branches or pull requests

3 participants