Code Monkey home page Code Monkey logo

kukosek / koronagrafy Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 7.76 MB

Statistics and prediction of the COVID-19 outbreak. Focused on Czech Republic but has predictions for other countries too

Home Page: http://koronagrafy.techbrick.cz

License: MIT License

HTML 37.75% JavaScript 57.02% CSS 5.23%
coronavirus-tracking coronavirus-tracker coronavirus-analysis coronavirus-prediction ncov-data-visual czech-republic growth-factor covid-19-czechia

koronagrafy's Introduction

No longer actively maintained. I am too lazy to keep it working all the time. Sorry. Please use the official page - Onemocneni aktualne MZCR

Mathematical prediction of COVID-19 pandemic's development. Fetching data from czech-covid-db and Johns Hopkins University COVID-19 repository. Everything is downloaded and calculated on the client side. This project has no server side, except the program that updates czech-covid-db.

Getting currently displayed data from console

If you want the data in JSON format, open your browser's developer console and type one of these commands:

  • tests: console.log(JSON.stringify(datasets.tests, null, 1))
  • confirmed cases: console.log(JSON.stringify(datasets.confirmed, null, 1))
  • recovered: console.log(JSON.stringify(datasets.recovered, null, 1))
  • deaths: console.log(JSON.stringify(datasets.deaths, null, 1))
  • growth factor: console.log(JSON.stringify(datasets.spreadGrowthFactor, null, 1))
  • prediction: console.log(JSON.stringify(datasets.prediction, null, 1))

Used libraries

  • Chart.js for visualisation
  • Moment.js for easy date/time manipulation
  • PapaParse for csv parsing (they say it's faster than string splitting, but idk)
  • NProgress for the loading bar at top

Math behind the scenes

Explanation of the function is in about. Here is how the code for it works. The prediction dataset is created in function calculatePredictions(). There are many lines in the function that provide the growth factor (MtimesP) it has to use and other things depending on user configuration. The essential parts are these:

  • The loop. One iteration calculates a result for one day. while(lastResult <= populationSize && Math.round(lastResult) != Math.round(resultBeforeInfectionPeriod) ){
    In the loop, one of these calculations happen:
    • If selected function is Henry's logistic/first: result = lastResult + MtimesP*(1-(lastResult/populationSize))*(lastResult-resultBeforeInfectionPeriod);
    • If it is the other function (Henry's probabilistic), MtimesP is converted to meetInThisDay, then result = populationSize*(1 - (1-lastResult/populationSize)*Math.pow((1- probabilisticProbability*(lastResult-resultBeforeInfectionPeriod)/populationSize),meetInThisDay));

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.