The real conformance check Pinnacle 21 rules CT2001 and CT2002 perform: is each value a submission value of the named CDISC codelist, and is the codelist extensible? Replaces the PROC FREQ plus manual eyeball against a pasted codelist, and unlike a check against the study specification it uses the CDISC dictionary itself, so a codelist the specification got wrong or left empty is still checked.

ct_check(values, codelist)

Arguments

values

Character vector of observed values. NA and empty strings are not checked (conforms = NA), because CT says nothing about absence.

codelist

A single codelist submission value, name or NCI concept code, as accepted by ct_codelist().

Value

A tibble with one row per element of values, in the order given: value, conforms (logical, NA for missing values), codelist_name, codelist_value, codelist_code and extensible. Carries a ct_release attribute.

Details

A value outside a non-extensible codelist is a conformance error - the term cannot be added. A value outside an extensible codelist is a warning: a sponsor term is allowed as long as it is not a synonym or subset of an existing standard term, which is a decision no software can make for you.

Examples

ct_check(c("F", "M", "Female", NA), "SEX")
#> # A tibble: 4 × 6
#>   value  conforms codelist_name codelist_value codelist_code extensible
#>   <chr>  <lgl>    <chr>         <chr>          <chr>         <lgl>     
#> 1 F      TRUE     Sex           SEX            C66731        FALSE     
#> 2 M      TRUE     Sex           SEX            C66731        FALSE     
#> 3 Female FALSE    Sex           SEX            C66731        FALSE     
#> 4 NA     NA       Sex           SEX            C66731        FALSE     

# extensible codelists still report non-conforming values - they are a
# warning to be justified, not an error
ct_check("MY OWN LAB TEST", "LBTEST")[, c("conforms", "extensible")]
#> # A tibble: 1 × 2
#>   conforms extensible
#>   <lgl>    <lgl>     
#> 1 FALSE    TRUE