-
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.
ref #5
- Loading branch information
Showing
1 changed file
with
166 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
--- | ||
title: REDCapR Validator Example 1 # Change this value for new validators. | ||
date: "Date: `r Sys.time()`" | ||
output: | ||
html_document: | ||
keep_md: yes | ||
toc: yes | ||
toc_float: true | ||
number_sections: true | ||
# css: ../analysis/common/styles-1.css | ||
--- | ||
|
||
|
||
<!-- Set the working directory to the repository's base directory; this assumes the report is nested inside of three directories.--> | ||
```{r, echo=F, message=F} | ||
# cat("Working directory: ", getwd()) | ||
library(knitr) | ||
# Change this value for new validators. | ||
# opts_knit$set(root.dir='../') #Don't combine this call with any other chunk -especially one that uses file paths. | ||
``` | ||
|
||
<!-- Set the report-wide options, and point to the external code file. --> | ||
```{r set-options, echo=F} | ||
# cat("Working directory: ", getwd()) | ||
report_render_start_time <- Sys.time() | ||
opts_chunk$set( | ||
results = 'show', | ||
warning = FALSE, | ||
comment = NA, | ||
tidy = FALSE, | ||
fig.width = 6.5, | ||
fig.height = 4, | ||
fig.path = 'figure-png/' | ||
) | ||
# dpi = 400, | ||
# out.width = "650px", #This affects only the markdown, not the underlying png file. The height will be scaled appropriately. | ||
echo_chunks <- FALSE | ||
options(width=100) #So the output is 25% wider than the default. | ||
# Change this value for new validators. | ||
# read_chunk("./analysis/validator-1.R") #This allows knitr to call chunks tagged in the underlying *.R file. | ||
``` | ||
|
||
<!-- Load 'sourced' R files. Suppress the output when loading packages. --> | ||
```{r load-packages, echo=echo_chunks, message=FALSE, warning=FALSE} | ||
requireNamespace("dplyr") | ||
requireNamespace("DT") | ||
``` | ||
|
||
<!-- Load any global functions and variables declared in the R file. Suppress the output. --> | ||
```{r declare-globals, echo=echo_chunks, results='show', message=FALSE} | ||
``` | ||
|
||
<!-- Declare any global functions specific to a Rmd output. Suppress the output. --> | ||
```{r, echo=echo_chunks, message=FALSE} | ||
#Put presentation-specific code in here. It doesn't call a chunk in the codebehind file. | ||
``` | ||
|
||
<!-- Load the datasets. --> | ||
```{r load-data, echo=echo_chunks, results='show', message=FALSE} | ||
``` | ||
|
||
<!-- Tweak the datasets. --> | ||
```{r tweak-data, echo=echo_chunks, results='show', message=TRUE} | ||
``` | ||
|
||
```{r groom-rules, echo=echo_chunks, results='show', message=TRUE} | ||
``` | ||
|
||
```{r groom-smells, echo=echo_chunks, results='show', message=TRUE} | ||
``` | ||
|
||
Set Up {.tabset .tabset-fade} | ||
============================= | ||
|
||
Instructions | ||
----------------------------- | ||
|
||
1. Work through each line in the table to discover & correct entry mistakes in the database. Be aware that a single mistake may manifest in multiple rows; fixing one value may clear several rows. | ||
1. Click the `record id` value in a row to be taken to the participant's Event Grid in REDCap (*i.e.*, the 'stop light page'). | ||
1. Double-check that your manual corrections in REDCap are reflected in `r checks$path_output_rule`. Be careful not to move this file to somewhere unsafe. | ||
1. To help discover the dataflow and problematic location, use the | ||
* project's [codebook](`r checks$redcap_codebook`) in REDCap, | ||
* [validator-1-arch](`r checks$github_link_arch`) file, and | ||
* [validator-1](`r checks$github_link_report`) report. | ||
1. If you create a new rule or smell check, make sure the error message won't reveal any PHI. | ||
|
||
Execute Rules | ||
----------------------------- | ||
```{r execute-rules, echo=echo_chunks, message=TRUE, results='asis'} | ||
``` | ||
|
||
Execute Smells | ||
----------------------------- | ||
```{r execute-smells, echo=echo_chunks, message=TRUE, results='asis'} | ||
``` | ||
|
||
Inactive Rules | ||
----------------------------- | ||
|
||
`r nrow(ds_rule_inactive)` rules are defined, but disabled for this report: | ||
|
||
```{r echo=echo_chunks, results='asis'} | ||
# glue::collapse(paste0("1. ", ds_rule_inactive$check_name), sep="; \n", last=", and \n") | ||
ds_rule_inactive |> | ||
glue::glue_data("1. {check_name};") | ||
``` | ||
|
||
Inactive Smells | ||
----------------------------- | ||
|
||
`r nrow(ds_smell_inactive)` smells are defined, but disabled for this report: | ||
|
||
```{r echo=echo_chunks, results='asis'} | ||
ds_smell_inactive |> | ||
glue::glue_data("1. {check_name};") | ||
# if( nrow(ds_smell_inactive) == 0L ) { | ||
# cat("* *no smells are disabled*.") | ||
# } else { | ||
# glue::collapse(paste0("1. ", ds_smell_inactive$smell_name), sep="; \n", last=", and \n") | ||
# } | ||
``` | ||
|
||
Rules {.tabset .tabset-fade} | ||
============================= | ||
|
||
A *rule* is very exact. Each record is examined, and determined if it passes each specific rule. | ||
|
||
Rule Detail | ||
----------------------------- | ||
```{r table-rule-detail, echo=echo_chunks, message=TRUE} | ||
``` | ||
|
||
Rule Summary | ||
----------------------------- | ||
```{r table-rule-summary, echo=echo_chunks, message=TRUE} | ||
``` | ||
|
||
Smells {.tabset .tabset-fade} | ||
============================= | ||
|
||
A *smell* test won't validate a given record (like the rules above), but it will make sure the dataset overall smells correct. | ||
|
||
Smell Summary | ||
----------------------------- | ||
```{r table-smell-summary, echo=echo_chunks, message=TRUE} | ||
``` | ||
|
||
Termination {.tabset .tabset-fade} | ||
============================= | ||
|
||
### Save To Disk | ||
|
||
```{r verify-values, echo=echo_chunks, message=TRUE} | ||
``` | ||
|
||
```{r specify-columns-to-upload, echo=echo_chunks, message=TRUE} | ||
``` | ||
|
||
```{r save-to-disk, echo=echo_chunks, message=TRUE} | ||
``` | ||
|
||
|
||
<!-- The footer that's common to all reports. --> | ||
<!-- ```{r, child = "analysis/common/footer-1.Rmd"}``` --> |