Skip to content

Commit

Permalink
expand and correct testing of ctis fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf Herold committed Jun 27, 2024
1 parent f19816f commit 291fa59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions R/util_fields.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ typeVars <- list(
"correctiveMeasures.revertedDate" = "ctrDate",
"correctiveMeasures.sponsorActionRequiredByDate" = "ctrDate",
"correctiveMeasures.sponsorSubmitDate" = "ctrDate",
"decisionDate" = "ctrDate",
"events.seriousBreaches.awareDate" = "ctrDate",
"events.seriousBreaches.breachDate" = "ctrDate",
"events.seriousBreaches.submissionDate" = "ctrDate",
Expand Down
14 changes: 10 additions & 4 deletions inst/tinytest/ctrdata_ctis.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ expect_equal(
con = dbc))),
"")

# get all trials
ctrLoadQueryIntoDb(
queryterm = "",
register = "CTIS",
con = dbc
)

# get all field names
tmpFields <- suppressMessages(
suppressWarnings(
Expand Down Expand Up @@ -182,9 +189,8 @@ for (i in unique(groupsNo)) {
}

tmpFields <- tmpFields[
grepl("date$", tmpFields, ignore.case = TRUE) &
!grepl("update$", tmpFields, ignore.case = TRUE) &
!grepl("^decisionDate$", tmpFields, ignore.case = TRUE)
grepl("[.]date$", tmpFields, ignore.case = TRUE) |
grepl("Date$", tmpFields, ignore.case = FALSE)
]

if (FALSE) {
Expand Down Expand Up @@ -219,7 +225,7 @@ for (i in unique(groupsNo)) {
unique(unlist(
lapply(
tmpData[ , -1, drop = FALSE],
function(i) sapply(i, function(ii) class(ii)))
function(i) sapply(i, function(ii) class(ii))[1])
)) %in% c("Date", "POSIXct", "POSIXt")
))
}
Expand Down

0 comments on commit 291fa59

Please sign in to comment.