Skip to content
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

use report_card_template in tm_missing_data #634

Closed
donyunardi opened this issue Feb 13, 2024 · 3 comments
Closed

use report_card_template in tm_missing_data #634

donyunardi opened this issue Feb 13, 2024 · 3 comments
Labels

Comments

@donyunardi
Copy link
Contributor

donyunardi commented Feb 13, 2024

card <- teal::TealReportCard$new()

Did we missed this during this PR?
#584

Should this be using teal::report_card_template()?

@donyunardi donyunardi mentioned this issue Feb 13, 2024
33 tasks
@m7pr
Copy link
Contributor

m7pr commented Feb 14, 2024

I don't think we did miss tm_missing_data as it is changed in this PR https://github.com/insightsengineering/teal.modules.general/pull/584/files#diff-a4da4c6e0574ea76e9c565bcc6c3126f847bb0cefcb1bbb8f5f1dfdeb3cd2e31R1203
You can not use teal::report_card_template directly for tm_missing_data as in other modules, as it needs to have label computed that is based on sum_type and dataname. Also the title is combined from multiple sources.

@m7pr
Copy link
Contributor

m7pr commented Feb 16, 2024

Based on the code of teal::report_card_template() we see it sets the name by title where tm_missind_data needs to have a set_name that uses label so there is no way to use teal::report_card_template() in here.

> teal::report_card_template
function(title, label, description = NULL, with_filter, filter_panel_api) {
  checkmate::assert_string(title)
  checkmate::assert_string(label)
  checkmate::assert_string(description, null.ok = TRUE)
  checkmate::assert_flag(with_filter)
  checkmate::assert_class(filter_panel_api, classes = "FilterPanelAPI")

  card <- teal::TealReportCard$new()
  title <- if (label == "") title else label
  card$set_name(title)
  card$append_text(title, "header2")
  if (!is.null(description)) card$append_text(description, "header3")
  if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
  card
}

@m7pr m7pr closed this as completed Feb 16, 2024
@donyunardi
Copy link
Contributor Author

ah okay, thanks @m7pr !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants