Skip to content

Commit

Permalink
tighten up report-1
Browse files Browse the repository at this point in the history
ref #5
  • Loading branch information
wibeasley committed Dec 30, 2021
1 parent c6c1329 commit 7c2233b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 51 deletions.
38 changes: 0 additions & 38 deletions R/execute-checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,44 +154,6 @@ execute_rules <- function (ds, checks) {
rm(f, index, violations, ds_violation_single)
} # End for loop

# if (length(ds_rule_violation_list) == 0L) {
#
# rule_empty_violation <- function() {
# tibble::tibble(
# check_name = "all_passed",
# record_id = 0L,
# data_collector = "",
# error_message = "No violations existed in the dataset",
# priority = "",
# instrument = ""
# )
# }
#
# ds_rule_violation <- rule_empty_violation() # MAKE SURE THIS IS rule_empty_violation()
# # ds_rule_violation_pretty <- ds_rule_violation
# } else {
# ds_rule_violation <-
# ds_rule_violation_list |>
# dplyr::bind_rows() |>
# dplyr::arrange(.data$priority, .data$check_name, .data$record_id)
#
# # ds_rule_violation_pretty <-
# # ds_rule_violation |>
# # dplyr::mutate(
# # # record_id = sprintf(
# # # checks$link_specific,
# # # checks$redcap_version, checks$project_id, checks$default_arm, .data$record_id, .data$instrument, .data$record_id
# # # ),
# # check_name = gsub("_", " ", .data$check_name),
# # data_collector = gsub("_", " ", .data$data_collector),
# # instrument = gsub("_", " ", .data$instrument),
# # check_name = factor(.data$check_name),
# # )
# # colnames(ds_rule_violation_pretty) <- gsub("_", " ", colnames(ds_rule_violation_pretty))
# }
#
# browser()

ds_rule_results <-
ds_rule_violation_list |>
dplyr::bind_rows() |>
Expand Down
18 changes: 11 additions & 7 deletions inst/report-templates/rmarkdown-1/report-1.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ checks$rules |>
# checks$link_specific,
# checks$redcap_version, checks$project_id, checks$default_arm, .data$record_id, .data$instrument, .data$record_id
# ),
check_name = gsub("_", " ", .data$check_name),
# data_collector = gsub("_", " ", .data$data_collector),
# instrument = gsub("_", " ", .data$instrument),
check_name = factor(.data$check_name),
) |>
{\(d)
Expand Down Expand Up @@ -132,8 +129,15 @@ ds_smell_result_pretty <-
dplyr::arrange(priority, check_name)
ds_smell_result_pretty |>
dplyr::select(
"Smell Name" = check_name,
"Priority" = priority,
"Proportion of..." = description,
"Legal Boundaries" = boundaries,
"Value" = value,
"Pass" = pass,
) |>
knitr::kable(
col.names = c("Smell Name", "Priority", "Proportion of...", "Legal Boundaries", "Value", "Pass"),
align = "lrllrl",
escape = FALSE,
format = "html"
Expand All @@ -145,7 +149,7 @@ ds_smell_result_pretty |>
) |>
kableExtra::row_spec(
row = 0,
bold = T,
bold = TRUE,
color = "white",
background = palette_summary$header
) |>
Expand All @@ -155,12 +159,12 @@ ds_smell_result_pretty |>
) |>
kableExtra::row_spec(
row = which(!ds_smell_result_pretty$pass & ds_smell_result_pretty$priority == 1L),
bold = T,
bold = TRUE,
background = palette_summary$hot
) |>
kableExtra::row_spec(
row = which(!ds_smell_result_pretty$pass & ds_smell_result_pretty$priority >= 2L),
bold = T,
bold = TRUE,
background = palette_summary$warm
)
Expand Down
6 changes: 3 additions & 3 deletions inst/report-templates/rmarkdown-1/report-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@


<h1 class="title toc-ignore">Trawler Report</h1>
<h4 class="date">Date: 2021-12-30 13:23:51</h4>
<h4 class="date">Date: 2021-12-30 15:10:26</h4>

</div>

