NIST-ISODB / isotherm-digitizer-panel

Contribution form for NIST adsorption isotherm database implemented using pyviz panel
2 stars 3 forks source link

feature: upload multiple graphics for multi-component isotherms #36

Open dwsideriusNIST opened 4 years ago

dwsideriusNIST commented 4 years ago

One of the plans for the digitizer was to provide a way to associate a source graphic(s) with the digitized isotherm. Rudiments of this are in the app, as the pre-fill associates a figure with the demo JSON file.

Proposal: On the form tabs, include a place to upload graphic files, which become part of the submission ZIP file. There should be a metadata association in the JSON file, like:

"content_graphics": ["file1.jpg", "file2.jpg", "file3.jpg"]

The name of the key is flexible, as it need not be a canonical key for the isotherm standard / API.

ltalirz commented 4 years ago

This actually already exists but it's very well hidden: image

For some reason, file input fields don't display the name by default, i.e. we will make sure to add it manually.

dwsideriusNIST commented 4 years ago

Aha, I had assumed that was an "upload CSV" button, but never tried it! We'll fix it with documentation / on-screen test

dwsideriusNIST commented 4 years ago

I'm working on this: https://github.com/dwsideriusNIST/isotherm-digitizer-panel/tree/feature-assoc_figure

Adding multiple file selection support has been requested upstream in panel: https://github.com/holoviz/panel/pull/1569 (it's been in bokeh since https://github.com/bokeh/bokeh/pull/9732, but the interface in panel was missing a parameter reference). This wasn't a one line fix.

My intention for this is to: 1) Improve on-screen description 2) Allow multiple file selection 3) Add a new key to the raw JSON, tentatively "associatedgraphics"; value is a list 4) Update submission module to handle multiple files

dwsideriusNIST commented 4 years ago

This actually already exists but it's very well hidden: image

For some reason, file input fields don't display the name by default, i.e. we will make sure to add it manually.

I looked into this too, and we're looking at a pretty complicated issue. The "No file chosen" text is part of browser settings (multilanguage support). It would also be nice if "No File Chosen" would update after clicking prefill, but I haven't yet found a panel or bokeh feature that refreshes the text (or similar), if it even exists.

ltalirz commented 4 years ago
  1. Allow multiple file selection

  2. Update submission module to handle multiple files

Do you think this is necessary? Isn't one file upload (=the one for the figure graphic) enough? I would say we don't really need a separate file upload for CSV - people can just copy-paste the data into the text field.

  1. Add a new key to the raw JSON, tentatively "associatedgraphics"; value is a list

Right; it would be good to record the presence of a figure snapshot in the raw JSON

I looked into this too, and we're looking at a pretty complicated issue. The "No file chosen" text is part of browser settings (multilanguage support). It would also be nice if "No File Chosen" would update after clicking prefill, but I haven't yet found a panel or bokeh feature that refreshes the text (or similar), if it even exists.

For labelling the file upload, we can simply add a static html text.

As for "no file chosen" not being updated by the prefill - it's not ideal but also not a big deal I would say...

dwsideriusNIST commented 4 years ago
  1. Allow multiple file selection

Let's hold off on this while it gets picked up by the holoviz/panel crew (https://github.com/holoviz/panel/issues/975)

  1. Update submission module to handle multiple files

Do you think this is necessary? Isn't one file upload (=the one for the figure graphic) enough? I would say we don't really need a separate file upload for CSV - people can just copy-paste the data into the text field.

This gets back to the complexity of multicomponent isotherms. Sometimes one "isotherm" (thinking of it holistically, where the "isotherm" is all of the measurements associated with an single equilibrium state) is presented in a series of figures; like one plot for each species. But I agree, no need for separate file upload for CSV as pasting covers that use case.

  1. Add a new key to the raw JSON, tentatively "associatedgraphics"; value is a list

Right; it would be good to record the presence of a figure snapshot in the raw JSON

When I have a PR in proper form, this will be covered.

I looked into this too, and we're looking at a pretty complicated issue. The "No file chosen" text is part of browser settings (multilanguage support). It would also be nice if "No File Chosen" would update after clicking prefill, but I haven't yet found a panel or bokeh feature that refreshes the text (or similar), if it even exists.

For labelling the file upload, we can simply add a static html text.

After my PR, I'll let you make a suggestion on this. I'm not sure what you have in mind specifically. As for "no file chosen" not being updated by the prefill - it's not ideal but also not a big deal I would say...

Agree.

dwsideriusNIST commented 4 years ago

A few application issues/needs that became apparent during some personal use and development in a feature branch:

  1. On-tab list of the graphic file(s) associated with the isotherm is needed so that users can see which files are associated with the current form data
  2. App needs a button to clear or delete the graphic files associated with the form. (the list of file(s) above will enhance this feature)
  3. Renaming of graphic files will occur during the submission step (watch for forthcoming PR)
dwsideriusNIST commented 4 years ago

updating 'associated_content' key during submission step is in #43