EHDEN / CdmInspection

R Package to support quality control inspection of an OMOP-CDM instance
Apache License 2.0
11 stars 16 forks source link

Column `X_CALENDAR_MONTH` doesn't exist #57

Closed keesvanbochove closed 2 years ago

keesvanbochove commented 3 years ago

When running the package on Truven claims dataset, results generation works fine but then when creating the Word document the script breaks on a column which it expects but isn't there (see https://github.com/EHDEN/CdmInspection/blob/712bc3fa97d36c66121a8ae8776c594be4100043/R/Helper.R#L128). What could cause this? Can we skip generation of these plots?

Error: Can't rename columns that don't exist. x Column X_CALENDAR_MONTH doesn't exist. Traceback:

  1. generateResultsDocument(obj, outputFolder, authors = authors, . databaseDescription = databaseDescription, databaseName = databaseName, . databaseId = databaseId, smallCellCount = smallCellCount)
  2. recordsCountPlot(as.data.frame(results$dataTablesResults$totalRecords$result))
  3. results %>% dplyr::rename(Date = X_CALENDAR_MONTH, Domain = SERIES_NAME, . Count = Y_RECORD_COUNT) %>% dplyr::mutate(Date = lubridate::parse_date_time(Date, . "ym"))
  4. dplyr::mutate(., Date = lubridate::parse_date_time(Date, "ym"))
  5. dplyr::rename(., Date = X_CALENDAR_MONTH, Domain = SERIES_NAME, . Count = Y_RECORD_COUNT)
  6. rename.data.frame(., Date = X_CALENDAR_MONTH, Domain = SERIES_NAME, . Count = Y_RECORD_COUNT)
  7. tidyselect::eval_rename(expr(c(...)), .data)
  8. rename_impl(data, names(data), as_quosure(expr, env), strict = strict, . name_spec = name_spec)
  9. eval_select_impl(x, names, { . { . sel . } . }, strict = strict, name_spec = name_spec, type = "rename")
  10. with_subscript_errors(vars_select_eval(vars, expr, strict, data = x, . name_spec = name_spec, uniquely_named = uniquely_named, allow_rename = allow_rename, . type = type), type = type)
  11. tryCatch(instrument_base_errors(expr), vctrs_error_subscript = function(cnd) { . cnd$subscript_action <- subscript_action(type) . cnd$subscript_elt <- "column" . cnd_signal(cnd) . })
  12. tryCatchList(expr, classes, parentenv, handlers)
  13. tryCatchOne(expr, names, parentenv, handlers[[1L]])
  14. value[3L]
  15. cnd_signal(cnd)
  16. rlang:::signal_abort(x)
keesvanbochove commented 3 years ago

Workaround is to disable the plots: in between calling cdmInspection and generateResultsDocument, run: results$dataTablesResults <- NULL With thanks to @MaximMoinat.

PRijnbeek commented 3 years ago

Do not really understand what the problem is, have not seen it before on the databases. Was Achilles run on the database prior to running cdmInspection and are the results in the schema you defined?

MaximMoinat commented 3 years ago

That is very likely the issue. We might want to detect this and give a warning that Achilles has not been run yet (or make this in another way very explicit).

On Thu, 4 Mar 2021, 15:09 Peter Rijnbeek, notifications@github.com wrote:

Do not really understand what the problem is, have not seen it before on the databases. Was Achilles run on the database prior to running cdmInspection and are the results in the schema you defined?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EHDEN/CdmInspection/issues/57#issuecomment-790644123, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEH767C2ZQIPYBZ6O5LXBLLTB6IB7ANCNFSM4YQ2NHTQ .

PRijnbeek commented 3 years ago

Yes agreed, it is in the Readme but we can add a message in the package