-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Tdata in tealdata@main #138
Conversation
Code Coverage Summary
Diff against main
Results for commit: 2baafc5 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Test Performance Difference
Results for commit b560ada ♻️ This comment has been updated with latest results. |
…ta_in_tealdata@main
#' get_metadata(data, "iris") | ||
#' | ||
#' @export | ||
new_tdata <- function(data, code = "", join_keys = NULL, metadata = NULL, check = FALSE, label) { |
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.
the check
argument here is not in its perfect place and is only passed downstream inside FilteredData
to be called in teal::get_datasets_code
to evaluate if an warning message should be returned in the SRC or not.
An alternative to this would be not to pass check
at all but rather to evaluate if check
is TRUE or FALSE upstream and throw a warning message in the console. This will not return a warnings message in the SRC as it is done now but will avoid us the passing an unnecessary argument all through the teal app setup.
@nikolas-burkoff @donyunardi @lcd2yyz
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.
NEWS update? But I guess not if this is internal only. |
#' | ||
#' @return (`character`) code used in the `tdata` object. | ||
#' @export | ||
get_code_tdata <- function(data) { |
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.
I don't understand why there are 2 functions here. I could maybe see it if get_code.tdata
was not exported, but it is. As a user I would be confused as to which one I should use.
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.
So (at least when tdata lived in teal) there was a name clash between get_code() in teal.data and get_code in teal.code and this was a way to force the modules to pull the get_code from teal.data -> if there's a nicer way to do this (without making teal.code and teal.data have a dependency) then happy to change
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.
What about axing get_code.tdata
and just use get_code_tdata
then? It feels like an unnecessary complexity to have both.
If we keep get_code.tdata
though, the generic documentation should be updated. Right now the generic reads @param x ([
TealDatasetConnector] or [
TealDataset]). If of class
character will be treated as file to read.
It should also say tdata
in this case.
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.
What about axing get_code.tdata and just use get_code_tdata then? It feels like an unnecessary complexity to have both.
Fair enough
#' @param x a `tdata` object | ||
#' @param ... additional arguments for the generic | ||
#' @export | ||
get_code.tdata <- function(x, ...) { # nolint |
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.
To me the home for this is R/get_code.R
#' @param data `tdata` - object to extract the join keys | ||
#' @return Either `JoinKeys` object or `NULL` if no join keys | ||
#' @export | ||
get_join_keys <- function(data) { |
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.
Using S3 here and for metadata feels like overkill.
I want to confirm the reason we have
If this is true, why do we need to feed |
@asbates - yup we should have NEWS
So the idea here is eventually we will not have a Eventually the data flow in
Part 4) is already on main. Part 2) is in this collection of PRs, part 3) is waiting for After all these changes, in order to use/test/maintain This should simplify things a lot - a year ago in order to test a module you needed to create a Another benefit we can introduce here is that at the moment pulling the data can only occur once per shiny session - we can change this as some apps want to be able to pull the data multiple times - and also this can then remove the splash screen for DDL and the additional reactivity cycle coming from insertUI - see this old branch for inspiration There are some complexities at this point which need to be handled - hence trying to do just this baby step first:
Do we actually want to keep this behaviour (esp given the open "look at
Happy to talk about the above points in a meeting to explain in more detail. The correct solution to these really is teal 1.0: Instead of everything (check, preprocessing code, filtering code, filter_panel_api for the formatted filter states) being passed into the modules to be included in the report/show r code you have the modules passing their code snippet into teal::init to handle the SRC/report cards. In practice this means SRC becomes teal getting information from teal.data, the filter panel and the modules and combining them together. Teal is the right place for these things to live: "why does a module need to know the code used to filter the data that is being passed into it" and "why does every module need filter_panel_api passed into it purely to get the filter information in the report card - when the module itself has no concept of filtered data - it just has "data"?" This then would allow much better reports (with say a "Data processing" section containing the getting the data and then "Outputs" section containing the module outputs - and the R code for each output would not need another copy of the "getting data" section as it currently does. but I think this is quite a long way away - a decisions could be made to pause this work and attempt work on teal 1.0 first, or to abandon completely etc. |
I don't know the history of this message, I can only guess that it was added to limit potential liability on app developer.
Agree with this, but sounds like major refactor again, something we need to come back to in the future. Can you help open a new issue to log down all your thoughts about this? |
So in some sense all the refactor work we've been doing for teal has been leading towards this - my thoughts are in agreement with @gogonzo and he has our thoughts together with a diagram here (the list of issues in the milestone is not complete) |
Closing, we are choosing different solution |
closes ##121
depends on insightsengineering/teal.slice#212 and insightsengineering/teal#808
-Moved
tdata
fromteal
toteal.data
-Added
get_tdata
method toTealData
-Updated downstreams to use
TealData$get_tdata()
output instead of aTealData
object-Updated tests
TODO:
-figure the
code
issue