nextstrain / nextstrain.org

The Nextstrain website
https://nextstrain.org
GNU Affero General Public License v3.0
88 stars 49 forks source link

Surface previous dataset versions across URL redirects #783

Closed jameshadfield closed 8 months ago

jameshadfield commented 8 months ago

Closes #777. See that issue or the commit messages for full details.

Example URLs which are enabled via this work:

The earliest nCoV dataset we have is from 2020-01-19, and was back then accessed via /ncov. Now /ncov@2020-01-19 redirects to /ncov/gisaid/global/6m@2020-01-19 and loads that dataset.

We can access the /dengue/denv1 datasets prior to Jan 2024 via either /dengue/denv1@YYYY-MM-DD or /dengue/denv1/genome@YYYY-MM-DD, with the former redirecting to the latter.

Testing

Best done locally, via something like

mkdir -p devData
node resourceIndexer/main.js --output devData/index.json --save-inventories \
  --indent --resourceTypes dataset --collections core # needs AWS creds to access s3://nextstrain-inventories
RESOURCE_INDEX="devData/index.json" node server.js --verbose

The heroku review app will not correctly use this functionality as the live index has not been updated with the changes in this PR. If you want a non-local way to test this let me know and I'll make it happen. (You can test a subset of the functionality, e.g. /dengue/denv1@2024-01-03 works as expected.)