-
-
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
632 teal add reporter vignette@main #642
Conversation
module * fixed a note in the join keys vignette Closes #632
Code Coverage Summary
Results for commit: 8425a6b1a98fd3c44ec1283989935647d4e8fd78 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
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.
Content's really good - see comments inline and also
- I would probably refer to the new add reporting vignette from the "creating_custom_modules" vignette
`teal` supports an in-built reporting feature using the `vignette("teal.reporter")` package. Head to its documentation | ||
if you want to know more about the reporting itself. | ||
|
||
This article explains how to enhance a custom `teal` module with an automatic reporting feature. The enhancement |
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'd make even more clear this vignette is for module developers rather than app developers
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 I wished we had in teal
is two separate sections of vignettes, one titled: Module development
and another Application development
and I could put this vignette in the module section.
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.
Added
The responsibilities of a module developer include: adding the support for reporting to their module and specifying | ||
outputs that go into a snapshot of their module. The lifecycle of objects involved in creation of the report and | ||
setting up the module to preview the report is handled by `teal`. |
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.
(optional)
The responsibilities of a module developer include: adding the support for reporting to their module and specifying | |
outputs that go into a snapshot of their module. The lifecycle of objects involved in creation of the report and | |
setting up the module to preview the report is handled by `teal`. | |
The responsibilities of a module developer include: | |
- adding the support for reporting to their module | |
- specifying outputs that go into a snapshot of their module. | |
The lifecycle of objects involved in creation of the report and setting up the module to preview the report is handled by `teal`. |
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.
Chabnged
The first step is to add another argument to the server function declaration - `reporter`. This needs to be the third | ||
argument to the server function inside the `teal.module` call. See below: |
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 think it needs to be third - right now it has to go id then datasets but then you could have other stuff before reporter - but maybe better to simpler and say it must be third
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 was not aware of this. Considering the complexity of the explanation, it might be better to leave the more straightforward but not entirely true statement here.
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.
fair enough
if (interactive()) shinyApp(app$ui, app$server) | ||
``` | ||
|
||
`teal` added another tab to the application titled `Report previer` but besides that there appears to be no change in |
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.
`teal` added another tab to the application titled `Report previer` but besides that there appears to be no change in | |
`teal` added another tab to the application titled `Report previewer` but besides that there appears to be no change in |
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.
Changed
|
||
`teal` added another tab to the application titled `Report previer` but besides that there appears to be no change in | ||
how the module works and what it looks like. User cannot interact with it to add to the report from this module yet. | ||
Thankfully, `teal.report` provides `ui` and `server` objects that support that. |
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.
Thankfully, `teal.report` provides `ui` and `server` objects that support that. | |
Thankfully, `teal.reporter` provides `ui` and `server` objects that support that. |
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.
changed
### Add content to the card | ||
We will use the public API exposed by the `teal.reporter::ReportCard` and `teal.reporter::TealReportCard` classes | ||
to add content to a card. The `teal.reporter::simple_reporter_srv` module accepts the `card_fun` argument that | ||
dictates the way the output from our custom module will look like. `ReportCard` and its derivatives adds |
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.
dictates the way the output from our custom module will look like. `ReportCard` and its derivatives adds | |
dictates the way the output from our custom module will look like. `ReportCard` and its derivatives add |
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.
fixed
label, | ||
server = function(id, datasets, reporter) { | ||
moduleServer(id, function(input, output, session) { | ||
custom_function <- function(card = teal.reporter::ReportCard$new()) { |
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.
could we have the custom function above the module so it's clear what we are adding and then either have a new block with "putting it all together we have:" or just have card_fun = custom_fun
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.
moved
``` | ||
|
||
### Add non-text content to the card | ||
Explore the API of `teal.reporter::ReportCard` to learn what types of content are supported. |
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 would at least give a taster - "it is possible to add tables and charts etc. to the ReportCard see the docs..." or something like that
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.
added
Otherwise, the API of `TealReportCard` will not be available inside the function. | ||
|
||
### Use a child class of `ReportCard` inside the module | ||
`teal.reporter` allows using a child of `ReportCard` inside the function passed 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.
I wonder if this section belongs in roxygen rather than here as it's quite specific and unlikely to be used by most module developers?
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.
moved to the docs of teal.reporter::add_card_button_srv
### Add non-text content to the card | ||
Explore the API of `teal.reporter::ReportCard` to learn what types of content are supported. | ||
|
||
### `TealReportCard` |
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 I'm torn between using this as the default - as we are in teal of course! - or not
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.
My view is that TealReportCard is only helpful if the module uses all the things teal
offers - the source code thing and filter states. And all those things do not need to be used by the module, so in my mind, it should not be the default.
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.
fair enough
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.
Looks good, a few minor comments but this can then go in
The first step is to add another argument to the server function declaration - `reporter`. This needs to be the third | ||
argument to the server function inside the `teal.module` call. See below: |
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.
fair enough
label, | ||
server = function(id, datasets, reporter) { | ||
moduleServer(id, function(input, output, session) { | ||
output$text <- renderPrint(datasets$get_data(input$dataname, filtered = TRUE)) |
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.
### Add non-text content to the card | ||
Explore the API of `teal.reporter::ReportCard` to learn what types of content are supported. | ||
|
||
### `TealReportCard` |
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.
fair enough
Co-authored-by: Nikolas Burkoff <[email protected]>
Requires: #635
It's a vignette. Run the code inside it to test.