-
-
Notifications
You must be signed in to change notification settings - Fork 3
Redesign teal_module(s) interactive arguments #270
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
Draft
gogonzo
wants to merge
144
commits into
main
Choose a base branch
from
redesign_extraction@main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- input module reactivity works - merge works for data.frames - inputs minimized to badge-pill
- use labels in input when possible
- multiple variables concatenates values
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes insightsengineering/NEST-roadmap#36
WIP description. Comments blocked
Introduction
Current design bases on an idea that a module can consume its arguments referring to any variable in any dataset. Consider following example, where:
x
,y
andfacet
arguments to create an interactive inputs,x
,y
,facet
Pseudo example
To provide choices and default selection for
x
,y
andfacet
we propose following api:Where each function creates an object which holds the information consumed by the framework.
choices
andselected
can be either:tidyselect
selection_helpers (?tidyselect::language
)Example settings
Strict variables picks
picks
below will create an input in the module where single variable can be selected fromc("Sepal.Length", "Sepal.Width")
.multiple = FALSE
disallow user to select more than one choice.Dynamic variables choices
Following
picks
will create an input in the module where user will be able to select any variable from iris (any =everything()
) and by default1
-st will be selected. Be careful, setting explicitselected
whenchoices
throws a warning as it is not certain for example that"Species" %in% everything()
.Dynamic variables from multiple datasets
Consider a situation when one wants to select a variable from either
iris
ormtcars
. Instead of forcing app-developer to enumerate all possible choices foriris
andmtcars
. Following picks will create two related inputs for datasets and for variables. Input for variables will automatically update when dataset selection changes.Dynamic everything
In extreme scenario also lists of datasets could be unknown. Or to avoid writing too much text, one can specify following
picks
.Implementation in
teal_module
teal_module
will acceptx
,y
andfacet
and hand-over them to bothui
andserver
.code
On the
ui
part it is necessary to callmodule_input_ui
for eachpicks
object.code
In the
server
,picks
are utilized inmodule_input_srv
which can be called per each pick, or for all at once (as in the example below).module_input_srv
is used only to resolve dynamic choices/selected and to handle interaction between inputs.selectors
contain a list of selected datasets/variables for eachpick
. In this exampleselectors
structure looks like this:module_input_srv
doesn't do anything else that controlling a selection for a number of reasons:code
App example
code