wincowgerDEV / OpenSpecy-shiny

This is a companion repo that holds the code for www.openspecy.org website and shiny application. The Open Specy package repo https://github.com/wincowgerDEV/OpenSpecy-package
Creative Commons Attribution 4.0 International
3 stars 3 forks source link

[Bug]: Disconnected from the server after I upload spectrum #30

Closed magagranados closed 1 year ago

magagranados commented 1 year ago

Guidelines

Project Version

No response

Platform and OS Version

No response

Existing Issues

No response

What happened?

After I upload a spectrum, I am disconnected from the server and the page requests me to reload. I cannot compare or analyze any spectrum in SPC format.

image

Steps to reproduce

  1. Click "browse"
  2. Upload my file in SPC format
  3. Choose the preprocessing and identification options. ...

Expected behavior

It is expected that after I upload the spectrum, I can preprocess and identify the particle spectrum

Attachments

No response

Screenshots or Videos

image

Additional Information

No response

zsteinmetz commented 1 year ago

This sounds like Shiny app problem. I transfer the issue there.

wincowgerDEV commented 1 year ago

Hey @magagranados, thanks for letting us know about this. Can you share the spc file that is causing the issue? It is challenging for us to debug without the file that crashes the server.

magagranados commented 1 year ago

Hi, here is an example SPC-2.zip

wincowgerDEV commented 1 year ago

Thank you @magagranados. @zsteinmetz, this actually seems like a problem with the package read_any function, getting this error from the function:

Error in gsub(rawToChar(replace.nul), "\r\n", log.txt) : 
  'pattern' is invalid
In addition: Warning message:
In gsub(rawToChar(replace.nul), "\r\n", log.txt) :
  unable to translate '<ff>' to a wide string

Unfortunately the issue is coming from the read.spc() from hyperSpec. We will need to rewrite their source code to fix it which will likely take us some time because a lot of these unique file formats are tricky to convert. We should be handling the errors better though instead of letting the app crash and I can work on that for the shiny app sooner rather than later. @magagranados, for now I recommend converting your file into a different format using another software. We have some instructions about how you can use spectragryph to transform your files in our vignette towards the end: https://cran.r-project.org/web/packages/OpenSpecy/vignettes/sop.html

zsteinmetz commented 1 year ago

We should be handling the errors better though instead of letting the app crash and I can work on that for the shiny app sooner rather than later.

Agree, @wincowgerDEV. Should we keep the issue here until then?

Instead of trying to completely rewrite their code, I suggest to first approach the hyperSpec maintainers. They have discussed similar issues already; see for instance https://github.com/r-hyperspec/hyperSpec/issues/80 which might soon be fixed with this PR: https://github.com/r-hyperspec/hySpc.read.spc/pull/22

@magagranados would you mind open another issue at https://github.com/r-hyperspec/hySpc.read.spc/issues. If they can fix it, we can benefit from it downstream.

wincowgerDEV commented 1 year ago

Agree, @wincowgerDEV. Should we keep the issue here until then?

Instead of trying to completely rewrite their code, I suggest to first approach the hyperSpec maintainers. They have discussed similar issues already; see for instance r-hyperspec/hyperSpec#80 which might soon be fixed with this PR: r-hyperspec/hySpc.read.spc#22

Yeah I think it is fine to keep the issue here and we will close it once we fix the bug in the app. Agreed, it seems like hyperSpec is putting in work right now, likely a ton of new features and bug fixes coming down the pipeline.

wincowgerDEV commented 1 year ago

Now catching the incompatible file types with an error message instead of a crash https://github.com/wincowgerDEV/OpenSpecy-shiny/commit/311a1c4216aa66b0a5ffc86366d3e4056595800c

image