SafetyGraphics / safetyGraphics

Clinical Trial Safety Graphics with R
https://safetygraphics.github.io/safetyGraphics/
Other
93 stars 24 forks source link

safetyGraphicsInit() does not initialize #712

Closed xni7 closed 1 year ago

xni7 commented 1 year ago

@jwildfire @samussiah reporting an issue observed with safetyGraphicsInit()

# steps to reprex

# HEAD of dev as of 15APR2023
remotes::install_github("SafetyGraphics/safetyCharts@9f99670")
# HEAD of dev as of 15APR2023
remotes::install_github("SafetyGraphics/safetyGraphics@b34bca0")

# use Lilly CDISC pilot ADLB example
adlb <- read.csv("https://raw.githubusercontent.com/RhoInc/data-library/master/data/clinical-trials/adam/adlb.csv")
write.csv(adlb, file = "./adlb_test.csv")

# init() workflow
# move lab distribution to left
# upload adlb_test.csv back

library(safetyGraphics)

charts <- makeChartConfig()
labdist_chart <- purrr::keep(charts, ~.x$name=="labdist")
safetyGraphics::safetyGraphicsInit(charts = labdist_chart)

App couldn't be initialized after loading adlb. Shiny UI shows Error: [object Object]

Error message in console

- Initializing app with 1 chart(s).
No data found for specified filter domain of 'dm', so filter functionality has been deactivated.
-Generating meta data for 1 charts.
-Meta object created using the following source(s): safetyCharts::meta_labs
Warning: Error in purrr::map: ℹ In index: 1.
ℹ With name: domain.
Caused by error in `chart$name`:
! $ operator is invalid for atomic vectors
  117: <Anonymous>
  116: signalCondition
  115: signal_abort
  114: rlang::abort
  113: cli::cli_abort
  112: h
  111: .handleSimpleError
  110: ns
  107: .f
  103: map_
  102: purrr::map
  101: unname
  100: %>%
   99: safetyGraphicsUI
   98: renderUI
   97: func
   84: renderFunc
   83: output$sg
    2: runApp
    1: safetyGraphics::safetyGraphicsInit
Input to asJSON(keep_vec_names=TRUE) is a named vector. In a future version of jsonlite, this option will not be supported, and named vectors will be translated into arrays instead of objects. If you want JSON object output, please use a named list instead. See ?toJSON.
Filters not available because the filter domain is not specified.

The chart renders okay with a historical version of {safetyGraphics}

# older working version
remotes::install_github("safetyGraphics/safetyGraphics@c2c78ed")
# Restart the R session
rstudioapi::restartSession()
rm(list=ls())

# init() workflow
# move lab distribution to left
# upload adlb_test.csv back

library(safetyGraphics)

charts <- makeChartConfig()
labdist_chart <- purrr::keep(charts, ~.x$name=="labdist")
safetyGraphics::safetyGraphicsInit(charts = labdist_chart)
samussiah commented 1 year ago

@xni7 - I attempted to run your reprex but our new VPN's currently blocking GitHub. The only thing that immediately stands out to me is the downloaded file is an ADSL dataset, not an ADLB one. If you download adlb.csv does the app run as expected?

xni7 commented 1 year ago

yeah, the adsl.csv link is a typo, I did mean the adlb.csv link. Updated the issue above.

samussiah commented 1 year ago

@xni7 - this issues seems to be resolved on my end in #717 - let me know if you still have issues on fix-716.

xni7 commented 1 year ago

@samussiah approved, thx!