Skip to content

Commit

Permalink
rule detail
Browse files Browse the repository at this point in the history
ref #5
  • Loading branch information
wibeasley committed Dec 30, 2021
1 parent 7c2233b commit 82c55a6
Show file tree
Hide file tree
Showing 3 changed files with 361 additions and 11 deletions.
43 changes: 41 additions & 2 deletions inst/report-templates/rmarkdown-1/report-1.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ path_checks <-
checkmate::assert_character(path_checks, any.missing = FALSE, len = 1)
checkmate::assert_file_exists(path_checks, extension = "rds")
palette_summary <- list(warm = "#fde0ef", hot = "#f1b6da", header = "#555") #http://colrd.com/palette/18841/
```

<!-- Load the datasets. -->
Expand All @@ -63,6 +65,45 @@ A *rule* is very exact. Each record is examined, and determined if it passes ea
Rule Summary
-----------------------------
```{r table-rule-summary, echo = echo_chunks}
ds_rule_summary <- checks$rules
ds_rule_summary |>
dplyr::select(
`Rule Name` = .data$check_name,
`Priority` = .data$priority,
`Error Message` = .data$error_message,
`Violation Count` = .data$violation_count,
) |>
knitr::kable(
align = "lrlr",
escape = FALSE,
format = "html"
) |>
kableExtra::kable_styling(
bootstrap_options = c("hover", "condensed", "responsive"), #"striped",
full_width = FALSE,
position = "left"
) |>
kableExtra::row_spec(
row = 0,
bold = TRUE,
color = "white",
background = palette_summary$header
) |>
kableExtra::row_spec(
row = seq_len(nrow(ds_rule_summary)),
color = "#555"
) |>
kableExtra::row_spec(
row = which(ds_rule_summary$violation_count > 0 & ds_rule_summary$priority == 1L),
bold = TRUE,
background = palette_summary$hot
) |>
kableExtra::row_spec(
row = which(ds_rule_summary$violation_count > 0 & ds_rule_summary$priority > 1L),
bold = TRUE,
background = palette_summary$warm
)
```

Rule Detail
Expand Down Expand Up @@ -113,8 +154,6 @@ A *smell* test won't validate a specific record (like the rules above), but it w
Smell Summary
-----------------------------
```{r table-smell-summary, echo = echo_chunks}
palette_summary <- list(warm = "#fde0ef", hot = "#f1b6da", header = "#555") #http://colrd.com/palette/18841/
ds_smell_result_pretty <-
checks$smells |>
dplyr::transmute(
Expand Down
226 changes: 221 additions & 5 deletions inst/report-templates/rmarkdown-1/report-1.html

Large diffs are not rendered by default.

103 changes: 99 additions & 4 deletions inst/report-templates/rmarkdown-1/report-1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Trawler Report
date: "Date: 2021-12-30 15:10:26"
date: "Date: 2021-12-30 15:30:11"
output:
html_document:
keep_md: yes
Expand Down Expand Up @@ -35,14 +35,109 @@ A *rule* is very exact. Each record is examined, and determined if it passes ea

Rule Summary
-----------------------------

<table class="table table-hover table-condensed table-responsive" style="width: auto !important; ">
<thead>
<tr>
<th style="text-align:left;font-weight: bold;color: white !important;background-color: #555 !important;"> Rule Name </th>
<th style="text-align:right;font-weight: bold;color: white !important;background-color: #555 !important;"> Priority </th>
<th style="text-align:left;font-weight: bold;color: white !important;background-color: #555 !important;"> Error Message </th>
<th style="text-align:right;font-weight: bold;color: white !important;background-color: #555 !important;"> Violation Count </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> baseline_prealbumin_levels </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> Serum pre-albumin level of all enrolled patients do not meet the study criterion </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 10 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> missing_serum_marker_levels </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> Relevant nutritional serum markers are missing </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 3 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> serum_prealbumin_levels_1 </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> Baseline prealbumin levels are not missing however levels were not carefully monitored in the subsequent visit </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 15 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;"> serum_prealbumin_levels_2 </td>
<td style="text-align:right;color: #555 !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;"> Baseline prealbumin levels and pre-albumin levels during the 1st visit are not missing however levels in the next reading are missing </td>
<td style="text-align:right;color: #555 !important;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;"> serum_prealbumin_levels_completion_data </td>
<td style="text-align:right;color: #555 !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;"> Baseline prealbumin levels are not missing however readings are not carefully monitored at completion </td>
<td style="text-align:right;color: #555 !important;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;"> serum_prealbumin_levels_expectations </td>
<td style="text-align:right;color: #555 !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;"> serum prealbumin levels are not missing however subsequent readings did not come as expected </td>
<td style="text-align:right;color: #555 !important;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;"> baseline_first_visit_lab_parameters </td>
<td style="text-align:right;color: #555 !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;"> Serum prealbumin levels are low and protein intake at baseline is less than optimal </td>
<td style="text-align:right;color: #555 !important;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;"> daily_first_visit_lab_and_workup_parameters </td>
<td style="text-align:right;color: #555 !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;"> In-addition to baseline &amp; visit lab protein parameters, blood work-up npcr levels are also low </td>
<td style="text-align:right;color: #555 !important;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;"> daily_protein_intake </td>
<td style="text-align:right;color: #555 !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;"> npcr levels in study have not improved as intended </td>
<td style="text-align:right;color: #555 !important;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> hospitalization_reason </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> Patient was hospitalized but reason and the date of hospitalization is missing </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 2 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> optimal_daily_protein_intake </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> Daily protein intake is optimal but one of the nutritional marker is not within the normal range </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 7 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> recommended_npcr_range </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> NPCR values are not within the recommended range at completion </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 10 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> npcr </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> NPCR at completion is missing </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 1 </td>
</tr>
<tr>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> npcr_comparison </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 1 </td>
<td style="text-align:left;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> NPCR at completion is not greater than npcr at baseline </td>
<td style="text-align:right;color: #555 !important;font-weight: bold;background-color: #f1b6da !important;"> 2 </td>
</tr>
</tbody>
</table>

Rule Detail
-----------------------------

```{=html}
<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 id="htmlwidget-cffa4ac79791596b302f" style="width:100%;height:auto;" class="datatables html-widget"></div>
<script type="application/json" data-for="htmlwidget-cffa4ac79791596b302f">{"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:30:12<\/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>
```

Smells {.tabset .tabset-fade}
Expand Down

0 comments on commit 82c55a6

Please sign in to comment.