NFDI4Chem / nmrium-react-wrapper

A wrapper around NMRium react component to enable seamless integration into third-party applications built on any modern framework.
https://nmrium.nmrxiv.org
MIT License
10 stars 3 forks source link

Spectra files downloaded multiple times #126

Closed CS76 closed 1 year ago

CS76 commented 1 year ago

We should try to avoid multiple downloads of the same spectra files

Screenshot 2023-08-22 at 15 29 09
hamed-musallam commented 1 year ago

@CS76

Returning to my previous comment https://github.com/NFDI4Chem/nmrium-react-wrapper/issues/95#issuecomment-1521715492, it appears that our choices are limited regarding this issue because we must read the files on the wrapper side in order to generate the nmrium object that NMRium can load. However, we could consider moving the initial reading process to the server side (API), by doing that we can improve efficiency and make it transparent to the end user.

CS76 commented 1 year ago

Shouldn't this be handled on NMRium ?? Why do we preprocess the data again ??

hamed-musallam commented 1 year ago

We are not processing the data twice, we just creating a nmrium object (which contains the list of spectra and their references to the physical files, without this step, we can not connect the physical files with each spectrum, you can say it is an essential process to map the files and link them with the spectrum), this process is essential for NMRium to be able to read and export the files correctly, this happens behind the scene once you drag and drop any files.

CS76 commented 1 year ago

@hamed-musallam, we can close this issue for now. We now generate the nmrium-compatible data structure for loading spectra on the first load and save it so files are always downloaded only once afterwards which should be okay to go ahead.