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]: tm_t_mult_events #1324

Closed
3 tasks done
jenko1979 opened this issue Jan 28, 2025 · 4 comments
Closed
3 tasks done

[Bug]: tm_t_mult_events #1324

jenko1979 opened this issue Jan 28, 2025 · 4 comments
Assignees
Labels
question Further information is requested sme

Comments

@jenko1979
Copy link

jenko1979 commented Jan 28, 2025

What happened?

Hi, It seems that the title that is coming out in this module within the application is always 'concomitant medications'.

I am using this for an AE table, yet it still wants to give the title as concomitant medications.

You can use the example code below and see this:

ADSL <- tmc_ex_adsl
ADAE <- tmc_ex_adae
adae_keys <- c("STUDYID", "USUBJID", "ASTDTM", "AESEQ", "AELLT", "AEHLT")

join_keys <- default_cdisc_join_keys[c("ADSL", "ADAE")]
join_keys["ADAE", "ADAE"] <- adae_keys

app <- init(
  data = cdisc_data(
    ADSL = ADSL,
    ADAE = ADAE,
    code = "
      ADSL <- tmc_ex_adsl
      ADAE <- tmc_ex_adae
    ",
    join_keys = join_keys
  ),
  modules = modules(
    tm_t_mult_events(
      label = "Adverse Events Multi Level Table",
      dataname = "ADAE",
      arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
      seq_var = choices_selected("AESEQ", selected = "AESEQ", fixed = TRUE),
      hlt = choices_selected(
        choices = variable_choices(ADAE, c("AELLT", "AEHLT")),
        selected = c("AELLT", "AEHLT")
      ),
      llt = choices_selected(
        choices = variable_choices(ADAE, c("AEDECOD")),
        selected = c("AEDECOD")
      ),
      add_total = TRUE,
      event_type = "treatment"
    )
  )
)
if (interactive()) {
  shinyApp(app$ui, app$server)
}

sessionInfo()

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.
@jenko1979 jenko1979 added the bug Something isn't working label Jan 28, 2025
@edelarua edelarua self-assigned this Jan 28, 2025
@edelarua edelarua added the sme label Jan 28, 2025
@edelarua
Copy link
Contributor

Hi @jenko1979,

You can add a custom title to this teal module using the basic_table_args argument to tm_t_mult_events() as follows:

library(teal.modules.clinical)

ADSL <- tmc_ex_adsl
ADAE <- tmc_ex_adae
adae_keys <- c("STUDYID", "USUBJID", "ASTDTM", "AESEQ", "AELLT", "AEHLT")

join_keys <- default_cdisc_join_keys[c("ADSL", "ADAE")]
join_keys["ADAE", "ADAE"] <- adae_keys

app <- init(
  data = cdisc_data(
    ADSL = ADSL,
    ADAE = ADAE,
    code = "
      ADSL <- tmc_ex_adsl
      ADAE <- tmc_ex_adae
    ",
    join_keys = join_keys
  ),
  modules = modules(
    tm_t_mult_events(
      label = "Adverse Events Multi Level Table",
      dataname = "ADAE",
      arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
      seq_var = choices_selected("AESEQ", selected = "AESEQ", fixed = TRUE),
      hlt = choices_selected(
        choices = variable_choices(ADAE, c("AELLT", "AEHLT")),
        selected = c("AELLT", "AEHLT")
      ),
      llt = choices_selected(
        choices = variable_choices(ADAE, c("AEDECOD")),
        selected = c("AEDECOD")
      ),
      add_total = TRUE,
      event_type = "treatment",
      basic_table_args = teal.widgets::basic_table_args(title = "Custom title")
    )
  )
)

if (interactive()) {
  shinyApp(app$ui, app$server)
}

Let me know if this resolves your issue!

@edelarua edelarua added question Further information is requested and removed bug Something isn't working labels Jan 28, 2025
@jenko1979
Copy link
Author

Thanks so much for this, it does work!

However, I would say this is a workaround for the issue rather than resolves the issue. I note that the other modules such as tm_t_events are clever enough to already change the concomitant mediations to adverse events as i guess this is picking this up from the adam metadata or similar?

Also having the custom title for the AE table makes it difficult to have reactivities for the different multi-level terms created, which you would get currently in the conmed table. Yo now have to just make this generic.

Like i say, fully appreciate the current workaround.
Paul

@edelarua
Copy link
Contributor

edelarua commented Feb 5, 2025

Hi @jenko1979,

The tm_t_events() function uses the user-specified event_type parameter to customize the text. I will open an issue proposing the addition of a similar argument to tm_t_mult_events() to customize the title.

Thanks!

EDIT: Issue can be found here.

@edelarua
Copy link
Contributor

Hi @jenko1979,

This feature has been added in as of teal.modules.clinical 0.9.1.9059 (#1334). If you'd like to use it prior to the next CRAN release, you can install the development version of teal.modules.clinical by running the following line of code:

pak::pak("insightsengineering/teal.modules.clinical")

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested sme
Projects
None yet
Development

No branches or pull requests

2 participants