EHDEN / CdmInspection

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

generateResultsDocument Error in UseMethod("arrange") : no applicable method for 'arrange' applied to an object of class "NULL" #105

Open joaofonsecapromptly opened 5 months ago

joaofonsecapromptly commented 5 months ago

When running function generateResultsDocument, an error is reported stating

Error in UseMethod("arrange") : 
  no applicable method for 'arrange' applied to an object of class "NULL"

Using CDM Inspection version 1.2.3

This is the source code

CdmInspection::generateResultsDocument(
  results=results,
  outputFolder=file.path(getwd(), outputFolder,"catalogueExport"),
  authors = databaseName,
  databaseDescription="databaseDescription",
  databaseName = "databaseName",
  databaseId = "databaseId",
  docTemplate = "EHDEN",
  smallCellCount = NULL,
  silent = TRUE
)

I have tried changing every argumentm but the bug still stands. Also checked results file and seems normal and when generating, no error was reported

MaximMoinat commented 4 months ago

Could you check if one of the following result objects are empty?

A quick fix when one is empty, is to replace these by (empty) dataframes:

But those should not be empty to begin with. Please also check the logs of cdmInspection for any errors.

joaofonsecapromptly commented 4 months ago

Could you check if one of the following result objects are empty?

  • results$vocabularyResults$mappingCompleteness$result
  • results$vocabularyResults$drugMapping$result

A quick fix when one is empty, is to replace these by (empty) dataframes:

  • results$vocabularyResults$mappingCompleteness$result <- data.frame(DOMAIN=NA, P_RECORDS_MAPPED=NA, N_CODES_SOURCE=NA, N_CODES_MAPPED=NA, P_CODES_MAPPED=NA, P_RECORDS_MAPPED=NA, N_RECORDS_SOURCE = NA, N_RECORDS_MAPPED =NA)
  • results$vocabularyResults$drugMapping$result <- data.frame(N_RECORDS=NA, CLASS=NA, N_PATIENTS = NA, N_SOURCE_CODES =NA)

But those should not be empty to begin with. Please also check the logs of cdmInspection for any errors.

Yes, that was the case. This solution works.

I also tried updating to new version 1.2.4 and it also fixes this, not quite sure why as I did not dive into the source code. Was one these fixes implemented in 1.2.4?