-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Design data extract and data merge #36
Comments
1. Interactive metatransformData transformation settingsThis solution allows app developer creating the app with selection from single dataset only but with option to make a custom merge. This solution gives app-developer possibility to specify custom tbl <- list(
expr = {
ADTTE <- ADTTE %>%
filter(!!adtte_filter_variable %in% !!adtte_filter_levels)
ADRS <- ADRS %>%
filter(!!adrs_filter_variable %in% !!adrs_filter_levels) %>%
pivot_wider(!!adrs_pivot_by_variable, !!adrs_pivot_by_value)
ABCD <- merge(ADSL, ADTTE, ADTRS)
},
ui = function(id, data = <list>) {
div(
selectInput("adtte_filter_variable", data$adsl),
...
)
},
srv = function(input, output, session, datasets, ...) {
reactive(inputs)
}
) Above data-transformation settings will be resulting in following ui elements which then are replacing Variables selectionAbove gives app developer entire freedom to make a new datasets for the module and also gives a full control over merge. a <- choices_selected(<select from numeric vars in ABCD>)
b <- choices_selected(<AVAL from ABCD>)
c <- choices_selected(<select from factor vars in ABCD>) calliing modulesSelect instructions
In the server part we need the equivalent modules calls. Data transform module returns the expression which then needs to be evaluated somewhere (chunks). "choices_selected" ( tm_scatterplot_srv <- function(id, x, y, c, tbl)
# call data tranformation - return expression
transform <- interactive_transform_srv("tbl", tbl, <data>)
# evaluate expression in chunks, shinymeta or anything else
eval(transform$expr(), env)
# resolve and validate inputs selection
choices <- choices_selected_srv(<env>, x, y, c)
# evaluate visualization based on the inputs
eval(
!!choices$dataname %>%
plot(x = !!choices$x, y = !!choices$y, c = !!choices$c),
env
) Conclusions about this way
|
2. Interactive metatransform 2data transformation settingsThis solution is almost the same as (1) with that difference that expression needs to be done in the way that app-developer doesn't assign final dataset but returns it from the tbl <- list(
expr = {
ADTTE <- ADTTE %>%
filter(!!adtte_filter_variable %in% !!adtte_filter_levels)
ADRS <- ADRS %>%
filter(!!adrs_filter_variable %in% !!adrs_filter_levels) %>%
pivot_wider(!!adrs_pivot_by_variable, !!adrs_pivot_by_value)
merge(ADSL, ADTTE, ADTRS)
},
ui = function(id, data = <list>) {
div(
selectInput("adtte_filter_variable", data$adsl),
...
)
},
srv = function(input, output, session, datasets, ...) {
reactive(inputs)
}
)
Variables selectionAbove means that a <- <select numeric>
b <- <select numeric>
c <- <select factor> Calling modules
tm_scatterplot_ui <- function(id, x, y, c, tbl)
div(
interactive_transform_ui("tbl", tbl),
choices_selected_ui(x, y, c),
...
) tm_scatterplot_srv <- function(id, x, y, c, tbl, dataname = "ANL")
transform <- interactive_transform_srv("tbl", tbl, <data>)
# expression from transform is assigned to the name specified in the module
if (!<empty expr>) {
eval(!!dataname <- !!transform$expr(), env)
}
choices <- choices_selected_srv(<env>$<dataname>, x, y, c)
eval(
!!dataname %>%
plot(x = !!choices$x, y = !!choices$y, c = !!choices$c),
env
) Conclusions (comparing to (1))
|
3. Split data_extract_specThe solution is to simply split data_extract so that filter_spec and select_spec will be independent and will go to the module separately. Data tranformation settingsApp developer will need to specify the filters separately. Probably tbl <- list(
filter_spec("ADTTE", vars = "PARAMCD"),
filter_spec("ADRS", vars = "AVISIT"),
reshape_spec("ADRS", vars = "PARAMCD")
) Variables selectionApp developer will be able to specify possible selections from any datasets a <- <select numeric from ADSL or ADTTE>
b <- <select numeric from ADTTE>
c <- <select factor from ADSL> Calling modulesModules are called in similar way to (1) and (2) but tm_scatterplot_ui <- function(x, y, c, tbl)
div(
interactive_transform_ui("tbl", tbl),
choices_selected_ui(id, x, y, c),
merge_choices_ui(id)
...
) tm_scatterplot_srv <- function(...)
# returns expression for selected filters
transform <- interactive_transform_srv("tbl", tbl, <data>)
# evaluate expression in env (chunks or equivalent)
eval(transform$expr(), env)
# choices same as in (1) and (2)
choices <- choices_selected_srv(env, a, b, c)
# merge returns expression
merged <- merge_choices(choices, join_keys)
eval(merged$expr, env)
eval(
!!merged$dataname %>%
plot(a = !!merged$a, b = !!merged$b, c = !!merged$c),
env
)
Conclusions
|
Solution 4 - module filters in the filter-panelAnother solution is to have right hand-side panel containing "global" and "module specific" filters. Data transformation settingsApp developer would specify filters in the same way as specifies the "global" filters - by specifying a list (see teal::init filters argument). For reshape we might use similar instructions. tbl <- list(
filter = list(ADRS = list(PARAMCD = ...)),
reshape = ...
) Variables selectiona <- <select numeric from ADSL or ADRS>
b <- <select numeric from ADRS>
c <- <select factor from ADSL> Calling modules
tm_scatterplot_ui <- function(x, y, c, tbl)
div(
choices_selected_ui(id, x, y, c),
merge_choices_ui(id)
...
) tm_scatterplot_srv <- function(..., tbl)
# send filter instructions to filter-panel
set_filter_state(tbl, module = <this module>)
# choices same as in (1) and (2)
choices <- choices_selected_srv(env, a, b, c)
# merge returns expression
merged <- merge_choices(choices, join_keys)
eval(merged$expr, env)
eval(
!!merged$dataname %>%
plot(a = !!merged$a, b = !!merged$b, c = !!merged$c),
env
) Conclusions
|
This comment was marked as off-topic.
This comment was marked as off-topic.
I guess we can agree to the one point. @kpagacz @mhallal1 @Polkas @nikolas-burkoff Module should receive the instructions of possible selections for it's fixed inputs. a <- choices_selected(<variables from ADSL>)
b <- choices_selected(<variables from ADSL>)
c <- choices_selected(<variables from ADSL>) a <- list(choices_selected(<variables from ADSL>), choices_selected(<variables from ABCD>))
b <- choices_selected(<variables from ADTTE>)
c <- choices_selected(<variables from ADTTE>) This instructions are for the fixed module inputs so extra "filter" or "reshape" is not involved here. It's not said that this will be named a If we agree to above that modules needs only instructions where to take the "choices" for inputs then we can resolve this: Feel free to modify if you thing some node is missing |
Because you allow here to select from multiple datasets, it means that merge after selection is required. Available to achieve with solution 3: x <- list(<select not dates from ADSL, ADTTE, ADRS, ...>)
y <- <select factors from ADSL> @nikolas-burkoff your example is basically to use select_spec from data_extract which can refer to "split of data extract". Filter can be specified in some other place but doesn't have to. And question is, where it should be specified, in my opinion it should be module-specific (but doesn't have to be specified in the module) |
Meeting summary: After planned meeting I had a ad hoc meeting with @nikolas-burkoff and I think I have clearer view on all comments addressed by @kpagacz and @nikolas-burkoff. Let's have some specific points in this discussion and focus on the key points of the "data-extract". I'm almost sure that above 4-propositions contain almost everything we are looking for, we probably need to shuffle them little bit. Let's start from the most basic conclusion and go step-by-step.
My personal view on this is as follows:
This means that teal_module (server part) would look like this: tm_module_srv(
a , b, c <choices selected>,
data <list of data>,
expr <expression used to generate the data>,
...
) Alternatively if we decide to make transformation within teal_module tm_module_srv(
a , b, c <choices selected>,
data <list of data>,
tbl <data tranform instructions>
expr <expression used to generate the data>,
...
) |
Issues to take into account:
|
@gogonzo thanks for summarizing the related issues for this roadmap. It looks like most of these issues are missing SP. I did notice that most issues are created in 2021 so perhaps there were discussions around this already which doesn't require SP to be assigned. |
@donyunardi some of them probably will be irrelevant if we finally redesign and refactor data_merge/data_extract. But we can refine them to at least have everything filled-up. |
Motivation
Data extract/data merge has been criticised by many parties mainly for opaqueness and complicated API. The main goal of the refactor should be:
Remove independent filtering on the selector level, to avoid scenarios like below where ADLB is merged to ADLB. No other data-visualization tools offers such a functionality. Possible data transformation (reshape or filter) should be done once for dataset before variables selection. Independent filtering also complicates API call to initialise encoding panel.
data_extract_spec
sometimes covers more than hanf of the code space:Selecting variables to the module should be minimalized to specifying variables only (without data transformation). Still open question whether we allow to select from different datasets (support automatic merge) or allow to select from one dataset only (no automatic merge).
If we decide to keep offering automatic merge we need to provide UI element informing that there is merge and how it's performed (used keys, shape of the final ANL)
Solutions in the comments.
The text was updated successfully, but these errors were encountered: