OHDSI / CohortDiagnostics

An R package for performing various cohort diagnostics.
https://ohdsi.github.io/CohortDiagnostics
40 stars 45 forks source link

Diagnostics explorer shiny app crashes seemingly at random #1033

Closed DrTTrousers closed 1 year ago

DrTTrousers commented 1 year ago
Warning: Error in ._jobjRef_dollar: no field, method or inner class called 'parent' 
  100: stop
   99: ._jobjRef_dollar
   98: $.Throwable
   96: cnd_some
   95: cnd_inherits
   94: <Anonymous>
   93: stop
   92: <Anonymous>
   91: stop
   90: value[[3L]]
   89: tryCatchOne
   88: tryCatchList
   87: tryCatch
   86: do
   85: hybrid_chain
   84: renderFunc
   83: output$DiagnosticsExplorer-orphanConcepts-orphanConceptsTable
    2: shiny::runApp
    1: CohortDiagnostics::launchDiagnosticsExplorer

The app will launch fine, and display, however when clicking between tabs, eventually an error replaces the table views

image

This renders the app useless. This is using CohortDiagnostics 3.1.2 and Shiny 1.7.4.

azimov commented 1 year ago

This is likely an error with the sql query but I can't tell what the cause would be. How is the application being used - is it with an sqlite or postgres database? If its postgres there could be any number of database backend issues that may cause this (e.g. user permissions on tables)

DrTTrousers commented 1 year ago

@azimov I've actually been bashing at this a little further since my original post - and something I experienced with strategus has shown up again.

The same script / Shiny app runs fine in Windows. The above error is collected from an Enterprise RWorkbench instance running linux.

Both cases are calling a .sqlite file created by createMergedResultsFile()

I've got a load of these error messages, so will append one below. To clarify, the shiny kind of runs, but after a few clicks the error shows up.

his warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
Error in .jcall("java/lang/Class", "Ljava/lang/Class;", "forName", cl,  : 
  RcallMethod: cannot determine object class
SELECT oc.*,
              cs.concept_set_name,
              c.concept_name,
              c.vocabulary_id,
              c.concept_code,
              c.standard_concept
            FROM  main.demo_orphan_concept oc
            INNER JOIN  main.demo_concept_sets cs
              ON oc.cohort_id = cs.cohort_id
                AND oc.concept_set_id = cs.concept_set_id
            INNER JOIN  main.demo_concept c
              ON oc.concept_id = c.concept_id
            WHERE oc.cohort_id = 10365
              AND database_id in ('DAGERMANY')
              ;
Warning: Error in ._jobjRef_dollar: no field, method or inner class called 'parent' 
  100: stop
   99: ._jobjRef_dollar
   98: $.Throwable
   96: cnd_some
   95: cnd_inherits
   94: <Anonymous>
   93: stop
   92: <Anonymous>
   91: stop
   90: value[[3L]]
   89: tryCatchOne
   88: tryCatchList
   87: tryCatch
   86: do
   85: hybrid_chain
   84: renderFunc
   83: output$DiagnosticsExplorer-orphanConcepts-orphanConceptsTable
    2: shiny::runApp
    1: CohortDiagnostics::launchDiagnosticsExplorer
azimov commented 1 year ago

@DrTTrousers Looks like something in the sql is causing a problem, the sql itself appears valid so I'm wondering if the schema is malformed somehow.

Can you try running the following snipped and seeing what the returned error is?


connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "sqlite", server = "<INSERT PATH TO SQLITE DB>")
tconnection <- DatabaseConnector::connect(connectionDetails)

sql <- "SELECT oc.*,
              cs.concept_set_name,
              c.concept_name,
              c.vocabulary_id,
              c.concept_code,
              c.standard_concept
            FROM  main.demo_orphan_concept oc
            INNER JOIN  main.demo_concept_sets cs
              ON oc.cohort_id = cs.cohort_id
                AND oc.concept_set_id = cs.concept_set_id
            INNER JOIN  main.demo_concept c
              ON oc.concept_id = c.concept_id
            WHERE oc.cohort_id = 10365
              AND database_id in ('DAGERMANY')"

DatabaseConnector::querySql(tconnection, sql)

(naturally replacing the path to your sqlite file)

If this returns a data frame then the sql/schema is fine and it must be something else but I suspect there is a problem here that the shiny app is encountering.

Alternatively, the error indicates it may be a java install issue on linux. Do you know which JRE you are running and how was rJava installed?

DrTTrousers commented 1 year ago

I'm going to close this issue, I think it is specific to running the app from inside a linux R Workbench environment, as I've been able to get the same apps running fine on Windows and in an RSConnect server.