Load and parse checks in a yaml file, and return a list of useful objects.

load_checks(path_checks, origin)

Arguments

path_checks

The file path to the yaml file specifying the smells and rules. Required.

origin

The origin of the dataset. Currently supports "csv" and "REDCap". Required.

Examples

# Step 0: define paths.
#   So this package example executes on every machine, temp files are used.

# Replace the two paths for your specific project
path_checks  <- system.file("checks/checks-biochemical.yml", package = "trawler")

# Step 1: load the check definitions and the dataset to test
load_checks(path_checks, origin = "REDCap")
#> $github_file_prefix
#> [1] "https://github.com/OuhscBbmc/validator-1/tree/main"
#> 
#> $record_id_name
#> [1] "record_id"
#> 
#> $record_id_link
#> [1] "<a href=\"https://bbmc.ouhsc.edu/redcap/redcap_v%s/DataEntry/index.php?pid=%s&arm=%s&id=%s&page=%s\" target=\"_blank\">%s</a>"
#> 
#> $baseline_date_name
#> [1] "date_enrolled"
#> 
#> $redcap_project_id
#> [1] 1612
#> 
#> $redcap_version
#> [1] "10.5.1"
#> 
#> $redcap_default_arm
#> [1] 1
#> 
#> $redcap_codebook
#> [1] "https://bbmc.ouhsc.edu/redcap/redcap_v10.5.1/Design/data_dictionary_codebook.php?pid=1612"
#> 
#> $redcap_record_link
#> [1] "<a href=\"https://bbmc.ouhsc.edu/redcap/redcap_v%s/DataEntry/index.php?pid=%s&arm=%s&id=%s&page=%s\" target=\"_blank\">%s</a>"
#> 
#> $smells
#> # A tibble: 11 × 10
#>    check_name description priority debug bound_lower bound_upper bounds_template
#>    <chr>      <chr>          <int> <lgl>       <dbl>       <dbl> <chr>          
#>  1 females    Proportion…        2 FALSE        0.4         0.6  [%.2f, %.2f]   
#>  2 males      Proportion…        2 FALSE        0.4         0.6  [%.2f, %.2f]   
#>  3 age        Mean parti…        2 FALSE       20          60    [%.0f, %.0f]   
#>  4 serum_pre… Mean serum…        2 FALSE       32          39    [%.0f, %.0f]   
#>  5 serum_cre… Mean serum…        2 FALSE        3          15    [%.0f, %.0f]   
#>  6 bmi_at_ba… Mean BMI i…        2 FALSE       18          24    [%.0f, %.0f]   
#>  7 serum_cho… Mean chole…        1 FALSE      100         140    [%.0f, %.0f]   
#>  8 dialysis_… Mean Kt/V …        1 FALSE        1.2         5    [%.1f, %.1f]   
#>  9 nutrition… Most patie…        2 FALSE        0.85        0.99 [%.2f, %.2f]   
#> 10 definitiv… The propor…        1 FALSE        1           1    [%.1f, %.1f]   
#> 11 normalize… Mean Norma…        1 FALSE        0           1.2  [%.1f, %.1f]   
#> # ℹ 3 more variables: value_template <chr>, equation <chr>, boundaries <chr>
#> 
#> $smells_inactive
#> # A tibble: 1 × 9
#>   check_name  description priority debug bound_lower bound_upper bounds_template
#>   <chr>       <chr>          <int> <lgl>       <dbl>       <dbl> <chr>          
#> 1 average_se… ??Units co…        1 FALSE         501        1200 [%.0f, %.0f]   
#> # ℹ 2 more variables: value_template <chr>, equation <chr>
#> 
#> $smell_names_md
#> [1] "11 smells have been defined:\n\n1. females;\n2. males;\n3. age;\n4. serum_prealbumin_level_at_baseline;\n5. serum_creatinine_level_at_baseline;\n6. bmi_at_baseline;\n7. serum_cholesterol_levels_at_baseline;\n8. dialysis_adequacy;\n9. nutritional_counseling;\n10. definitive_diagnosis;\n11. normalized_protein_catabolic_rate;\n"
#> 
#> $rules
#> # A tibble: 14 × 6
#>    check_name        error_message priority debug redcap_instrument passing_test
#>    <chr>             <chr>            <int> <lgl> <chr>             <chr>       
#>  1 baseline_prealbu… Serum pre-al…        1 FALSE baseline_data     "function (…
#>  2 missing_serum_ma… Relevant nut…        1 FALSE baseline_data     "function (…
#>  3 serum_prealbumin… Baseline pre…        2 FALSE baseline_data, v… "function (…
#>  4 serum_prealbumin… Baseline pre…        2 FALSE baseline_data, v… "function (…
#>  5 serum_prealbumin… Baseline pre…        2 FALSE baseline_data, v… "function (…
#>  6 serum_prealbumin… serum prealb…        3 FALSE baseline_data, v… "function (…
#>  7 baseline_first_v… Serum prealb…        3 FALSE baseline_data, v… "function (…
#>  8 daily_first_visi… In-addition …        3 FALSE baseline_data, p… "function (…
#>  9 daily_protein_in… npcr levels …        3 FALSE baseline_data, p… "function (…
#> 10 hospitalization_… Patient was …        1 FALSE completion_proje… "function (…
#> 11 optimal_daily_pr… Daily protei…        2 FALSE completion_proje… "function (…
#> 12 recommended_npcr… NPCR values …        2 FALSE completion_data   "function (…
#> 13 npcr              NPCR at comp…        2 FALSE completion_data   "function (…
#> 14 npcr_comparison   NPCR at comp…        3 FALSE completion_data   "function (…
#> 
#> $rules_inactive
#> # A tibble: 1 × 6
#>   check_name         error_message priority debug redcap_instrument passing_test
#>   <chr>              <chr>            <int> <lgl> <chr>             <chr>       
#> 1 pre_albumin_levels pre_albumin …        3 FALSE visit_lab_date    "function (…
#> 
#> attr(,"class")
#> [1] "trawler_checks_definition"