Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable a narrative to source multiple builds #1050

Closed
cassiawag opened this issue Apr 8, 2020 · 6 comments
Closed

Enable a narrative to source multiple builds #1050

cassiawag opened this issue Apr 8, 2020 · 6 comments
Labels
enhancement New feature or request narratives issues / PRs relating to narrative functionality please take this issue

Comments

@cassiawag
Copy link
Contributor

cassiawag commented Apr 8, 2020

Context
We publish weekly situation reports using narratives on the spread of COVID-19. These situation reports are broken into sections by world region. Latest report for example: https://nextstrain.org/narratives/ncov/sit-rep/2020-04-03

Currently, narratives can only source one dataset. When there was only one global ncov build, this wasn't a problem. Now that we have multiple subsampled builds (ncov/global, ncov/europe, ncov/africa...) using only one of these builds for the situation reports greatly limits the data we can cover.

Description
We'd like to upgrade the narratives functionality, so it can source multiple datasets within a single narrative. For example, one slide could show the ncov/global build and the next slide could show the ncov/north-american build.

Possible solution
There's been some limited discussion about the problem at issue: #890

@cassiawag cassiawag added enhancement New feature or request high priority narratives issues / PRs relating to narrative functionality labels Apr 8, 2020
@jameshadfield
Copy link
Member

This would be wonderful.

Currently the architecture of auspice is designed around loading a single dataset (code which fetches the JSONs here). This dataset JSON essentially generates most of the redux state needed to display that dataset, via createStateFromQueryOrJSONs.

(The way narratives work is that they then use URL queries to modify this redux state when you move between slides, thus affecting how the data should be presented. This is via createStateFromQueryOrJSONs.)

To allow multiple datasets the redux state (via createStateFromQueryOrJSONs) will have to be re-created from the "new" dataset JSON when moving to that page in the narrative. In theory this isn't too bad, but there will be lots and lots of little bugs (I explored this a little bit when first building narratives, since I always wanted it, but hasn't been high priority until now). Since fetching JSONs is slow, any solution should pre-fetch the required JSONs for the narrative & store them in a redux cache or similar.

@salvatore-fxpig
Copy link
Contributor

Opened a WIP here #1071 but needs help for comments, test cases, debugging

@jameshadfield
Copy link
Member

Leaving a summary of a comment in #1071 here for posterity also:

I've made a test narrative to demonstrate the functionality this issue is asking for: markdown here and visible on nextstrain.org here. This is a simple 3-slide narrative which should change from the mumps dataset to the zika dataset, but it currently does not. To run locally in auspice, you should run npm run get-data to get the dataset JSONs from the S3 bucket and then npm run get-narratives to collect the narrative markdown files, including the test one linked to above. You can then view it via auspice develop and going to http://localhost:4000/narratives/test/multiple-datasets. (Note that running it on current master causes no crashes, but the dataset doesn't change.)

@salvatore-fxpig
Copy link
Contributor

Posted an update in the PR about 10 days ago, I guess you guys are super busy these days but just wanted to make sure it does not end up flying under the radar @jameshadfield .

@jameshadfield
Copy link
Member

This looks pretty good! I know @eharkins has tested this a bit, so look out for a review from him in the coming days 👍

@eharkins
Copy link
Contributor

Closed by #1164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request narratives issues / PRs relating to narrative functionality please take this issue
Projects
None yet
Development

No branches or pull requests

4 participants