-
-
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
nicer way to call a teal module outside of teal #624
Comments
Nice task - I agree with all of your list of other not so nice things :)
I think this feeds into making the interface clear as to what Then you can use FilteredData (or some other output from teal.slice if we split FilteredData) which adheres to that interface or something that doesn't even use the filter panel in the app as above. With insightsengineering/teal.reporter#5 we should think about other arguments teal::init is going to ask of the modules |
I would go as far as to throw the whole FilteredData object out the window and be content with a list of data objects (Dataset objects? maybe new quosures or something? perhaps raw data.frames would be good enough? It is just data passed from the user anyway, right? - should be possible just to relay it to a module) and reactive filter states updated by the filter panel. In a module, it should be possible to apply the filters to data to get filtered data. This would nicely split data from filters and tie well with decoupling and different specialisations of the filter panel - a filter panel for data.frames, for mae, for Dataset, for MAEDataset, for TealData, for a dm object? There is little reason not to work in the filter panel with whatever you can think of, even in cases where the initial code for creating the object isn't available. After all, it is better to have some code than no code at all. Once filter panel works with just data.frames and data is passed smoothly and with minimal interruption from user input to the modules, there is little stopping teal from working with just a bunch of data.frames. The last stop is to release the pressure of defining data_extract_specs either by making module developers always provide defaults or just by resigning from extract specs altogether. transform them into nice custom js widgets and let module developers call them by input$. Once done with all of the above, out of the blue it's possible to do stuff like this: app <- teal::app(iris, modules = teal.modules.general::tm_variable_browser)
shiny::shinyApp(app$ui, app$server) where the majority of the code is package names XD On the module developer front, I would do everything to make people just write shiny modules and let them put it into teal without any additional tinkering. Ideally, at first, they should be able to: teal::app(iris, module = list(UI = my_custom_ui, srv = my_custom_srv)) and as long as my_custom_srv didn't throw before, it should not throw after piping it into teal. Then, I would give them tools to enhance their shiny modules: here's how you can add filtering, here's how you can add source code tracking, here's how you can write Arguably, some of it is already in. Source code is opt in. FilteredData is mandatory, the whole teal data model is mandatory, filter panel is mandatory because FilteredData. It's possible to get the raw data which is nice but it's wrapped around FilteredData. You don't have to use data extract specs which is nice, but the server function for some reason needs to have obscure arguments. It's a bit good, but a bit bad, would be nice if it's all gravy. |
I'm copying here content of the duplicated issue
Currently following methods from FilteredData are used in the modules:
Alternatively datasets can be wrapped in the simple class object with limited number of methods. Edit: followup issues. Part of the api simplification milestone |
Closing in favour of followup issues |
As a non-teal app developer
I would like use teal module created in teal.modules.xyz in my non-teal app
The business case is a DASHDIS app that wanted to use tmc but they found it pretty difficult to do.
Please see following code:
The encapsulation of teal modules is not that great and it is still heavily depends on the teal (internal!) functions to be executed. There are also other not so nice things such as:
dataset
object - I think it could be simplified into the reactive values (or list of reactive values) - that would be a refactor on teal.modules.xyz codesI also think that a module could return something (reactive list) to the caller such as R code, or output. We need to agree on the structure (to be the same for all the modules). I am fine to keep it as a separate feature request.
The text was updated successfully, but these errors were encountered: