Skip to content

Adding new module using summarize_glm_count #1386

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

llrs-roche
Copy link
Contributor

@llrs-roche llrs-roche commented May 29, 2025

Pull Request

Fixes #1379

This PR adds a new module tm_t_count (name open to improvements) that uses tern::summarize_glm_count to create a table output per request.

Sample app on how to use it

devtools::load_all("../teal.modules.clinical")
data <- within(teal_data(), {
  library("tern")
  ADSL <- tern_ex_adsl
  ADTTE <- tern_ex_adtte
})

join_keys(data) <- default_cdisc_join_keys[names(data)]

arm_ref_comp <- list(
  ACTARMCD = list(
    ref = "ARM B",
    comp = c("ARM A", "ARM C")
  ),
  ARM = list(
    ref = "B: Placebo",
    comp = c("A: Drug X", "C: Combination")
  )
)

ADSL <- data[["ADSL"]]
ADTTE <- data[["ADTTE"]]
# Initialize the teal app
app <- init(
  data = data,
  modules = modules(
    tm_t_glm_counts(
      dataname = "ADTTE",
      arm_var = choices_selected(
        variable_choices(ADTTE, c("ARM", "ARMCD", "ACTARMCD")),
        "ARMCD"
      ),
      arm_ref_comp = arm_ref_comp,
      aval_var = choices_selected(
        variable_choices(ADTTE, "AVAL"),
        "AVAL"
      ),
      strata_var = choices_selected(
        variable_choices(ADSL, "SEX"),
        NULL
      ),
      offset_var = choices_selected(
        variable_choices(ADSL, "AGE"),
        NULL
      ),
      cov_var = choices_selected(
        variable_choices(ADTTE, "SITEID"),
        NULL
      )
    )
  )
)

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

Image of the output

image

@llrs-roche llrs-roche changed the title 1379 glm count@main Adding new module using summarize_glm_count May 29, 2025
@llrs-roche
Copy link
Contributor Author

llrs-roche commented Jun 4, 2025

I would appreciate feedback on:

  • Documentation of the module: Besides the tern function used, is it clear?
  • Code shown from the app don't use the magrittr pipe and variables are overwritten.
  • Input validation and the optional arguments reset to NULL.
  • No tests yet: What would be of interest to test?

@llrs-roche llrs-roche marked this pull request as ready for review June 4, 2025 08:58
Copy link
Contributor

github-actions bot commented Jun 4, 2025

Unit Tests Summary

  1 files   71 suites   13s ⏱️
729 tests 153 ✅ 576 💤 0 ❌
869 runs  174 ✅ 695 💤 0 ❌

Results for commit e178988.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Jun 4, 2025

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
tm_t_glm_counts 👶 $+0.34$ $+2$ $+2$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
examples 👶 $+0.02$ example_tm_t_glm_counts.Rd
tm_t_glm_counts 👶 $+0.12$ e2e_tm_t_events_by_grade_Selecting_arm_var_changes_the_table_and_does_not_throw_validation_errors.
tm_t_glm_counts 👶 $+0.22$ e2e_tm_t_glm_counts_Module_initializes_in_teal_without_errors_and_produces_table_output.

Results for commit 6130ced

♻️ This comment has been updated with latest results.

Copy link
Contributor

@m7pr m7pr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, for me it looks fine.
I left comments on how to update the documentation to make it clearer what is happening potentially.

You should clarify with user about this startified/unstratified output, and if it's not needed, just delete from the code.

Also please remove commented parameters if you don't use them.

@m7pr
Copy link
Contributor

m7pr commented Jun 10, 2025

for the tests, just check out other modules and their shinytest2 tests - just test if the specific inputs are visible and the output is visible. follow some tests for another module that has tables

Copy link
Contributor Author

@llrs-roche llrs-roche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. I have added a couple of tests too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: summarize_glm_count apply in teal
2 participants