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

Pass the list of reactive data to the module. #654

Closed
Tracked by #2
gogonzo opened this issue Jun 1, 2022 · 0 comments · Fixed by #674
Closed
Tracked by #2

Pass the list of reactive data to the module. #654

gogonzo opened this issue Jun 1, 2022 · 0 comments · Fixed by #674
Assignees
Labels

Comments

@gogonzo
Copy link
Contributor

gogonzo commented Jun 1, 2022

Our objective is teal_module(s) to receive the data as a list(adsl = reactive(<data.frame>), x = reactive(<data.frame>)) instead of taking data from the FilteredData object. In the flow-chart below what we need to do in this issue is distinguished by "bolded" frames. This means that if teal_module has a data argument, we need to pass a list which has expr, join_keys and metadata as attributes.

quosure-teal-simplify-api (2)

tm_module(
  a b c <instructions for choices> # currently data_extract
  data <list of reactives, optionally with expr, metadata and join_keys attr>, 
  # datasets - FilterPanel-api if the communication with filteredData needed
  # reporter - if reporter-api needed 
)

Practically my first guess is that following lines might be enough before calling the module - but it depends how far refactor of the FilteredData will go (insightsengineering/teal.slice#33)

data <- lapply(
  <module datanames>, 
  function(x) {
    dataset <- datasets$get_data(dataname = x, filtered = TRUE))
    attr(dataset, "metadata") <- <metadata>
    dataset
  }
)
attr(data, "join_keys") <- <join keys>
attr(data, "expr") <- c(datasets$get_code(<module datanames>, datasets$get_filter_expr(<datanames>))

Currently following methods from FilteredData are used in the modules, they should be passed somehow in the data attributes:

  • $get_data(filtered = TRUE)
  • $get_data(filtered = FALSE) ❌ see occurrences and here. This can be fixed by including unfiltered data to the module also.
  • $datanames() - this will be the names of the list
  • $get_metadata(), $get_keys() - should we pass using ...? Please find the optimal solution.
  • $get_varlabels - this can be extracted from the raw data.frame object
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 a pull request may close this issue.

1 participant