I would like to build a “static” page showing an auspice visualization of a specific dataset, that I would like to integrate within a website (including all the webpacked javascript). Needless to say I don’t want to embed a auspice/nextrain view service.
With auspice build I can almost get what I want, but I always have a page where I have to drop (or be able to answer a GET request) the datasets into the visualization section.
Is there a way that I could build a standalone auspice visualization (with index page and javascript/css) with a preloaded dataset that I could serve with a “conventional” web server (basically skipping the section where I load the dataset)?
Not knowing much about Auspice internals myself, you would probably have to fork the repo and change where the data gets loaded from to your own server.
@james is the guy who knows how this could be achieved.
Is there a particular reason why you can’t use the Github community build way to serve datasets?
I’m relatively new to this, so I may be missing something.
What do you mean by the Github community build way?
We already provide our data publicly. We would just like to have a web tool to quickly visualize internal/experimental builds (integrated in an existing website). Maybe it is just a detail, but right now, all I can do is to provide json results from nextstrain builds, which the user needs to manually download and then upload to an auspice.us-like server. Alternatively I can embed in the webpage another page which is running an independent auspice/nextstrain view service. I would just like to avoid embedding an auspice view service, and I would also like to skip manual steps and immediately present the nextstrain visualization of the dataset just using the produced webpacked html and javascript integrated in an existing webpage. If this doesn’t make sense and there is another, better, way of doing it, I am all in favour of suggestions. If you have examples, that would be even better.
Right now I’m struggling trying to implement in my django-based webpage the ability to answer the GET requests that auspice needs. I just thought there might be an easier way of doing it…
Hi Daniel,
I don’t mean to jump in from Cornelius but thought I could link you to something that may be useful, depending on what you’re looking for - the ‘Github community way’. We have a way that you can create a repo on Github, please your JSON files in a folder called auspice there, and then be able to view via a nextstrain.org link that follows a certain structure. The instructions in more detail are here.
The main thing that tricks people is that the name of your repo needs to match the start of your file name. So, if the repo is called covid then your files should be covid_mycountry_jan.JSON (or similar!). Also, underscores are turned into / in the URL.
The file this links to is here, is in a repo of mine called enterovirus (not an accident!) and the file is called enterovirus_d68_genome-15Feb22.json (note how the _ turn into / in the URL path.)
This is a great way to share runs with a smaller group, or for more ‘internal’ use (but of course - still public - you can’t make these github repos private or nextstrain.org can’t access the file to process it!). I hope it helps!
It does sound interesting and I’ll give it a go at the github community method.
Nonetheless, the matter of privacy may indeed be an issue on some occasions. Another disadvantage is that we sometimes have very big json files (eg. >100Mb) so it starts getting clunky in github…
@daniel.sobral are the json files so big because they are not minimized? You can minify auspice.jsons (not done by default) and then they’re much much smaller.
Nextstrain has an authentication system to restrict build viewing to authenticated individuals - but I’m not sure whether this system is Nextstrain-internal or can be customized to work for you use case. @trs will know better.
There isn’t, although this would be a really nice feature to have! (I actually implemented this for a one-off project a few years ago, but as we don’t use it in this way it’s no longer in the code.) I’d like to reinstate it, but it’s not very high on the priority list.
If you wanted to pursue this you’d need to change the Dataset.prototype.fetchMain and Dataset.prototype.fetchSidecars functions to either fetch from your (hardcoded) address or perhaps just import the data into the file and return it from that function. You’ll also have to change the default value of <reduxStore>.general.displayComponent to be “main” so that the initial page is a dataset-view page. It would be great if this were a build-time customisation but again, it might take me a while to get round to this!