GithubHelp home page GithubHelp logo

neherlab / covid19_scenarios Goto Github PK

View Code? Open in Web Editor NEW
1.4K 50.0 355.0 57.85 MB

Models of COVID-19 outbreak trajectories and hospital demand

Home Page: https://covid19-scenarios.org

License: MIT License

JavaScript 70.91% TypeScript 19.82% Dockerfile 0.04% Shell 0.23% Python 6.87% Makefile 0.04% SCSS 2.09%
covid-19 sars-cov-2 coronavirus ncov open-source science research model hospital covid

covid19_scenarios's People

Contributors

abrie avatar arieltonglet avatar aschelch avatar brunorzn avatar btoo avatar christian-g-ut avatar dependabot-preview[bot] avatar dkozar avatar gj262 avatar ivan-aksamentov avatar joluma avatar jsmith avatar kimuraz avatar kmid5280 avatar maozgelbart avatar mt-gitlocalize avatar neherlab-bot avatar nnoll avatar noleti avatar nspringman avatar pvillamartin avatar r-s-rai avatar rcbevans avatar rneher avatar samanthahamilton avatar tbnv999 avatar tiagoandresvaz avatar tryggvigy avatar vdruelle avatar whiver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

covid19_scenarios's Issues

aux folder name

The folder/file name "aux" is forbidden in windows.
Could you rename it?

Backbone for adapt it to local needs

Hi,
Thanks for developing this tool! We are trying to develop a tool that helps local/regional mitigation efforts within a country (Bolivia). Using your scripts would be quite useful by saving us tons of time in developing the model. We would then include idiosyncratic conditions, such as local hospital coverage, new cases emerging, etc. We expect this to support targeted interventions in very low capabilities environments. However, I have not been able to spot the piece of the script that contains the pure contagion/recovery/death modeling part (the backbone of the tool). Would you please be so kind to refer me to where I can find it? Sincerely appreciate it.
Thanks and best,
Rodrigo

Reduce bundle size

Current bundle size is huge, ~10 MBytes before gzip

  • investigate Home.js bundle size
  • trim and tree-shake libraries
  • add more code splitting

The bundle analyzer can be run with yarn alalyze or yarn alalyze:watch.

Where does the Swiss Cantonal Data come from?

Hi.
I am looking at the case_counts.json and was wondering where the data comes from since when aggregating on national level, it greatly deviates from other sources such as John Hopkins or swissinfo?
thanks in advance,
JC

[Bug] Fix overlapping of y-axis text on mitigation chart

Browser (include version): Chrome 80
Operative System: Mac OS Catalina

The current behavior

On mobile, the y-axis text on the mitigation chart overlaps to the point where the chart is unreadable.

Iphone X Chrome:

Screenshot 2020-03-21 at 12 56 01

The expected behavior

Text should be displayed to the user clearly

related:

#71

Add tests

In order to perform refactoring and to add new features with more confidence, we need unit, integration and end-to-end tests for:

  • algorithm parts. Seesrc/algorithms

  • React parts - components and pages. See src/components and src/pages

  • State management: redux reducers and sagas. See src/state

The infrastructure:

  • jest and @testing-libraryare already set up. Unit and integration tests can be ran with yarn test or yarn test:watch

  • cypressis planned for e2e tests

  • We plan either Travis CI or CircleCI for continuous integration

Any help is appreciated!

IMPORTANT: Autorun: run the algorithm and update the plots automatically without clicking on Run button

This may include:

  • debounce run() calls
  • hide feature behind the checkbox, disabled by default

Issues:

  • formik does not allow to subscribe to the form state changes. It requires submit to be called
  • formik does not expose the form state. We currently grab the state in validation callback, which arguably, is a hack
  • formik seem to be re-rendering the entire form on changing any field. This is a performance problem - In automatic mode editing fields is very uncomfortable. There are ways to workaround it, but I don't want to introduce any more workarounds.

Solutions:

  • Replace formik with redux-form? It will require quite substantial changes, for example reimplementing the validation.

I posted a cry for help in the Formik's chat:
https://spectrum.chat/palmer/formik/retrieve-values-without-submit-re-rendering-covid-19-scientists-need-help~d595a68c-2090-4a16-8a21-6f0772ff48e7

