Test JMESPath to fetch data in the GUI
Right now, it is not possible to navigate through the JSON responses in specific GUI components, like the Widgets or the results table to fetch for example data from nested (elastic search) sections. It would be great if we could use JMESPath notation to resolve the specific values we would like to resolve.
This is related to #1164 (closed)
Todo:
-
Create a function in utils.js
to validate a JMESPath and return the quantity path it is targeting. E.g.validateJMESPath('results.properties.electronic.band_structure[0].band_gap[0].value')
would return{error: undefined, quantity: 'results.properties.electronic.band_structure.band_gap.value'}
-
Modify all of the widgets edit dialogs to allow nested paths, and accept JMESPath syntax which are valid. Validation errors should be shown. -
Modify the widgets to accept the full JMESPath, but only use the targeted quantity name in API calls, and when displaying other quantity related information. -
Use the JMESPath to resolve the final data from the API response. This should be then passed to the plots, histograms etc. -
Add JMESPath resolving to the search results table. -
Add better labels to properties that are fetched using JMESPath. E.g. the table headers, and plot axes by default simply display the quantity name, but now it can be something much more complicated, e.g. the minimum value of all nested values. The table headers should thus somehow be customized to indicate this. E.g. if using the path 'min(results.properties.electronic.band_structure[].band_gap[].value)' instead of Band gap
maybe the label should sayBand gap (min)
? I'm not sure if this can be automated, or if the user should be able to customize the labels instead, perhaps a bit of both.