This check looks for missing values in the MISPEC variable, which is required. This will be flagged in P21. This may reflect a mapping issue.
check_mi_mispec(MI)boolean value if check failed or passed with 'msg' attribute if the test failed
MI <- data.frame(
  USUBJID = c("1","2", "3"),
  DOMAIN = "MI",
  MISEQ = c(1, 2, 1),
  MISPEC = c("","BLOCK SLIDE",NA),
  MITESTCD = "TESTCD1",
  MIDTC = "2020-01-01",
stringAsFactors = FALSE
)
 check_mi_mispec(MI)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with required variable MISPEC not populated. "
#> attr(,"data")
#>   USUBJID MITESTCD MISPEC      MIDTC
#> 1       1  TESTCD1        2020-01-01
#> 2       3  TESTCD1   <NA> 2020-01-01
## No errors, MISPEC values present
MI2 <- data.frame(
 USUBJID = c("1","2", "3"),
 DOMAIN = "MI",
 MISEQ = 1,
 MISPEC = c("SLIDE", "TUMOR TISSUE", "BLOCK SLIDE"),
 MITESTCD = "TESTCD1",
 MIDTC = "",
 stringsAsFactors = FALSE
)
 check_mi_mispec(MI2)
#> [1] TRUE