The following gif shows how on changing one value the entire form including mitigation plot is being re-rendered:

Peek 2020-03-16 20-55 mp4

Improve styles and readability

Hi! Based on issues #71 and #13 me and @arieltonglet are assessing improvements to the general user experience. We're planning on altering text, button and help icon styles to improve readability and information hierarchy on both desktop and mobile.

Later on we intend to work on the charts, but it'd be best to open a separate issue for that.

Typo

"Severly ill" should be "Severely ill" in the "Cases through time" figure legend.

Link to previous scenarios

It would be great for people to link to custom configured scenarios via a dynamically generated URL. This would allow people to easily share their results.

Support developing on Windows

Currently we only support Unix-based platforms and the dev configuration contains some Unix-isms that Windows cannot digest.

We want to support running the app on windows as well, to reach more contributors.

See also:

talking

Maybe working and adding on data of people who works now for country with lockdown to simulate virus propagation diminution and how many time needed to stop?

[INFO] - How can I contribute ?

I have good experience in React. How can I help ?
For eg: I cloned and made changes to the README.md, adding instructions to setup on windows

Browser (include version): NA
Operative System: Windows

Documentation


Run

This will run the application in development mode (with hot reloading):

on Mac / Linux

git clone https://github.com/neherlab/covid19_scenarios
cd covid19_scenarios/
cp .env.example .env
yarn install
yarn dev

on Windows

git clone https://github.com/neherlab/covid19_scenarios
cd covid19_scenarios/
ren .env.example .env
yarn install
yarn dev

503 ERROR

