-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from OHDSI/dev_cc
creates tables for summariseMissingData and summariseAllConceptCount
- Loading branch information
Showing
12 changed files
with
217 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#' Create a visual table from a summariseAllConceptCounts() result. | ||
#' @param result A summarised_result object. | ||
#' @param type Type of formatting output table, either "gt" or "flextable". | ||
#' @return A gt or flextable object with the summarised data. | ||
#' @export | ||
#' | ||
#' | ||
tableAllConceptCounts <- function(result, | ||
type = "gt") { | ||
# initial checks | ||
omopgenerics::validateResultArgument(result) | ||
omopgenerics::assertChoice(type, choicesTables()) | ||
|
||
# subset to result_type of interest | ||
result <- result |> | ||
visOmopResults::filterSettings( | ||
.data$result_type == "summarise_all_concept_counts") | ||
|
||
# check if it is empty | ||
if (nrow(result) == 0) { | ||
warnEmpty("summarise_all_concept_counts") | ||
return(emptyTable(type)) | ||
} | ||
|
||
estimate_names <- result |> | ||
dplyr::distinct(.data$estimate_name) |> | ||
dplyr::pull() | ||
estimateName <- c() | ||
if ("record_count" %in% estimate_names) { | ||
estimateName <- c(estimateName, "N records" = "<record_count>") | ||
} | ||
if ("person_count" %in% estimate_names) { | ||
estimateName <- c(estimateName, "N persons" = "<person_count>") | ||
} | ||
|
||
result |> | ||
formatColumn(c("variable_name", "variable_level")) |> | ||
visOmopResults::visOmopTable( | ||
type = type, | ||
estimateName = estimateName, | ||
header = c("cdm_name"), | ||
rename = c("Database name" = "cdm_name"), | ||
groupColumn = c("omop_table", visOmopResults::strataColumns(result)) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#' Create a visual table from a summariseMissingData() result. | ||
#' @param result A summarised_result object. | ||
#' @param type Type of formatting output table, either "gt" or "flextable". | ||
#' @return A gt or flextable object with the summarised data. | ||
#' @export | ||
#' | ||
#' | ||
tableMissingData <- function(result, | ||
type = "gt") { | ||
# initial checks | ||
omopgenerics::validateResultArgument(result) | ||
omopgenerics::assertChoice(type, choicesTables()) | ||
|
||
# subset to result_type of interest | ||
result <- result |> | ||
visOmopResults::filterSettings( | ||
.data$result_type == "summarise_missing_data") | ||
|
||
# check if it is empty | ||
if (nrow(result) == 0) { | ||
warnEmpty("summarise_missing_data") | ||
return(emptyTable(type)) | ||
} | ||
|
||
result |> | ||
formatColumn(c("variable_name", "variable_level")) |> | ||
visOmopResults::visOmopTable( | ||
type = type, | ||
estimateName = c( | ||
"N (%)" = "<na_percentage> (%)", | ||
"N" = "<na_count>"), | ||
header = c("cdm_name"), | ||
rename = c("Database name" = "cdm_name"), | ||
groupColumn = c("omop_table", visOmopResults::strataColumns(result)) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters