neherlab / covid19_scenarios

Models of COVID-19 outbreak trajectories and hospital demand
https://covid19-scenarios.org
MIT License
1.36k stars 352 forks source link

Don't bunde the data #744

Open ivan-aksamentov opened 4 years ago

ivan-aksamentov commented 4 years ago

πŸ™‹ Feature Request

πŸ”¦ Context

Currently all the data (default scenarios, case counts, age and severity distributions) https://github.com/neherlab/covid19_scenarios/tree/master/src/assets/data is being bundled into the app directly with webpack, using static import. For example: https://github.com/neherlab/covid19_scenarios/blob/00fbc711fb5e0b4fee28e60858edeca69e9291af/src/io/defaults/getAgeDistributionData.ts#L3

This is an easy solution

but is not very practical:

😯 Describe the feature

We want to evaluate different mechanisms of loading and updating the data. The new mechanism should:

πŸ’» Examples

πŸ’ Possible Solution

For example, we could load the data to the public S3 bucket and the load it with a plain HTTP request and validating it afterwards.

We are open for other proposals.

Related

r-s-rai commented 4 years ago

Hello,

Would it be possible to schedule a meeting about how you want the data implemented? My group and I were thinking about using an Amazon S3 bucket to store the data, but we wanted to coordinate with you guys since you'll be the ones in charge of the S3 bucket and managing it.

rneher commented 4 years ago

sure, let's discuss. How about tomorrow (Thu) late afternoon CEST, morning East Coast?

r-s-rai commented 4 years ago

That sounds good. Do you want to hold the meeting over Zoom, and what exact time would you like to meet?


From: Richard Neher notifications@github.com Sent: Wednesday, July 1, 2020 3:04 AM To: neherlab/covid19_scenarios covid19_scenarios@noreply.github.com Cc: Rai, Rohan r.s.rai@wustl.edu; Comment comment@noreply.github.com Subject: Re: [neherlab/covid19_scenarios] Don't bunde the data (#744)

sure, let's discuss. How about tomorrow (Thu) late afternoon CEST, morning East Coast?

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/neherlab/covid19_scenarios/issues/744#issuecomment-652261860, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKI6K4GX5GH65Z7SF6JKYCLRZLUY5ANCNFSM4N64YCZA.

ivan-aksamentov commented 4 years ago

@r-s-rai Hello, sorry for missing the call.

I've setup a S3 bucket + cloudfront distribution + domain.

So the data is ready to be fetched from: https://data.covid19-scenarios.org/ageDistribution.json https://data.covid19-scenarios.org/scenarios.json https://data.covid19-scenarios.org/caseCounts.json https://data.covid19-scenarios.org/severityDistributions.json

This is just the contents of the src/assets/data directory. If you replace the corresponding imports in src/io/defaults/get* with fetches (e.g. using axios) this should do the trick.

CORS is enabled in both S3 and Cloudfront. However preflight (OPTIONS) requests will probably not work. So keep that in mind.

Note however that this simple solution would introduce all kinds of new issues:

So the entire adventure is probably more complicated than swapping the imports with requests.

Okay, sounds bad, but are there any other alternatives? I don't know. So why don't you give it a try and we will see where it goes. Please open a (draft) pull request early on to keep the discussion going.

Let me know if you have any questions or if you encounter any problems (especially with the AWS setup).

cc @rneher

rneher commented 4 years ago

@r-s-rai -- as you see in Ivan's comments above, the operation turns out to be slightly trickier than anticipated. We suggest starting first with just replacing bundling of the jsons by fetching. from there, one could then move towards fetching the case counts one-by-one.

r-s-rai commented 4 years ago

Hello Ivan,

Would it be possible to schedule a meeting with you sometime soon to discuss the code?

Thank you,

Rohan Rai

DaveedaKinG commented 3 years ago

Hello Rai

I think it’ll be a really nice idea to discuss With you on this

thanks

DaveedaKinG