I get this (@ https://neherlab.org/covid19/ ):

503 ERROR
The request could not be satisfied.
The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
Request ID: GAFG3HbuNjLQJ23ZM6YcuAtgC8tDCRKXNgHBW2TbsdIvn4HY7VSBvA==

Improve mobile user experience

Our current mobile experience is suboptimal.

Key defects:

  • Situation is particularly bad with charts and plots, which is a central aspect of the application.
  • Some of the elements are needlessly large, some are to small
  • Scrolling is awkward
  • Tapping "Run" button gives no clue that there is more content appeared below
  • Calendar is cut-off

We currently use reactstrap as a frontend library with some Sass stylesheets and bootstrap utility classes sprinkled here and there. As a team of 3 people, we would not able to change that. But if we find knowledgeable contributor(s) in UI/UX space, then the transition to another styling solution will become more realistic, including the full revamp of the UI.

Our main focus is desktop, with 720p or 1080p screen at least, but having broken mobile experience hurts the outreach, because we mostly promote our project on social media (Twitter). People are coming from there on the phones first, and they are probably not very impressed and are less compelled to switch or return with a larger device.

Related issues:

  • Improve desktop user experience: #13

Screencast of "iPhone X" simulation in Chrome:

mobile

Fix black dots dragging behavior on the mitigation plot (React hooks + D3.js guru needed)

Steps To Reproduce

  1. Refresh the main page
  2. Mouse-focus into one of the form fields, for example increment "Imports per day" number.
  3. Without blurring (moving the cursor out of the form field), try to drag a black dot on the "Mitigation" plot

The current behavior

The "Mitigation" plot dot being dragged is not moving until mouse button is up

The expected behavior

The "Mitigation" plot dot being dragged is not moving as the cursor moves

Hypotheses

The blur event out of the field coincides with the initial click on the plot's dot. After the blur, the form rerenders and also causes the plot to rerenders.
Currently there is a hack. This .html(null) on every render clears the entire plot:

const graph = d3
.select(svg)
.html(null) // clear everything
.append('g')
.attr('transform', `translate(${margin.left},${margin.top})`)

This also causes the destruction of the black dot we are dragging. The new dot will be rendered only on mouse up. Meanwhile we are dragging nothing.

Potential solution

We need to remove the hack shown above and to figure out proper dependencies for the `useEffect hook here:

export function ContainmentGraphImpl({ data, onDataChange, width, height }: ContainmentGraphImplProps) {
const d3ref = useRef<SVGSVGElement>(null)
// FIXME: can we avoid some of the re-rendering? Add array of dependencies. Ensure proper cleanups.
useEffect(() => draw({ data, onDataChange, width, height, d3ref }))

such that the plot is properly cleared when it is needed, that it is responsive (to screen size) and not causing unnecessary rerenders at the same time

D3-React interop in this component should be properly audited for additional bugs and performance problems.

Broken link

The link to the Chinese CDC data from which our severity data is broken.

Results unexpectedly depend on time span

A UZH colleague of mine, Barbora Trubenova, has spotted that the model results depend on the chosen time window. For example, with default parameter values, the default time span until 12th September 2020 predicts 484 cumulative deaths by 1st August 2020. Changing the time span to 15th May 2021 changes the prediction to 920 deaths by 1st August 2020. The same applies to all other predicted values (see screenshots below). For an intermediate date, the predictions are intermediate. Therefore, at best, the model can be valid only for one particular time span.

Screenshot 2020-03-12 at 22 39 53

Screenshot 2020-03-12 at 22 40 25

Improve desktop user experience

Thank you for this useful resource! Unfortunately it is rather difficult to work with in the web browser because of the rigid boxy layout. Labels, values, and column headers are truncated and/or difficult to read.

Please consider a more flexible web layout; perhaps moving the Results box to the bottom might help.

Global data

Commended for great work!

Wondering if you have a global data of this?

Specify mitigation scenarios as intervals

In some situations, it might be more convenient to specify the mitigation scenarios as time intervals:

--2020-03-01                    100%
2020-03-01 -- 2020-03-15         50%
2020-03-16 -- 2020-03-31         75%
2020-04-01 -- 2020-05-31         60%
2020-06-01 --                    50%

The data structure for this would work just about the same way as a time series of adjacent intervals, the main difference would be UI. Need to think about how to enforce that intervals tile time.

Proportions / Outcome is not updated

The second-last column, proportions/outcome, is not updated with the simulated values. E.g., Fatal is always at 0.81 percent, even when switching between "no mitigation" and "strong mitigation".

Setup proper infrastructure and continuous integration

We need to figure out at least the basic infrastructure:

  • automated builds and deployment to production from release branch
  • automated builds and deployment to staging from master branch
  • automated builds and deployment of pull requests

TODO:

  • create domain names for production and staging
  • setup Travis or CircleCI, deploy on pushes

Open Source Helps!

Thanks for your work to help the people in need! Your site has been added! I currently maintain the Open-Source-COVID-19 page, which collects all open source projects related to COVID-19, including maps, data, news, api, analysis, medical and supply information, etc. Please share to anyone who might need the information in the list, or will possibly contribute to some of those projects. You are also welcome to recommend more projects.

https://weileizeng.github.io/Open-Source-COVID-19/

Cheers!

Add popup on startup

We want to add an initial modal popup with a sort of a "user agreement" info, and consent

  • non-liability disclaimer
  • eventually, GDPR compliance info and consent
  • eventually, local storage or cookies options, when we have those

Backend-side work?

I'm a Node.js developer and I'd like to help, however, I'm not really proficient with React. If there is any non-React work that I could help with (either server-side or business logic isolated from React rendering), I would be most happy to contribute.

โ—[IMPORTANT] Import scenarios

I believe you might have that on the roadmap since there is an option to export.
It would be great to name and compare scenarios with simple KPI.

R0

The label "Annual average Rโ‚€" does not seem to be correct.
Rโ‚€ is defined as the number of infections per case. It's not annual.

What's the meaning of Imports per Day?

Thanks for the model and the simulation. That's amazing.

Some explanation would be nice for non-research folks. For example, What's the meaning of Imports per Day? Thanks!

Rounding

A minor issue: Peak hospitalisations should be given to the nearest integer (i.e. "Number of individuals") in the lower bar chart, in which the other variables are already rounded. I think you could do this by adding round() on line 40 of PlotAgeAndParams.tsx. Relatedly, agesFrac in the upper bar chart could be given to fewer significant figures.

Including distribution of Latency & Infection period

"Latency" & "Infection Period" in reality are not a single value but have pretty wide distribution what can impact the results significantly. Similar to Age distribution used for evaluation you can incorporate a simple histogram or function based distribution for both terms.

But great Job, congratulations

๐Ÿ” WANTED: We are looking for data and data curators

Currently we are looking for case counts data and other statistical information from different countries as well as for people who can maintain this data (add, curate, update).

The entire process should be automated as much as possible. The README in the directory covid19_scenarios/data contains some information on how to get started:

https://github.com/neherlab/covid19_scenarios/data

It also contains the preprocessed data ready for the consumption by the build system of the app.

If you think you may know where to find the relevant data for a country, please let us know either in this thread, or open an issue. If you are ready to contribute, feel free to open a pull request.

Don't hesitate to ask if you have any questions or if you need something to get started!

cc @nnoll @rneher

Bed numbers should be editable

Please allow us to edit hospital beds and ICU beds.

I'm trying to get ventilated beds expanded in my institution in anticipation of an onslaught. Switzerland is doing well for ICM beds in comparison to my home country, we have far fewer. Being able to show our own nation's Total Hospital Beds and ICU beds overwhelmed under different scenarios would be useful for those of us who have to persuade the people with the dollars.

Thank you for your hard work.

Adding a legend "ICU beds"

Hopefully a legend "ICU beds" can be added. I guess it's important to compare ICU beds with critical?

Performance optimizations for tree and map visualizations

I just spoke with @colinmegill about what could be done to improve the performance of the visualizations.

Small wins:

Don't render any visualization that is not on the screen

There are a variety of ways to do this, IntersectionObserver is a solid tool for that, and it should be an easy win. It exists in every browser but IE. (I highly recommend ditching support for IE.. if we're talking about working on something that will help save lives, we shouldn't slow down progress for a browser that is dead in a year) If IE must be supported, then we'd gate the functionality on the existence of IntersectionObserver.

Bigger Wins

Render all "circles" in the tree view to Canvas overlay

  • Use a transparent canvas to render, just the circles alone, they move on their own between views, there are a LOT of them, and Canvas can easily render these circles quickly and efficientely.
  • For user interactions, you would use a transparent <div> overlay that intercepts all user interactions to check to see if the mousemove or click, etc events are "over" one of the circles. This can be done via simple and efficient coordinate lookup with a library called RBush.
  • The brush overlay would be another layer, so as to prevent the re-rendering of the circles underneath during brushing, helping performance.

Render all circles in the map view as a Leaflet canvas overlay

There are a number of examples around of how to do this. The first one I found was here. The same general idea as above. It might be that you want to do more than one overlay. one fo the circles, and one for the bezier arcs, so as you're brushing the number of updates required are minimal.

Other thoughts

It's going to become important to abstract the location/positioning data away from any component they may currently be residing in now. This is so it can be reused effectively by newer code as you transition from SVG to Canvas. The upside is that the coordinate system between 2d canvas and SVG is basically the same, X,Y coords originating from the top left.

It's also worth mentioning that the calculations are very unlikely to be the bottleneck to good performance here. So it's probably best not to waste too much effort on those. Computers are pretty fast at dealing with sets of numbers and calculations, even in JavaScript. At the moment that does become an issue we can address it.. move it to a worker, WASM, etc. But for now, the biggest choke point is the DOM rendering.

Actions to be taken

  • analyze the positioning algorithms used, and try to abstract them away from any rendering logic
  • Attempt to implement a canvas layer for the tree circles
    • Render the circles to canvas
    • Create position indexing with RBush
    • Add transparent div to handle user events like hovers and clicks
    • Have transparent div handle scrolling and update the canvas rendering and position index (rbush)
  • Attempt to implement the map overlays
    • Create a map overlay for pie charts
      • Create a drawing function for drawing a pie chart with Canvas context
      • Add the Leaflet canvas layer and render the pie charts
    • Create a map overlay for the "circles" for the connected circles visualization
    • Create a map overlay for the brush-animated arcs, and wire it up to update on brush selection
  • Look into the easy win of not rendering visualizations that are off-screen.
    • Create a component that will render a different set of children if it is some specified percentage offscreen, something like: <OffscreenChecker percent={80}>{(isOffscreen) => isOffscreen ? <div className="greyplaceholder"></div> : <ActualComponent/></OffscreenChecker>... There may even be existing components that can do this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.