-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
198 Include user's card labels when generating the report #835
Conversation
Signed-off-by: André Veríssimo <[email protected]>
Yay, indentation linter 🥳 |
Corrects SuperLinter errors that were already in `main` and unrelated to #835 They were caught by SuperLinter because we changed the files. --------- Co-authored-by: m7pr <[email protected]>
This looks good, @m7pr. Could you also add a unit test for |
Closes #198 and accompanied by insightsengineering/teal.modules.clinical#835 # The problem Currently most of the `teal` modules, that wrap up `teal.reporter` in their UI, have titles of the `ReportCard` hardcoded in their body. For example check out below 2 modules https://github.com/insightsengineering/teal.modules.clinical/blob/2b20a85b22f25f15f6808f745b4d1d5333b123f3/R/tm_g_ci.R#L484-L503 https://github.com/insightsengineering/teal.modules.clinical/blob/2b20a85b22f25f15f6808f745b4d1d5333b123f3/R/tm_g_km.R#L774-L793 Such hardcoded content in `card$set_name()` and `card$append_text()` has a great impact on the final `ReportCard`. If `label` in the `Add Card` module UI is not provided, then the card name is set to the one passed in `card$set_name()`. This is fine for cards that had empty labels - they will have a name populated by the developer of the teal module. ![image](https://github.com/insightsengineering/teal.reporter/assets/133694481/b5d3656b-b61f-450f-ba69-b9db14889a24) However `card$append_text()` like this https://github.com/insightsengineering/teal.modules.clinical/blob/2b20a85b22f25f15f6808f745b4d1d5333b123f3/R/tm_g_km.R#L778 and this https://github.com/insightsengineering/teal.modules.clinical/blob/2b20a85b22f25f15f6808f745b4d1d5333b123f3/R/tm_g_ci.R#L489 appends a content to the card. The card gets a hardcoded title, no matter what user specifies as a card label. # The solution `add_card_button_srv` allows to specify `card_fun` with `label` parameter for card's title & content customization. This means, that you are able to use `label` shiny input and use it in your `card_fun` to pass the title. We are able to rewrite teal modules, so that they have default titles, if `label` is empty in `Add Card` module UI. When it is not empty, then the `label` is used as a name and as a title of the card - like in this commit insightsengineering/teal.modules.clinical@5833c6c ## With label ![image](https://github.com/insightsengineering/teal.reporter/assets/133694481/2c96ba72-19eb-41c8-82a6-bd89bcaa02cc) ![image](https://github.com/insightsengineering/teal.reporter/assets/133694481/5ab17ab9-e2a9-40fc-96ee-068be0c34b42) ## Without the label ![image](https://github.com/insightsengineering/teal.reporter/assets/133694481/c318d90b-4518-4839-bf5a-5189e771c6bb) **so the default `teal` module name and title are used** ![image](https://github.com/insightsengineering/teal.reporter/assets/133694481/7c313c1c-adf6-4cdd-afba-d23791144dbd) --------- Signed-off-by: Marcin <[email protected]> Co-authored-by: kartikeya kirar <[email protected]> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Dony Unardi <[email protected]>
@kartikeyakirar while working on other packages, can you create a test function in this PR as well? you will need to create it in other packages anyway
Thanks |
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.
@kartikeyakirar please take out card_template and move it to teal.reporter.
insightsengineering/teal.modules.general#584 (comment)
Hey @kartikeyakirar looks like this staged deps cyclic error does not appear on this PR anymore. You are good to merge |
#933) this PR is extension to insightsengineering/teal.reporter#198 Here I have added card_template() function that generates a report card with a title, an optional description, and the option to append the filter state list. and is been used in insightsengineering/teal.modules.general#584 insightsengineering/teal.modules.clinical#835 insightsengineering/teal.modules.hermes#336 insightsengineering/teal.osprey#229 insightsengineering/teal.goshawk#241 ref issues and discussion: insightsengineering/teal.reporter#226 --------- Signed-off-by: kartikeya kirar <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Marcin <[email protected]> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
This PR allows end user to use their Card Name (label) to be passed to the Card Content. There are no more hardcoded titles. The hardcoded titles will be only used if Card Name (label0) is empty.
A follow-up after insightsengineering/teal.reporter#219