OHDSI / CohortDiagnostics

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

Shiny App wont start if runTemporalCharacterization set to FALSE #1090

Open gowthamrao opened 8 months ago

gowthamrao commented 8 months ago

Cannot start shiny app if runTemporalCharacterization is set to FALSE

because of code here

dataSource$temporalAnalysisRef <- loadResultsTable(dataSource, 
    "temporal_analysis_ref", cdTablePrefix = dataSource$cdTablePrefix)
  dataSource$temporalChoices <- getResultsTemporalTimeRef(dataSource = dataSource)

  dataSource$temporalCharacterizationTimeIdChoices <- dataSource$temporalChoices %>% 
    dplyr::arrange(sequence)

I tried to run CohortDiagnostics with runTemporalCharacterization set to FALSE https://github.com/OHDSI/CohortDiagnostics/issues/1088

But got this error. This make it not possible for me get a shiny to view results. When runTemporalCharacterization is set to FALSE, then dataSource$temporalChoices is NULL.

So this will give an error message

dataSource$temporalCharacterizationTimeIdChoices <- dataSource$temporalChoices %>% dplyr::arrange(sequence)

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

gowthamrao commented 8 months ago

I had a clunky way to handle it here (prior to OHDSI Shiny modules) https://github.com/OHDSI/CohortDiagnostics/blob/43a090fe67461b0718eaefd901f64c6aaa9bcd7c/inst/shiny/DiagnosticsExplorer/global.R#L194-L253