nextstrain / nextstrain.org

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

List available datasets in Gatsby (not Auspice) #310

Open jameshadfield opened 3 years ago

jameshadfield commented 3 years ago

We have begun building out pages and components which render a filterable list of datasets / narratives, such as /influenza and /sars-cov-2. (Note the former may be moved to "/flu" shortly.) These will be expanded in due course to cover different “sources” such as nextstrain community, nextstrain core, nextstrain groups. This is detailed in #305.

As part of this, we wish for URLs which are not backed by a dataset to render / redirect a corresponding “parent” page. For instance, /ncov/antarctica should redirect to /sars-cov-2. (This issue use the word “redirect” but it doesn’t have to be client-redirects, it would also be possible to maintain the URL and simply render the page of /sars-cov-2.)

What happens currently

Most URLs end up in Auspice (see flowchart) where a request is made for the corresponding dataset. If this dataset doesn't exist, Auspice shows a 404 page and a listing of datasets/narratives for that Source (core, staging etc). Note that this page is actually defined in nextstrain.org as a build-time customisation to auspice.

What is desired

Given a path X without an associated dataset, we wish to redirect to the closest “parent” page. Examples:

  1. We maintain a list of core dataset prefixes. Any path matching these, but not backed by a dataset, should be redirected to /pathogens (or /core) which lists all core datasets.
  2. Similarly the “staging” datasets, for which we don’t maintain a list of prefixes, should redirect to /staging.
  3. Pages starting with /flu or ncov, /influenza, /sars-cov-2 etc should redirect to /influenza or /sars-cov-2 as appropriate. In the future there may be more pages such as these.
  4. Groups URLs which don’t define a valid group (or aren’t authorised for that group) go to /groups. These should display all groups datasets, including private ones (see #306).
  5. Groups URLs for which a dataset doesn’t exist go to /groups/name which is rendered from within Gatsby, not Auspice.
  6. Community URLs for which a dataset doesn’t exist go to /community/org/name which is rendered from Gatsby, irregardless of whether a default dataset exists.
  7. Similarly to (6), /community/org/name is a Gatsby page if no default dataset is present. This allows us to remove the “special cased” 204 response from the getDataset API.
  8. These pages are all rendered by Gatsby using reusable components, and we should expose the fact that the URL here wasn’t

Complexities There are two major ones that I am aware of:

image

jameshadfield commented 3 years ago

311 began an implementation of this, which is currently viewable in the next branch

jameshadfield commented 3 years ago

Most listings are now performed by Gatsby code 🙌

Remaining tasks: