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

Narratives cannot display frequencies #1283

Closed
jameshadfield opened this issue Feb 11, 2021 · 2 comments
Closed

Narratives cannot display frequencies #1283

jameshadfield opened this issue Feb 11, 2021 · 2 comments
Labels
bug Something isn't working please take this issue

Comments

@jameshadfield
Copy link
Member

jameshadfield commented Feb 11, 2021

Narratives cannot display frequencies panels in Auspice 2.33.0. I believe this used to work in a previous version, but have not bisected to confirm. A test narrative showing this has been created on the bug-narratives-frequencies branch -- please base any fix on that branch!

How to reproduce

Steps to reproduce the current behavior:

  1. get fetch
  2. git checkout bug-narratives-frequencies
  3. npm run get-data
  4. auspice develop --narrativeDir narratives
  5. load http://localhost:4000/narratives/test/display-frequencies-panel

Additional context

The frequencies sidecar JSON is not fetched when the narrative is loaded. When loading http://localhost:4000/ncov/global?d=tree,frequencies, the dataset the narrative is attempting to display and which correctly displays the frequencies when viewed by itself, the following getDataset requests are made:

http://localhost:4000/charon/getDataset?prefix=/ncov/global
http://localhost:4000/charon/getDataset?prefix=/ncov/global&type=tip-frequencies
http://localhost:4000/charon/getDataset?prefix=/ncov/global&type=root-sequence

However when loading the narrative, only the first of these is made. Auspice should be making all 3 requests in narratives mode.

P.S. I highly suspect that narratives won't be able to colour by non-varying bases, as the root-sequence JSON is not fetched either! I haven't created a narrative to test this, but will do at some point.

@jameshadfield
Copy link
Member Author

I've looked into this and the 🐛 arrived when we allowed multiple different datasets per narrative. When a narrative arrives, we call the function fetchAndCacheNarrativeDatasets, which (a) fetches the main dataset JSON and (b) fetches other dataset JSONs defined in the narrative and stores them in redux via CACHE_JSONS. This contrasts with loading a non-narrative page, where we use the function fetchDataAndDispatch, which not only fetches the main JSON but also sidecar JSONs, as required.

Any solution should unify the dataset-fetching code into a single function (either async fn or async generator), which both narratives and non-narratives use. Additionally, the cache structure, currently simply jsons[treeName]=jsonData, will need to be expanded to jsons[treeName] = {main: jsonData, "tip-frequencies": jsonData, ...}.

jameshadfield added a commit that referenced this issue Aug 11, 2021
These changes were motivated by
[#1283](#1283) which arose
as we used different code paths for loading a dataset viz and a
narrative.

Here we represent each dataset by a `Dataset` object. This is used for
stand alone datasets, each dataset in a tangletree, and each dataset in
a narrative. Each dataset instance describes the various API endpoints
of datafiles for each dataset, manages fetching of these datafiles and,
where appropriate, can dispatch data to update redux state.

This has been tested on various single datasets, tangle-trees, and
narratives in this repo. Notably, this commit breaks narratives with
multiple datasets; this will be fixed in a subsequent commit to
reflect Eli's work in PR #1312.
@jameshadfield
Copy link
Member Author

Fixed in c190057

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working please take this issue
Projects
None yet
Development

No branches or pull requests

1 participant