Expand All @@ -272,8 +272,8 @@ <h2 number="1.1"><span class="header-section-number">1.1</span> Rule Summary</h2
</div>
<div id="rule-detail" class="section level2" number="1.2">
<h2 number="1.2"><span class="header-section-number">1.2</span> Rule Detail</h2>
<div id="htmlwidget-9a04dde30b3e6493192b" style="width:100%;height:auto;" class="datatables html-widget"></div>
<script type="application/json" data-for="htmlwidget-9a04dde30b3e6493192b">{"x":{"filter":"top","vertical":false,"filterHTML":"<tr>\n <td><\/td>\n <td data-type=\"factor\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <div style=\"width: 100%; display: none;\">\n <select multiple=\"multiple\" style=\"width: 100%;\" data-options=\"[&quot;baseline first visit lab parameters&quot;,&quot;baseline prealbumin levels&quot;,&quot;daily first visit lab and workup parameters&quot;,&quot;daily protein intake&quot;,&quot;hospitalization reason&quot;,&quot;missing serum marker levels&quot;,&quot;npcr&quot;,&quot;npcr comparison&quot;,&quot;optimal daily protein intake&quot;,&quot;recommended npcr range&quot;,&quot;serum prealbumin levels 1&quot;,&quot;serum prealbumin levels 2&quot;,&quot;serum prealbumin levels completion data&quot;,&quot;serum prealbumin levels expectations&quot;]\"><\/select>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"disabled\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n<\/tr>","caption":"<caption>Violations at 2021-12-30 13:23:52<\/caption>","data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14"],["baseline prealbumin levels","missing serum marker levels","serum prealbumin levels 1","serum prealbumin levels 2","serum prealbumin levels completion data","serum prealbumin levels expectations","baseline first visit lab parameters","daily first visit lab and workup parameters","daily protein intake","hospitalization reason","optimal daily protein intake","recommended npcr range","npcr","npcr comparison"],["Serum pre-albumin level of all enrolled patients do not meet the study criterion","Relevant nutritional serum markers are missing","Baseline prealbumin levels are not missing however levels were not carefully monitored in the subsequent visit","Baseline prealbumin levels and pre-albumin levels during the 1st visit are not missing however levels in the next reading are missing","Baseline prealbumin levels are not missing however readings are not carefully monitored at completion","serum prealbumin levels are not missing however subsequent readings did not come as expected","Serum prealbumin levels are low and protein intake at baseline is less than optimal","In-addition to baseline & visit lab protein parameters, blood work-up npcr levels are also low","npcr levels in study have not improved as intended","Patient was hospitalized but reason and the date of hospitalization is missing","Daily protein intake is optimal but one of the nutritional marker is not within the normal range","NPCR values are not within the recommended range at completion","NPCR at completion is missing","NPCR at completion is not greater than npcr at baseline"],[1,1,1,1,1,1,1,1,1,1,1,1,1,1]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>check name<\/th>\n <th>error message<\/th>\n <th>priority<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"pageLength":30,"dom":"tip","initComplete":"function(settings, json) {\n$(this.api().table().header()).css({'background-color': '#555', 'color': '#fff'});\n}","columnDefs":[{"className":"dt-right","targets":3},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false,"orderCellsTop":true,"lengthMenu":[10,25,30,50,100]}},"evals":["options.initComplete"],"jsHooks":[]}</script>
<div id="htmlwidget-461b53f3ee0ff6b457e0" style="width:100%;height:auto;" class="datatables html-widget"></div>
<script type="application/json" data-for="htmlwidget-461b53f3ee0ff6b457e0">{"x":{"filter":"top","vertical":false,"filterHTML":"<tr>\n <td><\/td>\n <td data-type=\"factor\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <div style=\"width: 100%; display: none;\">\n <select multiple=\"multiple\" style=\"width: 100%;\" data-options=\"[&quot;baseline_first_visit_lab_parameters&quot;,&quot;baseline_prealbumin_levels&quot;,&quot;daily_first_visit_lab_and_workup_parameters&quot;,&quot;daily_protein_intake&quot;,&quot;hospitalization_reason&quot;,&quot;missing_serum_marker_levels&quot;,&quot;npcr&quot;,&quot;npcr_comparison&quot;,&quot;optimal_daily_protein_intake&quot;,&quot;recommended_npcr_range&quot;,&quot;serum_prealbumin_levels_1&quot;,&quot;serum_prealbumin_levels_2&quot;,&quot;serum_prealbumin_levels_completion_data&quot;,&quot;serum_prealbumin_levels_expectations&quot;]\"><\/select>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"disabled\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n<\/tr>","caption":"<caption>Violations at 2021-12-30 15:10:27<\/caption>","data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14"],["baseline_prealbumin_levels","missing_serum_marker_levels","serum_prealbumin_levels_1","serum_prealbumin_levels_2","serum_prealbumin_levels_completion_data","serum_prealbumin_levels_expectations","baseline_first_visit_lab_parameters","daily_first_visit_lab_and_workup_parameters","daily_protein_intake","hospitalization_reason","optimal_daily_protein_intake","recommended_npcr_range","npcr","npcr_comparison"],["Serum pre-albumin level of all enrolled patients do not meet the study criterion","Relevant nutritional serum markers are missing","Baseline prealbumin levels are not missing however levels were not carefully monitored in the subsequent visit","Baseline prealbumin levels and pre-albumin levels during the 1st visit are not missing however levels in the next reading are missing","Baseline prealbumin levels are not missing however readings are not carefully monitored at completion","serum prealbumin levels are not missing however subsequent readings did not come as expected","Serum prealbumin levels are low and protein intake at baseline is less than optimal","In-addition to baseline & visit lab protein parameters, blood work-up npcr levels are also low","npcr levels in study have not improved as intended","Patient was hospitalized but reason and the date of hospitalization is missing","Daily protein intake is optimal but one of the nutritional marker is not within the normal range","NPCR values are not within the recommended range at completion","NPCR at completion is missing","NPCR at completion is not greater than npcr at baseline"],[1,1,1,1,1,1,1,1,1,1,1,1,1,1]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>check name<\/th>\n <th>error message<\/th>\n <th>priority<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"pageLength":30,"dom":"tip","initComplete":"function(settings, json) {\n$(this.api().table().header()).css({'background-color': '#555', 'color': '#fff'});\n}","columnDefs":[{"className":"dt-right","targets":3},{"orderable":false,"targets":0}],"order":[],"autoWidth":false,"orderClasses":false,"orderCellsTop":true,"lengthMenu":[10,25,30,50,100]}},"evals":["options.initComplete"],"jsHooks":[]}</script>
</div>
</div>
<div id="smells" class="section level1 tabset tabset-fade" number="2">
Expand Down
Loading

0 comments on commit 7c2233b

Please sign in to comment.