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

tm_outliers: filter_spec defaults when adding a filter in the filter panel #676

Closed
3 tasks done
mhallal1 opened this issue Jun 27, 2022 · 2 comments · Fixed by #677
Closed
3 tasks done

tm_outliers: filter_spec defaults when adding a filter in the filter panel #676

mhallal1 opened this issue Jun 27, 2022 · 2 comments · Fixed by #677
Assignees
Labels
bug Something isn't working core

Comments

@mhallal1
Copy link
Collaborator

What happened?

Using the main branches, run the code below an reproduce the following steps:

  1. Change the categortical variable to SEX.
  2. Add a filter SEX in the filter panel.
  3. The categotical variable filter defaults as below:
    Screenshot from 2022-06-27 10-38-48
library(scda)
ADSL <- synthetic_cdisc_data("latest")$adsl

fact_vars_adsl <- names(Filter(isTRUE, sapply(ADSL, is.factor)))
vars <- choices_selected(variable_choices(ADSL, fact_vars_adsl))

app <- init(
  data = cdisc_data(
    cdisc_dataset("ADSL", ADSL, code = "ADSL <- synthetic_cdisc_data(\"latest\")$adsl"),
    check = TRUE
  ),
  modules = modules(
    tm_outliers(
      outlier_var = list(
        data_extract_spec(
          dataname = "ADSL",
          select = select_spec(
            label = "Select variable:",
            choices = variable_choices(ADSL, c("AGE", "BMRKR1")),
            selected = "AGE",
            multiple = FALSE,
            fixed = FALSE
          )
        )
      ),
      categorical_var = data_extract_spec(
        dataname = "ADSL",
        filter = filter_spec(
          vars = vars,
          choices = value_choices(ADSL, vars$selected),
          selected = value_choices(ADSL, vars$selected),
          multiple = TRUE
        )
      ),
      ggplot2_args = teal.widgets::ggplot2_args(labs = list(subtitle = "Plot generated by Outliers Module"))
    )
  )
)
shinyApp(app$ui, app$server)

sessionInfo()

No response

Relevant log output

No response

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.
@mhallal1 mhallal1 added bug Something isn't working core labels Jun 27, 2022
@Polkas Polkas self-assigned this Jun 27, 2022
@gogonzo gogonzo self-assigned this Jun 27, 2022
@Polkas
Copy link
Contributor

Polkas commented Jun 27, 2022

This looks to be some edge case of the teal@8adc87e3 (full input cycle).
As we decided we should revert the commit, "revert if any problem arise".

Last thing to check is if the code which cause it is improper under the full input cycle. Then we do not want to revert pointed commit.

@Polkas Polkas transferred this issue from insightsengineering/teal.modules.general Jun 27, 2022
@Polkas
Copy link
Contributor

Polkas commented Jun 27, 2022

So I find out the there is some reactivity from FilteredData, which cases the modules to be CREATED MANY
TIMES from scratch. The fIlter_spec shows us a side effect of it, the filter was reinitialized each time.
We could play here with isolate, still out primary decision was to revert it in such case.

I created a PR #677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants