This check looks for missing MedDRA version; if it's present, also checking it's the current version
check_ts_aedict(TS)
boolean value if check failed or passed with 'msg' attribute if the test failed
TS1 <- data.frame(
STUDYID = 1,
TSPARMCD = "AEDICT",
TSVAL = "MedDRA 22.0",
TSVAL2 = ""
)
TS2 <- data.frame(
STUDYID = 2,
TSPARMCD = "AEDICT",
TSVAL = "",
TSVAL1 = "meddra v22.0"
)
TS3 <- data.frame(
STUDYID = 3,
TSPARMCD = "AEDICT",
TSVAL = ""
)
TS4 <-data.frame(
STUDYID = 4,
TSPARMCD = "CMDICT",
TSVAL = ""
)
TS5 <- data.frame(
STUDYID = 1,
TSPARMCD = "AEDICT",
TSVAL = "meddra 24.0",
TSVAL2 = ""
)
TS6 <- data.frame(
STUDYID = 1,
TSPARMCD = "AEDICT",
TSVAL = " meddra 23.0 ",
TSVAL2 = ""
)
check_ts_aedict(TS1)
#> [1] FALSE
#> attr(,"msg")
#> [1] "MedDRA version in TS.TSVAL where TS.TSPARMCD=AEDICT is not the latest version as of 2024-09-05"
#> attr(,"data")
#> TSPARMCD TSVAL Current_MedDRA_version
#> 1 AEDICT MedDRA 22.0 27.0
check_ts_aedict(TS2)
#> [1] FALSE
#> attr(,"msg")
#> [1] "No value in TS.TSVAL where TS.TSPARMCD=AEDICT."
#> attr(,"data")
#> TSPARMCD TSVAL Current_MedDRA_version
#> 1 AEDICT 27.0
check_ts_aedict(TS3)
#> [1] FALSE
#> attr(,"msg")
#> [1] "No value in TS.TSVAL where TS.TSPARMCD=AEDICT."
#> attr(,"data")
#> TSPARMCD TSVAL Current_MedDRA_version
#> 1 AEDICT 27.0
check_ts_aedict(TS4)
#> [1] FALSE
#> attr(,"msg")
#> [1] "No record where TS.TSPARMCD=AEDICT."
check_ts_aedict(TS5)
#> [1] FALSE
#> attr(,"msg")
#> [1] "MedDRA version in TS.TSVAL where TS.TSPARMCD=AEDICT is not the latest version as of 2024-09-05"
#> attr(,"data")
#> TSPARMCD TSVAL Current_MedDRA_version
#> 1 AEDICT meddra 24.0 27.0
check_ts_aedict(TS6)
#> [1] FALSE
#> attr(,"msg")
#> [1] "MedDRA version in TS.TSVAL where TS.TSPARMCD=AEDICT is not the latest version as of 2024-09-05"
#> attr(,"data")
#> TSPARMCD TSVAL Current_MedDRA_version
#> 1 AEDICT meddra 23.0 27.0
check_ts_aedict(rbind(TS1,TS1))
#> [1] FALSE
#> attr(,"msg")
#> [1] "Multiple records where TS.TSPARMCD=AEDICT."
#> attr(,"data")
#> TSPARMCD TSVAL
#> 1 AEDICT MedDRA 22.0
#> 2 AEDICT MedDRA 22.0