hodcroftlab / covariants

Real-time updates and information about key SARS-CoV-2 variants, plus the scripts that generate this information.
https://covariants.org/
GNU Affero General Public License v3.0
316 stars 111 forks source link

Download web data dynamically #302

Open ivan-aksamentov opened 2 years ago

ivan-aksamentov commented 2 years ago

Currently, the data is made available to the application through the synchronous ES6 import, processed by webpack, which bundles JSON files into resulting JS files along with the application code.

An import was an easy and quick solution in the beginning

but it's no longer great nowadays, because data size have grown substantially, blowing up the app bundle, making the app very slow and requiring more resources for CI builds.

An alternative would be to host data separately from the app bundle and to fetch it dynamically from the network.

Fetching data from a network location have some additional disadvantages:

Steps:

ivan-aksamentov commented 2 years ago

This would also allow to switch data URLs dynamically, to be able to fetch data from a non-default location.

This will be handy to organize experiments and to preview freshly generated data, especially if we Move data out of git repository #301. For example newly generated data can be stored on a preview S3 bucket and the web app can fetch data from it instead of from production bucket.