-
-
Notifications
You must be signed in to change notification settings - Fork 41
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]: Consider set_datanames
to support negative selection.
#1380
Comments
Acceptance Criteria
|
I'm not a fan of any solution involving # generic solution which was always possible
modules(
tm_data_table(datasets_selected = c("ds1", "ds2", ...)),
tm_variable_browser(datasets_selected = c("ds1", "ds2", ...)),
module_with_datanames_set(x = choices_selected, y = choices_selected) # not alterable
)
# I don't see the point of this
modules(
tm_data_table() |> set_datanames(c("ds1", "ds2", ...)),
tm_variable_browser() |> set_datanames(c("ds1", "ds2", ...)),
module_with_datanames_set(x = choices_selected, y = choices_selected) # not alterable
)
# this is the only real use case
modules(
tm_data_table(),
tm_variable_browser(),
module_with_datanames_set(x = choices_selected, y = choices_selected) # not alterable
) |> set_datanames(c("ds1", "ds2", ...))
Ok, I admit
modules(
tm_data_table() |> set_datanames("ds1", "ds2"),
tm_variable_browser() |> set_datanames("ds1", "ds2")
) |> set_datanames("ds1", "ds2", "ds3") # redundant This is another can of worms. When I've created the issue I thought that mtcars |>
select(-mpg) |> # all except mpg
select(cyl, disp, hp, drat) |> # only: cyl, disp, hp, drat
select(-cyl, -disp) # dp, drat For module() |> set_datanames(-a) |> set_datanames(-b, -c) |> set_datanames(d, e) With @averissimo we considered that maybe modules(
label = "m1",
modules(
label = "m1.1",
module(label = "m1.1.1) |> set_datanames(-c)
) |> set_datanames(-b)
) |> set_datanames(-a)
# can be translated to:
m1: all except a
m1.1: all (from m1) except b
m1.1.1: all (from m1.1) except c => all except a, b, c Above would require following changes:
Summary: I don't like the idea of |
Another reason why I am against having |
I completely agree with your assessment of The ability to set Furthermore, the comparison with Your proposed example of non-inheriting In summary, I share your concerns. |
There is some complexity but still there will be a confusion which you've highlighted in previous section about |
For what I recall, # The module displays only ANL
my_module(datanames = "all", transformator = transformator_where_ANL_is_created) |> set_datanames("ANL") I agree that the user can set # The module displays only ANL but shows a warning
my_module(datanames = "ANL", transformator = transformator_where_ANL_is_created) The user will receive a warning that ANL does not exist, but the module will still execute. Questions
|
I've been reading the comments and went to check the feature, I'll digress a little bit to provide some background as a "new user" trying to understand the feature until I come back to the current discussion. Skip to under the title if you wish. On NEWS it is described as "Introduced a function While checking the current examples of
The function currently only applies to the first module, not all modules? The name might also be confusing: From what I understood from the comments this function (why it is not a method?) should be run at a later stage instead of initialization like (validation?). It would be great if the datanames could be check with the data (qenv?) parameter dynamically. This way no warning should display before the required datasets are created. About set_datanames/datanames discussionUtility Using Notation Answers to questions:
|
@donyunardi -
@donyunardi same would happen if you do
@donyunardi no it wouldn't be necessary. Most of our modules have
@donyunardi it was the first thought of mine that we could have a nice API for datanames handling which could be easy to understand by the community. As I've explained in previous comments |
Yes, because the second module has
This is what we do. In srv_teal we check if the objects hold in
@llrs-roche theoretically no. If one doesn't need dataset names |
Handling this function as a each call being areplacement of If we want to keep set_datanames, I think it should only be applied to individual Alternatively/complementary we could move closer to If I'm not mistaken, this would remove any complexity with the order of operation. Some toy examples with #> "all" = c("a", "b", "c", "d")
modules(
label = "m1",
modules(
label = "m1.1",
module(label = "m1.1.1") |> set_datanames(-c)
) |> set_datanames(-b)
) |> set_datanames(-a)
#> can be translated to:
#> m1: b, c, d
#> m1.1: c, d
#> m1.1.1: d #> "all" = c("a", "b", "c", "d")
modules(
label = "m1",
module(label = "m1.1") |> select_datanames(a, b)
module(label = "m1.2") |> select_datanames(-c)
) |> select_datanames(a, c, d)
#> can be translated to:
#> m1: a, c
#> m1.1: a
#> m1.2: a, d As a path forward, I'm thinking that we could start by limiting Step 2. would be to contact stakeholders to see if there's an appetite for
This is the "law" for any approach we have here, there would be a question of whether there should be a warning (if directly applied) And the same with argument-specified datanames (this could be discussed, but I think it should behave the same way as the |
That's a good observation. But stil what is the value added of this utility? To change # abstract scenario
modules(
module() |> set_datanames(a, b),
module(datanames = c("a", "b"))
)
# more realistic scenario
modules(
tm_data_table() |> set_datanames(a, b),
tm_data_table(datasets_selected = c("a", "b"))
) |
The problem with For example, this: tm_data_table() |> set_datanames(c("a", "b")) is functionally no different from this: tm_data_table(datanames = c("a", "b")) Why add another layer of abstraction when the same result can be achieved with more clarity using an existing argument? For users, the constructor-based approach is simpler to understand and consistent across all modules. |
@averissimo about keeping The To summarize: |
After our discussion, the team has decided to remove the However, this change requires us to review all While most modules include an argument (or equivalent to it) to configure We will close this issue and open a new issue to handle the removal of |
Feature description
Imagine following
Thanks to above, there will be an alternative solution to exclude datanames without using dot-prefix.
Code of Conduct
Contribution Guidelines
Security Policy
The text was updated successfully, but these errors were encountered: