This check looks for missing WHODrug version; if it's present, also checking it's the current version
check_ts_cmdict(TS)
boolean value if check failed or passed with 'msg' attribute if the test failed
TS1 <- data.frame(
STUDYID = 1,
TSPARMCD = "CMDICT",
TSVAL = "WHODRUG GLOBAL B3 MARCH 1, 2021",
TSVAL2 = ""
)
TS2 <- data.frame(
STUDYID = 2,
TSPARMCD = "CMDICT",
TSVAL = "",
TSVAL1 = "WHODRUG GLOBAL B3 MARCH 1, 2021"
)
TS3 <- data.frame(
STUDYID = 3,
TSPARMCD = "CMDICT",
TSVAL = ""
)
TS4 <-data.frame(
STUDYID = 4,
TSPARMCD = "AEDICT",
TSVAL = ""
)
TS5 <- data.frame(
STUDYID = 5,
TSPARMCD = "CMDICT",
TSVAL = "meddra 24.0",
TSVAL2 = ""
)
TS6 <- data.frame(
STUDYID = 6,
TSPARMCD = "CMDICT",
TSVAL = "WHODRUG vGLOBAL B3 MARCH 1, 2021",
TSVAL2 = ""
)
check_ts_cmdict(TS1)
#> [1] FALSE
#> attr(,"msg")
#> [1] "WHODrug version in TS.TSVAL where TS.TSPARMCD=CMDICT is not latest version as of 2024-09-05 or not an exact string match."
#> attr(,"data")
#> TSPARMCD TSVAL Current_WHODRUG_ver
#> 1 CMDICT WHODRUG GLOBAL B3 MARCH 1, 2021 WHODRUG GLOBAL B3 MARCH 1, 2024
check_ts_cmdict(TS2)
#> [1] FALSE
#> attr(,"msg")
#> [1] "No value in TS.TSVAL where TS.TSPARMCD=CMDICT. "
#> attr(,"data")
#> TSPARMCD TSVAL Current_WHODRUG_ver
#> 1 CMDICT WHODRUG GLOBAL B3 MARCH 1, 2024
check_ts_cmdict(TS3)
#> [1] FALSE
#> attr(,"msg")
#> [1] "No value in TS.TSVAL where TS.TSPARMCD=CMDICT. "
#> attr(,"data")
#> TSPARMCD TSVAL Current_WHODRUG_ver
#> 1 CMDICT WHODRUG GLOBAL B3 MARCH 1, 2024
check_ts_cmdict(TS4)
#> [1] FALSE
#> attr(,"msg")
#> [1] "No record where TS.TSPARMCD=CMDICT. "
check_ts_cmdict(TS5)
#> [1] FALSE
#> attr(,"msg")
#> [1] "WHODrug version in TS.TSVAL where TS.TSPARMCD=CMDICT is not latest version as of 2024-09-05 or not an exact string match."
#> attr(,"data")
#> TSPARMCD TSVAL Current_WHODRUG_ver
#> 1 CMDICT meddra 24.0 WHODRUG GLOBAL B3 MARCH 1, 2024
check_ts_cmdict(TS6)
#> [1] FALSE
#> attr(,"msg")
#> [1] "WHODrug version in TS.TSVAL where TS.TSPARMCD=CMDICT is not latest version as of 2024-09-05 or not an exact string match."
#> attr(,"data")
#> TSPARMCD TSVAL Current_WHODRUG_ver
#> 1 CMDICT WHODRUG vGLOBAL B3 MARCH 1, 2021 WHODRUG GLOBAL B3 MARCH 1, 2024
check_ts_cmdict(rbind(TS1,TS1))
#> [1] FALSE
#> attr(,"msg")
#> [1] "Multiple records where TS.TSPARMCD=CMDICT. "
#> attr(,"data")
#> TSPARMCD TSVAL
#> 1 CMDICT WHODRUG GLOBAL B3 MARCH 1, 2021
#> 2 CMDICT WHODRUG GLOBAL B3 MARCH 1, 2021