-
Notifications
You must be signed in to change notification settings - Fork 169
Description
Currently we expose the ability to download the underlying dataset JSON:
auspice/src/components/download/helperFunctions.js
Lines 627 to 630 in b296518
/** | |
* Write out Auspice JSON(s) for the current view. We do this by re-fetching the original | |
* JSON because we don't keep a copy of the unprocessed data around. | |
* |
We enable this functionality if (a) it meets certain data-use conditions and (b) it's possible to make a HTTP request for the JSON:
auspice/src/components/download/downloadButtons.js
Lines 30 to 32 in b296518
/* Verify that we can parse dataset name from URL to support Auspice JSON download */ | |
const datasetNames = getDatasetNamesFromUrl(window.location.pathname); | |
const supportAuspiceJsonDownload = !gisaidProvenance && datasetNames.some(Boolean); |
specifically this prevents auspice.us from attempting to download JSONs, which isn't possible using the above approach as the data was drag-and-dropped. Additionally we can't update the dataset JSON so that it better reflects the current UI settings - e.g. changing the display defaults color-by to that currently used, or exporting additional metadata which has been dragged on.
Instead we should create a JSON from the current redux-state and download that. This allows the functionality to work in auspice.us and allows for future work to better match the downloaded dataset to the current view settings.
Implementation details
On data load we process the dataset JSON and store (parts of) it in various reducers, e.g. here's us processing the top-level "meta" key. The idea would be to allow such functions to work in reverse. This doesn't mean we'd create an identical dataset as "errors" (e.g. invalid default color-by) wouldn't be exported.
Bigger picture
We've discussed ways to edit various parts of datasets in-browser - for instance, changing the title, color schemes, re-rooting etc. The ability to export the dataset will be essential for this.