-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Adds decorate functionality to module output #1357
base: main
Are you sure you want to change the base?
Conversation
…er creation - some documentation - some todo's
R/module_transform_data.R
Outdated
#' @rdname module_transform_data | ||
ui_transform_data <- function(id, transformers = list(), class = "well") { | ||
ui_teal_transform_data <- function(id, transformators, class = "well") { |
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.
how about ui/srv_transform_teal_data
This is because of:
Module to transform
reactive
teal_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 agree and the team as well, on it
Although this requires a bunch of changes, so no single commit to show. I'll make the change in teal and then apply in tmg
#' @name teal_transform_module | ||
#' | ||
#' @export | ||
teal_transform_module <- function(ui = NULL, |
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 is your opinion about putting package name in the function name? Can it be just transform_module()
?
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'm a little bit confused what the convention is - also looking into other functions
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 think it can, but we may want to do this in a different issue and apply the same convention package-wide.
If my memory serves me, weeks/months ago we were all discussing with you @pawelru that module
and modules
should have the teal_
prefix.
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.
that's exactly the part that I'm currently struggle with :)
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.
Naming convention could be improved, we can discuss it on another issue for sure
Decorator failures are managed by an internal `teal` mechanism called **trigger on success**, which ensures that the `data` | ||
object within the module remains intact. If a decorator fails, it will be ignored, and an appropriate error message will be displayed. |
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.
isn't it too technical?
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 decorator is a technical feature of the framework. We need to go into some details.
I'm not too sure about what it means to "remain intact". @m7pr can you clarify as you were the last one to change this line 😅
Decorator failures are managed by an internal `teal` mechanism called **trigger on success**, which ensures that the `data` | |
object within the module remains intact. If a decorator fails, it will be ignored, and an appropriate error message will be displayed. | |
Decorator failures are managed by an internal `teal` mechanism called **trigger on success**, which ensures that the `data` | |
object within the module remains intact. | |
If a decorator fails, the outputs will not be shown, and an appropriate error message will be displayed. |
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.
Like the object will not be changed inside module/teal_data id the decorator produces an error : P
Co-authored-by: Pawel Rucki <[email protected]> Signed-off-by: André Veríssimo <[email protected]>
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.
Just a small suggestion for the vignette as I was reading & running it locally to understand this feature better.
|
||
Preserving the object's class during decoration is essential for compatibility. It ensures that the subsequent "display" logic can seamlessly handle both decorated and non-decorated objects. | ||
|
||
The decoration process can vary in complexity: |
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.
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.
Good catch!
My assumption was that this is automatically detected - it seems that it's not
markdownlint results
❯ markdownlint vignettes/decorate-module-output.Rmd
vignettes/decorate-module-output.Rmd:15:98 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:15:81 MD013/line-length Line length [Expected: 80; Actual: 98]
vignettes/decorate-module-output.Rmd:16:103 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:16:81 MD013/line-length Line length [Expected: 80; Actual: 103]
vignettes/decorate-module-output.Rmd:17:208 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:17:81 MD013/line-length Line length [Expected: 80; Actual: 208]
vignettes/decorate-module-output.Rmd:18:81 MD013/line-length Line length [Expected: 80; Actual: 108]
vignettes/decorate-module-output.Rmd:22:81 MD013/line-length Line length [Expected: 80; Actual: 587]
vignettes/decorate-module-output.Rmd:24:81 MD013/line-length Line length [Expected: 80; Actual: 597]
vignettes/decorate-module-output.Rmd:26:81 MD013/line-length Line length [Expected: 80; Actual: 190]
vignettes/decorate-module-output.Rmd:29:81 MD013/line-length Line length [Expected: 80; Actual: 120]
vignettes/decorate-module-output.Rmd:29 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- **Simple Decorations**: Sing..."]
vignettes/decorate-module-output.Rmd:30:81 MD013/line-length Line length [Expected: 80; Actual: 161]
vignettes/decorate-module-output.Rmd:32:81 MD013/line-length Line length [Expected: 80; Actual: 290]
vignettes/decorate-module-output.Rmd:38:81 MD013/line-length Line length [Expected: 80; Actual: 222]
vignettes/decorate-module-output.Rmd:39:81 MD013/line-length Line length [Expected: 80; Actual: 272]
vignettes/decorate-module-output.Rmd:41:81 MD013/line-length Line length [Expected: 80; Actual: 136]
vignettes/decorate-module-output.Rmd:45:109 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:45:81 MD013/line-length Line length [Expected: 80; Actual: 109]
vignettes/decorate-module-output.Rmd:48:81 MD013/line-length Line length [Expected: 80; Actual: 116]
vignettes/decorate-module-output.Rmd:49:110 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:49:81 MD013/line-length Line length [Expected: 80; Actual: 110]
vignettes/decorate-module-output.Rmd:50:213 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:50:81 MD013/line-length Line length [Expected: 80; Actual: 213]
vignettes/decorate-module-output.Rmd:51:81 MD013/line-length Line length [Expected: 80; Actual: 98]
vignettes/decorate-module-output.Rmd:55:81 MD013/line-length Line length [Expected: 80; Actual: 227]
vignettes/decorate-module-output.Rmd:56:74 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:57:106 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:57:81 MD013/line-length Line length [Expected: 80; Actual: 106]
vignettes/decorate-module-output.Rmd:78:62 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:79:73 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:80:81 MD013/line-length Line length [Expected: 80; Actual: 202]
vignettes/decorate-module-output.Rmd:96:144 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:96:81 MD013/line-length Line length [Expected: 80; Actual: 144]
vignettes/decorate-module-output.Rmd:97:126 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:97:81 MD013/line-length Line length [Expected: 80; Actual: 126]
vignettes/decorate-module-output.Rmd:98:81 MD013/line-length Line length [Expected: 80; Actual: 180]
vignettes/decorate-module-output.Rmd:126:209 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:126:81 MD013/line-length Line length [Expected: 80; Actual: 209]
vignettes/decorate-module-output.Rmd:127:81 MD013/line-length Line length [Expected: 80; Actual: 193]
vignettes/decorate-module-output.Rmd:149:80 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:150:81 MD013/line-length Line length [Expected: 80; Actual: 123]
vignettes/decorate-module-output.Rmd:151:81 MD013/line-length Line length [Expected: 80; Actual: 133]
vignettes/decorate-module-output.Rmd:152:81 MD013/line-length Line length [Expected: 80; Actual: 119]
vignettes/decorate-module-output.Rmd:182:81 MD013/line-length Line length [Expected: 80; Actual: 123]
vignettes/decorate-module-output.Rmd:183:81 MD013/line-length Line length [Expected: 80; Actual: 134]
vignettes/decorate-module-output.Rmd:205:120 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:205:81 MD013/line-length Line length [Expected: 80; Actual: 120]
vignettes/decorate-module-output.Rmd:206:80 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:210 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
vignettes/decorate-module-output.Rmd:212:81 MD013/line-length Line length [Expected: 80; Actual: 93]
vignettes/decorate-module-output.Rmd:312 MD024/no-duplicate-heading Multiple headings with the same content [Context: "Example Module"]
vignettes/decorate-module-output.Rmd:314:81 MD013/line-length Line length [Expected: 80; Actual: 308]
vignettes/decorate-module-output.Rmd:406:81 MD013/line-length Line length [Expected: 80; Actual: 87]
vignettes/decorate-module-output.Rmd:421 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
vignettes/decorate-module-output.Rmd:493 MD024/no-duplicate-heading Multiple headings with the same content [Context: "Application"]
markdownlint results without MD13 (line lenght) rule
❯ markdownlint vignettes/decorate-module-output.Rmd --disable MD013
vignettes/decorate-module-output.Rmd:15:98 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:16:103 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:17:208 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:29 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- **Simple Decorations**: Sing..."]
vignettes/decorate-module-output.Rmd:45:109 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:49:110 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:50:213 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:56:74 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:57:106 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:78:62 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:79:73 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:96:144 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:97:126 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:126:209 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:149:80 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:205:120 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:206:80 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
vignettes/decorate-module-output.Rmd:210 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
vignettes/decorate-module-output.Rmd:312 MD024/no-duplicate-heading Multiple headings with the same content [Context: "Example Module"]
vignettes/decorate-module-output.Rmd:421 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
vignettes/decorate-module-output.Rmd:493 MD024/no-duplicate-heading Multiple headings with the same content [Context: "Application"]
Your observation is there - among tons of other things :)
markdownlint is designed for .md
files. I believe that .Rmd
should have a similar structure (if not identical) - worst case we would have to disable some of the rules. I'm thinking that we should configure our superlinter CI workflow to process .Rmd
with markdownlint
. Let me create an issue for this. For the time being - I would recommend to test it manually.
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.
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.
Nice, the heading checks might help to structure better the vignettes or simplify the sections.
I think you meant to link to https://github.com/insightsengineering/idr-tasks/issues/823
tm_decorated_plot("no-ui", decorators = list(static_decorator)), | ||
tm_decorated_plot("lang", decorators = list(static_decorator_lang)), | ||
tm_decorated_plot("interactive", decorators = list(interactive_decorator)), | ||
tm_decorated_plot("interactive-from lang", decorators = list(interactive_decorator_lang)), |
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 interactive-from lang example doesn't change the axis labels (on current branch status):
decorator_interactive_from_lang.mp4
The interactive_decorator_lang
decorator uses make_teal_transform_server
which is also used by static_decorator
( used in no-ui tab example) but on that example there is no possible change on the axis by the app user.
Other examples showing how to use decorators to change the axis interactively via function or with an interactive decorator work though.
Co-authored-by: Marcin <[email protected]> Fixes comments on vignette example on #1357
closes #1383 #1384
Companion PRs:
decorators
feature branch teal.modules.general#795example tmg app