coronaindia
Version:
COVID19 India Tracker, predictive analytics and research. Built by engineers, data scientists, AI and medical professionals.
984 lines (870 loc) • 33.7 kB
HTML
<html lang="en">
<head>
<script data-ad-client="ca-pub-3584207319564393" async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-161859093-2"></script>
<!-- Google Tag Manager -->
<script>(function (w, d, s, l, i) {
w[l] = w[l] || []; w[l].push({
'gtm.start':
new Date().getTime(), event: 'gtm.js'
}); var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-N2ZNT32');</script>
<!-- End Google Tag Manager -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-161859093-2');
</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="COVID19 Machine Learning, Artificial Intelligence for India">
<title>Corona India Research Centre</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.1/build/pure-min.css" integrity="sha384-"
crossorigin="anonymous">
<!--[if lte IE 8]>
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.1/build/grids-responsive-old-ie-min.css">
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.1/build/grids-responsive-min.css">
<!--<![endif]-->
<link href="media/bootstrap/bootstrap-4.3.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<!--[if lte IE 8]>
<link rel="stylesheet" href="css/layouts/marketing-old-ie.css">
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="media/rccss/layouts/marketing.css">
<link rel="stylesheet" type="text/css" href="media/misc/css/researchGate.css">
<!--<![endif]-->
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N2ZNT32" height="0" width="0"
style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div class="header">
<div class="home-menu pure-menu pure-menu-horizontal pure-menu-fixed">
<a class="pure-menu-heading" href="../index.html">Corona India</a>
<ul class="pure-menu-list">
<li class="pure-menu-item"><a href="../index.html" class="pure-menu-link">Home</a></li>
<!-- <li class="pure-menu-item"><a href="#" class="pure-menu-link">Tour</a></li> -->
<li class="pure-menu-item"><a href="about.html" class="pure-menu-link">About Us</a></li>
</ul>
</div>
</div>
<div class="splash-container">
<div class="splash">
<h1 class="splash-head">Research Centre</h1>
<p class="splash-subhead">
This is our effort in developing and using machine learning models for fighting COVID19.
</p>
<p style="color:white;">
Scroll down to begin !!
</p>
<!-- <div class="container research">
<div class="row sm-center" style="min-height: 217px;">
<div class="col-12 col-md-4 d-none d-md-block">
<img src="revolution.png" class="rightRotatingImg rotateImg" />
<h6 class="rightRotatingImgText">Predictive <br /> Analysis</h6>
</div>
<div class="col-12 col-md-4 d-none d-md-block">
<img src="revolution.png" class="rightRotatingImg rotateImg" />
<h6 class="rightRotatingImgText">Neural <br /> Networks </h6>
</div>
<div class="col-12 col-md-4">
<img src="revolution.png" class="rightRotatingImg rotateImg" />
<h6 class="rightRotatingImgText">Artificial <br /> Intelligence</h6>
</div>
</div>
</div> -->
<!-- <div class="container research">
<div class="row sm-center" style="min-height: 217px;">
<div class="col-12 col-md-4 d-none d-md-block">
<img src="revolution.png" class="rightRotatingImg rotateImg" />
<h6 class="rightRotatingImgText">Predictive <br /> Analysis</h6>
</div>
<div class="col-12 col-md-4 d-none d-md-block">
<img src="revolution.png" class="rightRotatingImg rotateImg" />
<h6 class="rightRotatingImgText">Neural <br /> Networks </h6>
</div>
<div class="col-12 col-md-4">
<img src="revolution.png" class="rightRotatingImg rotateImg" />
<h6 class="rightRotatingImgText">Artificial <br /> Intelligence</h6>
</div>
</div>
</div> -->
</div>
</div>
<div class="content-wrapper">
<!-- <div class="ribbon l-box-lrg pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-3-5">
<h2 id="why" class="content-head content-head-ribbon">Why research centre ?</h2>
<p class="text-justify">
COVID19 has startled the scientists and medical practitioners alike. While on one hand, the world is finding a
cure for COVID19,
scientists applying artificial intelligence and machine learning are working hard to develop models which can
trace, track and predict
the progress of COVID19. The objective of CoronaIndia is to present the information in the most intuitive way,
and in this spirit,
we believe that bringing easy to understand and utilize applications of machine learning to the masses, will
help in accelerating
the development of novel ideas across India and globe. You must also understand that the output of such
algorithms are dependent on the underlying data.
</p>
<p class="text-justify">
We here present two applications. First is a predicitive analytics i.e. how many COVID19 cases are expected in
India in the upcoming week based on current trends.
It must be noted that our predictions are closest to the actual observed cases as compared to many published
research. Second, we present a neural search engine, to which you can ask any question, and
it will understand the meaning of your queries and provide you with relevant research papers. We think it will
bring the masses close to understanding
progress and developments that is happening across the world, and as scientists prefer to publish research
more than news articles, we believe it can
provide you with first hand information to stay ahead and updated.
</p>
</div>
</div> -->
<div class="content">
<h2 class="content-head is-center">Predictive Analytics</h2>
<div class="pure-g">
<div class="l-box pure-u-1 pure-u-md-1-2 pure-u-lg-1-16">
<h3 class="content-subhead">
<i class="fa fa-rocket"></i>
Prediction of Total Cases in India
</h3>
<p>
<figure class="highcharts-figure">
<div id="container" style="border-right: 1px black;" class="chartContainer">
<div id="loading1" class="waiting">
<img src="loading.gif"></img>
</div>
</div>
<!-- <p class="highcharts-description">
Chart showing data loaded dynamically. The individual data points can be clicked to display more
information.
</p> -->
</figure>
</p>
</div>
</div>
<div class="pure-g">
<div class="l-box pure-u-1 pure-u-md-1-2 pure-u-lg-1-16">
<h3 class="content-subhead">
<i class="fa fa-mobile"></i>
Prediction of Total Cured Cases in India
</h3>
<p>
<figure class="highcharts-figure">
<div id="container2" class="chartContainer">
<div id="loading2" class="waiting">
<img src="loading.gif"></img>
</div>
</div>
<!-- <p class="highcharts-description">
Chart showing data loaded dynamically. The individual data points can be clicked to display more
information.
</p> -->
</figure>
</p>
</div>
</div>
<div class="pure-g">
<div class="l-box pure-u-1 pure-u-md-1-2 pure-u-lg-1-16">
<h3 class="content-subhead">
<i class="fa fa-th-large"></i>
Prediction of Total Deaths in India
</h3>
<p>
<figure class="highcharts-figure">
<div id="container3" class="chartContainer">
<div id="loading3" class="waiting">
<img src="loading.gif"></img>
</div>
</div>
<!-- <p class="highcharts-description">
Chart showing data loaded dynamically. The individual data points can be clicked to display more
information.
</p> -->
</figure>
</p>
</div>
</div>
<!-- <div class="pure-g">
<div class="l-box pure-u-1 pure-u-md-1-2 pure-u-lg-1-12">
<h3 class="content-subhead">
<i class="fa fa-check-square-o"></i>
Plays Nice
</h3>
<p>
Phasellus eget enim eu lectus faucibus vestibulum. Suspendisse sodales pellentesque elementum.
</p>
</div>
</div> -->
<!-- </div> -->
</div>
<div class="content">
<h2 class="content-head is-left">Projected case growth</h2>
<p>Days it will take to reach total cases <i>x</i> times.</p>
<div class="card-body">
<div class="row">
<div class="col-12">
<p style="float:right" class="is-right"><select id="stateList" onchange="calculateDoubling(this.value)"></select></p>
</div>
</div>
<div class="text-success" id="noDoublingData">No Change in cases since yesterday !</div>
<div class="row" id="doublingData">
<div class="col-md-3 col-4 mr-md-1 bg-danger tiles">
<h2 class=" text-white" id="tile2"><i class="fa fa-spinner fa-spin"></i></h2>
<div class="increment-text text-right text-white">2x</div>
</div>
<div class="col-md-3 col-4 mr-md-1 bg-info tiles">
<h2 class=" text-white" id="tile3"><i class="fa fa-spinner fa-spin"></i></h2>
<div class="increment-text text-right text-white">3x</div>
</div>
<div class="col-md-3 col-4 mr-md-1 bg-primary tiles">
<h2 class="text-white" id="tile5"><i class="fa fa-spinner fa-spin"></i></h2>
<div class="increment-text text-right text-white">5x</div>
</div>
</div>
</div>
</div>
<div class="content">
<h2 class="content-head is-center">Neural Search Engine</h2>
<div class="card-body">
<div class="row ml-2 mr-2">
<div class="offset-md-1 col-8 justify-content-md-center">
<input type="text" class="form-control form-control-lg" id="question"
placeholder="Enter Question. Try When will it end?" name="question">
</div>
<div class="col-2 ">
<button type="button" class='btn btn-danger btn-lg' onclick="searchAnswer()">Search</button>
</div>
</div>
<div class="col-12">
<div class="direct-chat-messages customScrollBar" id="answerScroll">
<div class="container">
<div id="loading"
style="display:none; text-align: center; position: absolute; right: 0; left: 0; top: 50%; ">
<img src="loading.gif"></img>
</div>
<br><br>
<div id="aboutAnswerContent" style='text-align:left;font-weight: 600;'>
<p class="text-justify">
It uses state-of-the-art neural intelligence (AI)
network models for answering questions using the <a
href="https://pages.semanticscholar.org/coronavirus-research" target="_blank">COVID
Open Research Dataset (CORD-19)</a> provided by the Allen
Institute for AI and <a href="https://github.com/castorini/covidex" target="_blank"> CORD Search </a>.
It contains more than 47,000 articles from which the search is facilitated.
</p>
Try some of the example questions below:
<ol id="questionList">
<li>What is the incubation period of COVID-19?</li>
<li>What's the effectiveness of chloroquine for COVID-19?</li>
<li>Are there cases of asymptomatic transmission of COVID-19?</li>
<li>How do weather conditions affect the transmission of COVID-19?</li>
<li>Tell me about IgG and IgM tests for covid-19.</li>
<li>What is the prognostic value of IL-6 levels in covid-19?</li>
</ol>
</div>
<div class="row justify-content-center text-center" id="answerFeed">
</div>
</div>
</div>
</div>
</div>
<div class=" l-box is-center">
Copyright © elComrades
</div>
</div>
<div class="modal" id="questionModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document" style="margin-top: 75px;">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="questionTitle">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<h5>Authors</h5>
<div id="authors"></div>
<br />
<h5>Abstract</h5>
<p class="text-justify" id="abstract"></p>
<br />
<h5>Full-Text Excerpt</h5>
<div class="text-justify" id="paragraphs"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script src="media/bootstrap/bootstrap-4.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<script>
var casesData = [];
var todayStateData =[];
var yesterdayStateData =[];
function cases(actual_arr, predict_arr, date_arr) {
Highcharts.chart('container', {
chart: {
type: 'line'
},
title: {
text: 'Total COVID19 cases expected during next 7 days'
},
xAxis: {
categories: date_arr
},
yAxis: {
title: {
text: 'Number of Cases'
}
},
series: [{
name: 'Prediction',
data: predict_arr
}, {
name: 'Actual',
data: actual_arr
},],
});
}
function cured(actual_arr, predict_arr, date_arr) {
Highcharts.chart('container2', {
chart: {
type: 'line'
},
title: {
text: 'Total patients expected to be cured during next 7 days'
},
xAxis: {
categories: date_arr
},
yAxis: {
title: {
text: 'Patients Cured'
}
},
series: [{
name: 'Prediction',
data: predict_arr
}, {
name: 'Actual',
data: actual_arr
},],
});
}
function deaths(actual_arr, predict_arr, date_arr) {
Highcharts.chart('container3', {
chart: {
type: 'line'
},
title: {
text: 'Total expected deaths due to COVID19 in next 7 days'
},
xAxis: {
categories: date_arr
},
yAxis: {
title: {
text: 'Number of Death'
}
},
series: [{
name: 'Prediction',
data: predict_arr
}, {
name: 'Actual',
data: actual_arr
},],
});
}
$(document).ready(function () {
$.get("common-config.html", function (data) {
$("#commonfile").html(data);
});
console.log("now running");
var myurl = 'https://www.menggabungkanpdf.id/get_prediction.php';
$.ajax({
type: "get",
url: myurl,
dataType: 'json',
success: function (results) {
results = JSON.parse(results.response);
console.log("results are", results);
$(".waiting").hide();
cases(results["cases"]["actual"], results["cases"]["predict"], results["cases"]["date"]);
cured(results["cured"]["actual"], results["cured"]["predict"], results["cured"]["date"]);
deaths(results["deaths"]["actual"], results["deaths"]["predict"], results["deaths"]["date"]);
},
error: function (request, error) {
console.log("There is an error. " + error);
},
});
$("#questionList li").on("click", function () {
var question = $(this).html();
$("#question").val(question);
searchAnswer();
})
// $('#aboutSlider').carousel({
// interval: 2000
// })
});
/*automatic question start here*/
var questionData = [];
function searchAnswer() {
console.log("calling search answer")
var question = document.getElementById("question");
if ($.trim(question.value) == "") {
alert("Please enter your question");
$(question).focus();
("#answerFeed").hide();
$("#aboutAnswerContent").show();
return;
}
console.log("question in ", question.value);
$("#answerFeed").hide();
$("#aboutAnswerContent").hide();
$("#loading").show();
var myurl = 'https://www.menggabungkanpdf.id/faq1.php?query=' + encodeURI(question.value);
console.log("url is", myurl);
$.ajax({
type: "GET",
url: myurl,
dataType: "json",
success: function (results) {
console.log("response", results);
questionData = results.response;
results = results.response;
for (data in results) {
var abstractedText = getHighlightedText(results[data]);
var title = results[data].title;
console.log("data is", results[data]);
console.log("title", title);
//console.log(date);
$('#answerFeed').append("<div class='card mr-2 ml-2' style='width: 80rem;'><h6 class='card-title'><br><b>" + title + "</b></h6><div class='card-body'><p class='text-justify'>" + abstractedText +
"</p><button type='button' onclick=\"openAllDetails('" + data + "')\" class='btn btn-dark text-center' target='_blank'>Read More</button></div></div> ");
}
$("#answerFeed").unhighlight();
var questArray = tokenize(question.value);
for (var i = 0; i < questArray.length; i++) {
$("#answerFeed").highlight(questArray[i]);
console.log("tokens are", questArray);
}
$("#loading").hide();
$("#answerFeed").show();
},
error: function (results) {
console.log("There is an error in newsapi. " + results.stringfy);
},
});
}
function getHighlightedText(data) {
console.log("data", data);
var isHighlight = data['highlighted_abstract'];
var highlightAbs = null;
data["highlights"][0];
var highlightPara = null;
var abstractedText = "";
if (isHighlight) {
highlightAbs = data["highlights"][0];
highlightPara = data["highlights"][1];
} else {
highlightPara = data["highlights"][0];
}
if (isHighlight) {
for (var i = 0; i < highlightAbs.length; i++) {
var temphighlight = highlightAbs[i];
console.log("highlights are", temphighlight);
console.log("inside abs");
//console.log("complete text",data.abstract)
console.log("temphighlight[0]", temphighlight[0]);
console.log("temphighlight[0]", temphighlight[1]);
abstractedText += "..." + data.abstract.substring(temphighlight[0], temphighlight[1]);
}
}
if (typeof highlightPara != 'undefined') {
for (var i = 0; i < highlightPara.length; i++) {
var temphighlight = highlightPara[i];
if (typeof data.paragraphs[i] != 'undefined') {
console.log("highlights are", temphighlight);
console.log("complete text", data.paragraphs[i]);
//console.log("data should be",data.paragraphs[i].substring(temphighlight[0],temphighlight[1]));
abstractedText += "..." + data.paragraphs[i].substring(temphighlight[0], temphighlight[1]);
} else {
abstractedText += "..." + data.paragraphs[i - 1].substring(temphighlight[0], temphighlight[1]);
}
}
}
return abstractedText;
}
function getHighlightedTextArray(data) {
console.log("data", data);
var isHighlight = data['highlighted_abstract'];
var highlightAbs = null;
data["highlights"][0];
var highlightPara = null;
var abstractedText = [];
if (isHighlight) {
highlightAbs = data["highlights"][0];
highlightPara = data["highlights"][1];
} else {
highlightPara = data["highlights"][0];
}
if (isHighlight) {
for (var i = 0; i < highlightAbs.length; i++) {
var temphighlight = highlightAbs[i];
abstractedText.push(data.abstract.substring(temphighlight[0], temphighlight[1]));
}
}
if (typeof highlightPara != 'undefined') {
for (var i = 0; i < highlightPara.length; i++) {
var temphighlight = highlightPara[i];
if (typeof data.paragraphs[i] != 'undefined') {
abstractedText.push(data.paragraphs[i].substring(temphighlight[0], temphighlight[1]));
} else {
abstractedText.push(data.paragraphs[i - 1].substring(temphighlight[0], temphighlight[1]));
}
}
}
return abstractedText;
}
function openAllDetails(index) {
var question = document.getElementById("question").value;
var data = questionData[index];
var abstractedTextArr = getHighlightedTextArray(data);
var authors = data.authors;
var title = data.title;
var abstract = data.abstract;
var paragraphs = data.paragraphs;
var url = data.url;
var authHtml = "";
var paragraphHtml = "";
for (var i = 0; i < authors.length; i++) {
authHtml += " <span class='badge badge-danger'>" + authors[i] + "</span>";
}
for (var i = 0; i < paragraphs.length; i++) {
paragraphHtml += "<p class='text-justify'>" + paragraphs[i] + "</p>";
}
paragraphHtml += "Read complete <a href='" + url + "' target='_blank'>here</a>";
$("#questionTitle").html(title);
$("#authors").html(authHtml);
$("#abstract").html(abstract);
$("#paragraphs").html(paragraphHtml);
for (var i = 0; i < abstractedTextArr.length; i++) {
$("#questionModal").highlight(abstractedTextArr[i]);
}
var questArray = tokenize(question);
$("#questionModal").unhighlight();
for (var i = 0; i < questArray.length; i++) {
$("#questionModal").highlight(questArray[i]);
}
$("#questionModal").modal("show");
}
function tokenize(text) {
var results = [];
var words = text
.toLowerCase()
.replace('-', ' ')
.replace('.', ' ')
.replace(',', ' ')
.replace('?', ' ')
.split(' ');
words.forEach((word) => {
if (!GRAM_WORDS.includes(word)) {
results.push(word);
}
});
return results;
}
//highlight script
jQuery.extend({
highlight: function (e, t, n, i) {
if (3 === e.nodeType) {
var r = e.data.match(t);
if (r) {
var a = document.createElement(n || "span");
a.className = i || "highlight";
var h = e.splitText(r.index);
h.splitText(r[0].length);
var s = h.cloneNode(!0);
return a.appendChild(s), h.parentNode.replaceChild(a, h), 1
}
} else if (1 === e.nodeType && e.childNodes && !/(script|style)/i.test(e.tagName) && (e.tagName !== n.toUpperCase() || e.className !== i))
for (var l = 0; l < e.childNodes.length; l++) l += jQuery.highlight(e.childNodes[l], t, n, i);
return 0
}
}), jQuery.fn.unhighlight = function (e) {
var t = {
className: "highlight",
element: "span"
};
return jQuery.extend(t, e), this.find(t.element + "." + t.className).each(function () {
var e = this.parentNode;
e.replaceChild(this.firstChild, this), e.normalize()
}).end()
}, jQuery.fn.highlight = function (e, t) {
var n = {
className: "highlight",
element: "span",
caseSensitive: !1,
wordsOnly: !1
};
if (jQuery.extend(n, t), e.constructor === String && (e = [e]), e = jQuery.grep(e, function (e, t) {
return "" != e
}), 0 == (e = jQuery.map(e, function (e, t) {
return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
})).length) return this;
var i = n.caseSensitive ? "" : "i",
r = "(" + e.join("|") + ")";
n.wordsOnly && (r = "\\b" + r + "\\b");
var a = new RegExp(r, i);
return this.each(function () {
jQuery.highlight(this, a, n.element, n.className)
})
};
//GRAMMER WORDS
var GRAM_WORDS = [
'i',
'me',
'my',
'myself',
'we',
'our',
'ours',
'ourselves',
'you',
'your',
'yours',
'yourself',
'yourselves',
'he',
'him',
'his',
'himself',
'she',
'her',
'hers',
'herself',
'it',
'its',
'itself',
'they',
'them',
'their',
'theirs',
'themselves',
'what',
'which',
'who',
'whom',
'this',
'that',
'these',
'those',
'am',
'is',
'are',
'was',
'were',
'be',
'been',
'being',
'have',
'has',
'had',
'having',
'do',
'does',
'did',
'doing',
'a',
'an',
'the',
'and',
'but',
'if',
'or',
'because',
'as',
'until',
'while',
'of',
'at',
'by',
'for',
'with',
'about',
'against',
'between',
'into',
'through',
'during',
'before',
'after',
'above',
'below',
'to',
'from',
'up',
'down',
'in',
'out',
'on',
'off',
'over',
'under',
'again',
'further',
'then',
'once',
'here',
'there',
'when',
'where',
'why',
'how',
'all',
'any',
'both',
'each',
'few',
'more',
'most',
'other',
'some',
'such',
'no',
'nor',
'not',
'only',
'own',
'same',
'so',
'than',
'too',
'very',
's',
't',
'can',
'will',
'just',
'don',
'should',
'now',
];
/*automatic question ends here*/
var apiUrlDailyStats = 'https://api.rootnet.in/covid19-in/stats/daily';
ajaxDailyStats = $.ajax({
type: "GET",
url: apiUrlDailyStats,
dataType: "json",
success: function (result) {
getDoublingSeries(getCopyOfJSONObject(result.data));
generateStateList(getCopyOfJSONObject(result.data[result.data.length - 1]));
casesData = getCopyOfJSONObject(result.data);
}
});
function getDoublingSeries(data) {
console.log("doubling data", data);
var allData = [];
var todayLatestCases = parseInt(data[data.length - 1].summary.total) - parseInt(data[data.length - 2].summary.total);
var yesterDayCases = parseInt(data[data.length - 2].summary.total);
if(todayLatestCases == 0){
$("#doublingData").hide();
$("#noDoublingData").show();
}else{
$("#noDoublingData").hide();
$("#doublingData").show();
}
var r = todayLatestCases / yesterDayCases;
//console.log("value of r is",r);
for (var i = 2; i <= 5; i++) {
var double = (Math.log(i) / Math.log(1 + r));
$("#tile"+i).html(Math.round(double));
}
[todayStateData, yesterdayStateData] = generateStateData(data);
}
function calculateDoubling(state){
if(state == "All States"){
getDoublingSeries(casesData);
return;
}
var todayData = todayStateData[state];
var yesterdayData = yesterdayStateData[state];
var todayLatestCases = parseInt(todayData)-parseInt(yesterdayData);
var yesterDayCases = parseInt(yesterdayData);
if(todayLatestCases == 0){
$("#doublingData").hide();
$("#noDoublingData").show();
}else{
$("#noDoublingData").hide();
$("#doublingData").show();
}
var r = todayLatestCases / yesterDayCases;
//console.log("value of r is",r);
for (var i = 2; i <= 5; i++) {
var double = (Math.log(i) / Math.log(1 + r));
$("#tile"+i).html(Math.round(double));
}
}
function generateStateData(data) {
var todayAllData = data[data.length - 1];
var todayStateData = [];
var yesterdayAllData = data[data.length - 2];
var yesterdayStateData = [];
for (var i = 0; i < todayAllData.regional.length; i++) {
var state = todayAllData.regional[i].loc;;
let data1 = todayAllData.regional[i];
todayStateData[state] = getSumOfTheObjectKeys(data1);
}
for (var i = 0; i < yesterdayAllData.regional.length; i++) {
var state = yesterdayAllData.regional[i].loc;;
var data1 = yesterdayAllData.regional[i];
yesterdayStateData[state] = getSumOfTheObjectKeys(data1)
}
console.log("today list", todayStateData);
console.log("yesterday list", yesterdayStateData);
return [todayStateData, yesterdayStateData];
}
function getSumOfTheObjectKeys(localData) {
var keys = Object.keys(localData);
var total = 0;
total = localData.confirmedCasesIndian + localData.confirmedCasesForeign;
return total;
}
//deep copy
function getCopyOfJSONObject(data) {
return JSON.parse(JSON.stringify(data));
}
function generateStateList(data) {
var stateList = [];
$("#stateList").find('option').remove();
$('<option/>', { value: "All States" }).text("All States").appendTo('#stateList');
for (var i = 0; i < data.regional.length; i++) {
var state = data.regional[i].loc;
stateList.push(state);
$('<option/>', { value: state }).text(state).appendTo('#stateList');
}
}
</script>
<div id="commonfile"></div>
</body>
</html>