Answers "what is SD0002, how bad is it, and does p21bridge know how to fix it?" from the shipped rule catalogue p21_rules, without a network call or a trip to the Pinnacle 21 documentation. Replaces the SAS-side habit of pasting rule text into a FORMAT or a hand-maintained lookup dataset per study.

rule_info(rule_id)

Arguments

rule_id

Character vector of Pinnacle 21 rule identifiers. Case and surrounding whitespace are ignored.

Value

A tibble with one row per element of rule_id, in the order given: rule_id, in_catalogue (logical), then publisher_id, message, description, category, severity, sources, fix_class and rule_class. Rows for identifiers that are not in the catalogue carry in_catalogue = FALSE and NA for the catalogue columns, except rule_class, which is derived from the identifier itself.

Examples

rule_info(c("SD0064", "CT2001", "XX9999"))
#> # A tibble: 3 × 10
#>   rule_id in_catalogue publisher_id message        description category severity
#>   <chr>   <lgl>        <chr>        <chr>          <chr>       <chr>    <chr>   
#> 1 SD0064  TRUE         FDAC040      Subject is no… All Subjec… Cross-r… Error   
#> 2 CT2001  TRUE         FDAC340      Variable valu… Variable m… Termino… Error   
#> 3 XX9999  FALSE        NA           NA             NA          NA       NA      
#> # ℹ 3 more variables: sources <chr>, fix_class <chr>, rule_class <chr>

# severity straight from the catalogue, not from the report's own column
rule_info("SD0002")$severity
#> [1] "Error"