-
-
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
999 set default datanames to ls(data@env) #1004
Conversation
Merge branch '999_default_dataname@main' of https://github.com/insightsengineering/teal into 999_default_dataname@main # Conflicts: # R/utils.R
Assertion on FilteredDATA will be addressed in issue insightsengineering/teal.slice#493 |
Update initial comment. |
Code Coverage Summary
Diff against main
Results for commit: f611e55 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Test Performance DifferenceAdditional test case details
Results for commit 4fd528d ♻️ This comment has been updated with latest results. |
I personally have some mixed feelings about this - not implementation per se but rather a design outlined in the issue. It's because those are implicit modifications of the data object which are pretty much hidden behind the scenes for the end-user. As a general rule, explicit is better than implicit. As a direct consequence: How about moving this into the constructor? This would address the use case of Related to this PR:
|
And that is the crux of the issue as we keep recommending using I agree about explicit > implicit. BUT we are changing the philosophy a little here. |
That's a valid point. Moving this to the constructor won't address the issue then...
Yes. I personally have some problems with this as I used to have a different meaning of datanames but it seems that I need to adapt and/or let's discuss it separately. Sticking with the definition you outlined in this thread for clarity. So if one does not tell which variables from data object are eligible for filtering I think we shouldn't alter that object. Now I'm thinking that this should be an exception in filter panel init. I'm challenging the place / time we do this. |
At the moment the filter panel can only handle As for the ( |
I'm exactly suggesting doing this during that step. When disassembling we should throw a message and use all objects. |
Consequence of this will be triggering each module on change of any dataset (even if dataset isn't used in a module).
I would like to highlight importance of Another scenario, if we consider everything in the |
@gogonzo I'm getting a little confused now
These are somewhat conflicting statements.
Yes. I am expecting that in the above mentioned issue of filter panel - we would either render empty div of throw warning and exclude objects of classes we don't support currently. Let me rephrase my point - we should avoid writting to
Let me deep dive into the code base so that I could be much more concrete |
You have to modify the app by setting the modules's |
yes, I was experimenting with teal.gallery app by not setting datanames and running app. I realized this is app-developer responsibility to set correct |
Yes, it is a responsibility of a module to skip unsupported datasets or app developer to correctly specify Problem is that at this moment teal.gallery apps-code creates some garbage in |
This will still happen. |
I am running app by loading teal.slice from insightsengineering/teal.slice#497 |
Co-authored-by: Dawid Kałędkowski <[email protected]> Signed-off-by: kartikeya kirar <[email protected]>
Not setting data <- teal_data() |>
within({
set.seed(1)
library(scda)
library(airway)
library(MultiAssayExperiment)
data(miniACC, envir = environment())
data(airway, envir = environment())
any_variable <- "elo"
ADSL <- synthetic_cdisc_data("latest")$adsl
ADSL$categorical <- sample(letters[1:3], size = nrow(ADSL), replace = TRUE, prob = c(.1, .3, .6))
ADTTE <- synthetic_cdisc_data("latest")$adtte
ADRS <- synthetic_cdisc_data("latest")$adrs
})
get_code(data, datanames = "ADRS")
# Error in .local(object, deparse, ...) :
# Assertion on 'datanames' failed: Must be a subset of the empty set, i.e. also empty. |
Is this a problem in the app? By the time we get to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a problem in the app? By the time we get to get_code, datanames have been set by teal.
It is not a Today's problem. We use get_code_dependency
in .datasets_to_data
so we are not limited by the fact that @datanames
of data
object is not set.
Normally, if we use get_code(datanames=)
we wouldn't be able to run get_code
as in teal
we avoid to set default datanames(data) <- names(data@env)
when datanames(data)
is empty. If we decide to use get_code()
in the future, we will be forced to either:
- Relax
get_code(datanames=)
to accept any name, or - Force-set default
datanames
todata
object in earlyteal
stages.
This is not ideal but I don't request @kartikeyakirar to resolve all of this now. At this moment PR addresses what we need.
@kartikeyakirar could you please add |
About |
done f611e55 |
This comment was omitted https://github.com/insightsengineering/teal/pull/1004/files/0596deeb4575a6c0ac6f6c2251054303ccc500fb#r1427716753 during #1004 @kartikeyakirar would you mind reviewing ? --------- Signed-off-by: Marcin <[email protected]> Co-authored-by: unknown <[email protected]>
this fixes #999
Here, I am assigning the default dataset of data types as "data.frame" and "MultiAssayExperiment", which can be altered to any other class type as needed.Edit: added functionupdate_default_dataname
, is designed to retrieve and update defaultdatanames
from ateal_data
object. Purpose of this function is to extract environment object from ateal_data
object. If the object does not already have predefined dataset names, the function sets default names based on the environment.Edit: Based on the suggestion, the
init
function has been updated to avoid modifying theteal_data
object. Instead, ifdatanames
are not specified, it now passes the app through. Moreover, theteal_data_to_filtered_data
function has been adjusted to handle cases wheredatanames
are not pre-defined in theteal_data
object. In such case, this function assigns defaultdatanames
from the environment of theteal_data
object.AssertionDifferent data types inFilteredData
will be addressed in issue insightsengineering/teal.slice#493