insightsengineering / insightsengineering/teal
[Question]: Making easier to customize modules?
- Dominant language
- R
- Stars
- 263
- Forks
- 59
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 5
Description
### What is your question?
This issue documents discussions about how teal should work around modifications to modules.
It grow up from #1597.
## Need
App developers might want to change how some modules behave, both the UI and the server part.
Examples observed:
- Change the label of an input
- Remove code blocks from the reporter for some or all modules
- Modify output (customize plots, tables, ...)
- Modify data input (Filter data, apply custom modifications, ...)
- Disable sidebar: #1601
## Current state
There are several functions to allow modification of existing `teal_modules`:
- `make_teal_transform_server`: creates a new module with a reactive evaluating the expression provided
It can modify the output of the module by modifying the code. It uses a `moduleServer`.
- `teal_transform_module`: it only modifies the output (but accept and ui function), usage of `make_teal_transform_server` is suggested for the server argument. It uses a `moduleServer`.
- `modify_header`, `modify_title`, `modify_footer` : These functions can modify specific text/labels of the UI.
- `after`: Function that modifies the UI and the server (without restrictions)
There are also arguments in modules to modify them:
- `transformators`: Modify data input
- `decorators` (experimental): Modify data output (via `teal_transform_module`)
### Comments
During the addition of `decorators` and `transformators` arguments, it was considered whether to add a parameter or as an external function.
Some effort should be done to avoid having too many functions exported. Especially when the names can be confusing (all with transform on them).
`after` function has arguments that accept what looks like module functions but they are not. This could confuse users of the function.
Using a function like `after` should be compatible with using a `decorator` and/or a `transformator` as arguments on the module.
## Open questions
### UI
Developers might want to update, add or remove UI elements: How to help app-developers avoiding problems like not returning the UI, duplicating it, removing a necessary input, ...?
How should we give the freedom to place new UI elements? Using an argument like `.cssSelector` with some default or freely with unrestricted capabilities.
### Server
Changes can be applied before module execution like `transformators` and/or after the module execution like `decorators`: How should we control that?
**Where** to allow them:
- As an expression evaluated on `data`?
- Inside a reactive object?
- Inside the server function module?
If the expressions are allowed on multiple places, how could the package distinguish each case?
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct.
### Contribution Guidelines
- [x] I agree to follow this project's Contribution Guidelines.
### Security Policy
- [x] I agree to follow this project's Security Policy.
Contributor guide
Assessment
This issue has not been assessed yet.