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

[Feature Request]: Use the module's id instead of label for module specific filters #927

Closed
3 tasks done
donyunardi opened this issue Oct 5, 2023 · 1 comment
Closed
3 tasks done
Labels
core enhancement New feature or request

Comments

@donyunardi
Copy link
Contributor

donyunardi commented Oct 5, 2023

Feature description

Summary

Currently, this is how users define module specific mapping

app <- init(
  data = cdisc_data(...),
  modules = teal::modules(
    teal.modules.general::tm_data_table(
      label = "ADS Data Table",
      variables_selected = list(ADSL = c("STUDYID", "USUBJID", "SUBJID", "SITEID", "AGE", "SEX", "COUNTRY")),
      dt_args = list(caption = "ADSL Table Caption")
    ),
  filter = teal_slices(
    teal_slice("ADSL", "COUNTRY", "country", selected = "USA", fixed = TRUE),
    teal_slice("ADSL", "ETHNIC", "ethnic", anchored = TRUE),
    module_specific = TRUE,
    mapping = list(
      "ADS Data Table" = c("country", "ethnic") # using the module's label to assign filters
    )
  )
)

We have an assertion to check for duplicate labels, which is good.

However, can we explore the possibility of using a module's id for this assignment? This could involve altering the module's structure and introducing the id in the module's server.

Here's what the code could look like:

app <- init(
  data = cdisc_data(...),
  modules = teal::modules(
    teal.modules.general::tm_data_table(
      id = "module1",
      label = "ADS Data Table",
      variables_selected = list(ADSL = c("STUDYID", "USUBJID", "SUBJID", "SITEID", "AGE", "SEX", "COUNTRY")),
      dt_args = list(caption = "ADSL Table Caption")
    ),
  filter = teal_slices(
    teal_slice("ADSL", "COUNTRY", "country", selected = "USA", fixed = TRUE),
    teal_slice("ADSL", "ETHNIC", "ethnic", anchored = TRUE),
    module_specific = TRUE,
    mapping = list(
      "module1" = c("country", "ethnic") # using the module's id to assign filters
    )
  )
)

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.
@donyunardi donyunardi added the enhancement New feature or request label Oct 5, 2023
@donyunardi donyunardi changed the title [Feature Request]: Use the module's id instead of label when declaring teal::teal_slices(mapping=) [Feature Request]: Use the module's id instead of label for module specific filters Oct 5, 2023
@donyunardi donyunardi added the core label Oct 5, 2023
@gogonzo
Copy link
Contributor

gogonzo commented May 24, 2024

Closing in favour of #969

@gogonzo gogonzo closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants