readding batch code table
This commit is contained in:
79
docs/BatchCodeTableInitializer.js
Normal file
79
docs/BatchCodeTableInitializer.js
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
class BatchCodeTableInitializer {
|
||||||
|
|
||||||
|
#batchCodeTableElement;
|
||||||
|
|
||||||
|
constructor(batchCodeTableElement) {
|
||||||
|
this.#batchCodeTableElement = batchCodeTableElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
initialize() {
|
||||||
|
const clazz = this;
|
||||||
|
this.#batchCodeTableElement.DataTable(
|
||||||
|
{
|
||||||
|
ajax: 'data/batchCodeTables/Global.json',
|
||||||
|
initComplete: function (settings) {
|
||||||
|
batchCodeTable = settings.oInstance.api();
|
||||||
|
const columnSearch = new ColumnSearch(batchCodeTable.column(clazz.#getColumnIndex('Company')));
|
||||||
|
columnSearch.columnContentUpdated();
|
||||||
|
},
|
||||||
|
language:
|
||||||
|
{
|
||||||
|
searchPlaceholder: "Enter Batch Code"
|
||||||
|
},
|
||||||
|
searching: true,
|
||||||
|
search:
|
||||||
|
{
|
||||||
|
return: true
|
||||||
|
},
|
||||||
|
processing: true,
|
||||||
|
deferRender: true,
|
||||||
|
order: [[this.#getColumnIndex('Adverse Reaction Reports'), "desc"]],
|
||||||
|
columnDefs:
|
||||||
|
[
|
||||||
|
{
|
||||||
|
searchable: false,
|
||||||
|
targets: [
|
||||||
|
this.#getColumnIndex('Adverse Reaction Reports'),
|
||||||
|
this.#getColumnIndex('Deaths'),
|
||||||
|
this.#getColumnIndex('Disabilities'),
|
||||||
|
this.#getColumnIndex('Life Threatening Illnesses'),
|
||||||
|
this.#getColumnIndex('Severe reports'),
|
||||||
|
this.#getColumnIndex('Lethality')
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
orderable: false,
|
||||||
|
targets: [this.#getColumnIndex('Batch'), this.#getColumnIndex('Company')]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
render: (data, type, row) => {
|
||||||
|
const numberInPercent = parseFloat(data);
|
||||||
|
return !isNaN(numberInPercent) ? numberInPercent.toFixed(2) + " %" : '';
|
||||||
|
},
|
||||||
|
targets: [this.#getColumnIndex('Severe reports'), this.#getColumnIndex('Lethality')]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#getColumnIndex(columnName) {
|
||||||
|
switch (columnName) {
|
||||||
|
case 'Batch':
|
||||||
|
return 0;
|
||||||
|
case 'Adverse Reaction Reports':
|
||||||
|
return 1;
|
||||||
|
case 'Deaths':
|
||||||
|
return 2;
|
||||||
|
case 'Disabilities':
|
||||||
|
return 3;
|
||||||
|
case 'Life Threatening Illnesses':
|
||||||
|
return 4;
|
||||||
|
case 'Company':
|
||||||
|
return 5;
|
||||||
|
case 'Severe reports':
|
||||||
|
return 6;
|
||||||
|
case 'Lethality':
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
docs/ColumnSearch.js
Normal file
35
docs/ColumnSearch.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// adapted from https://datatables.net/examples/api/multi_filter_select.html
|
||||||
|
class ColumnSearch {
|
||||||
|
|
||||||
|
#column;
|
||||||
|
#select;
|
||||||
|
|
||||||
|
constructor(column) {
|
||||||
|
this.#column = column;
|
||||||
|
const clazz = this;
|
||||||
|
$('<br/>').appendTo($(this.#column.header()));
|
||||||
|
this.#select = $('<select></select>')
|
||||||
|
.appendTo($(this.#column.header()))
|
||||||
|
.on(
|
||||||
|
'change',
|
||||||
|
function () {
|
||||||
|
const val = $.fn.dataTable.util.escapeRegex($(this).val());
|
||||||
|
clazz.#column
|
||||||
|
.search(val ? '^' + val + '$' : '', true, false)
|
||||||
|
.draw();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
columnContentUpdated() {
|
||||||
|
this.#select.empty();
|
||||||
|
this.#select.append('<option value=""></option>');
|
||||||
|
const clazz = this;
|
||||||
|
this.#column
|
||||||
|
.data()
|
||||||
|
.unique()
|
||||||
|
.sort()
|
||||||
|
.each(function (d, _) {
|
||||||
|
clazz.#select.append('<option value="' + d + '">' + d + '</option>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
9112
docs/HowBadIsMyBatch.html
Normal file
9112
docs/HowBadIsMyBatch.html
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,7 @@
|
|||||||
|
.dataTables_filter {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.chartWithSlider {
|
.chartWithSlider {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
76
docs/batchCodes.html
Normal file
76
docs/batchCodes.html
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||||
|
<title>Batch Codes of Coronavirus 2019 Vaccines</title>
|
||||||
|
<!-- Google tag (gtag.js) -->
|
||||||
|
<script async="" src="https://www.googletagmanager.com/gtag/js?id=G-ERHYDH4P64"></script>
|
||||||
|
<script>
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag() { dataLayer.push(arguments); }
|
||||||
|
gtag('js', new Date());
|
||||||
|
|
||||||
|
gtag('config', 'G-ERHYDH4P64');
|
||||||
|
</script>
|
||||||
|
<link href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
|
||||||
|
<link href="batchCodeTable.css" rel="stylesheet" type="text/css" />
|
||||||
|
<link href="forkMeOnGitHub.css" rel="stylesheet" type="text/css" />
|
||||||
|
<script crossorigin="anonymous"
|
||||||
|
integrity="sha512-T5Bneq9hePRO8JR0S/0lQ7gdW+ceLThvC80UjwkMRz+8q+4DARVZ4dqKoyENC7FcYresjfJ6ubaOgIE35irf4w=="
|
||||||
|
referrerpolicy="no-referrer"
|
||||||
|
src="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/15.5.1/nouislider.min.js"></script>
|
||||||
|
<link crossorigin="anonymous" href="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/15.5.1/nouislider.css"
|
||||||
|
integrity="sha512-MKxcSu/LDtbIYHBNAWUQwfB3iVoG9xeMCm32QV5hZ/9lFaQZJVaXfz9aFa0IZExWzCpm7OWvp9zq9gVip/nLMg=="
|
||||||
|
referrerpolicy="no-referrer" rel="stylesheet" />
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||||
|
<script charset="utf8" src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js"
|
||||||
|
type="text/javascript"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.2.0/dist/chart.umd.min.js"></script>
|
||||||
|
<script src="./Utils.js"></script>
|
||||||
|
<script src="./UIUtils.js"></script>
|
||||||
|
<script src="./ColumnSearch.js"></script>
|
||||||
|
<script src="./BatchCodeTableInitializer.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
const batchCodeTableInitializer = new BatchCodeTableInitializer($('#batchCodeTable'));
|
||||||
|
batchCodeTableInitializer.initialize();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Batch Codes of Coronavirus 2019 Vaccines</h1>
|
||||||
|
<table class="display" id="batchCodeTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Batch</th>
|
||||||
|
<th>Adverse Reaction Reports</th>
|
||||||
|
<th>Deaths</th>
|
||||||
|
<th>Disabilities</th>
|
||||||
|
<th>Life Threatening Illnesses</th>
|
||||||
|
<th>Company</th>
|
||||||
|
<th>Severe reports</th>
|
||||||
|
<th>Lethality</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
<footer>
|
||||||
|
<dl>
|
||||||
|
<dt>Data Source:</dt>
|
||||||
|
<dd><a href="https://vaers.hhs.gov/data/datasets.html" target="_blank">Vaccine Adverse Event Reporting System
|
||||||
|
(VAERS)</a></dd>
|
||||||
|
<dt>Last updated:</dt>
|
||||||
|
<dd id="last_updated">April 21, 2023</dd>
|
||||||
|
</dl>
|
||||||
|
<span id="forkongithub"><a href="https://github.com/KnollFrank/HowBadIsMyBatch" target="_blank">Fork me on
|
||||||
|
GitHub</a></span>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</footer>
|
||||||
|
<template id="template-canvas">
|
||||||
|
<canvas></canvas>
|
||||||
|
</template>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -8,7 +8,7 @@ from DateProvider import DateProvider
|
|||||||
def updateBatchCodeTableHtmlFile(batchCodeTable, batchCodeTableHtmlFile):
|
def updateBatchCodeTableHtmlFile(batchCodeTable, batchCodeTableHtmlFile):
|
||||||
batchcodeOptions = getBatchcodeOptions(getBatchcodes(batchCodeTable.sort_values(by = 'Adverse Reaction Reports', ascending = False)))
|
batchcodeOptions = getBatchcodeOptions(getBatchcodes(batchCodeTable.sort_values(by = 'Adverse Reaction Reports', ascending = False)))
|
||||||
_saveBatchcodeOptions(batchcodeOptions, batchCodeTableHtmlFile)
|
_saveBatchcodeOptions(batchcodeOptions, batchCodeTableHtmlFile)
|
||||||
_saveLastUpdatedBatchCodeTable(
|
saveLastUpdatedBatchCodeTable(
|
||||||
DateProvider().getLastUpdatedDataSource(),
|
DateProvider().getLastUpdatedDataSource(),
|
||||||
batchCodeTableHtmlFile)
|
batchCodeTableHtmlFile)
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ def _saveBatchcodeOptions(batchcodeOptions, batchCodeTableHtmlFile):
|
|||||||
options=batchcodeOptions),
|
options=batchcodeOptions),
|
||||||
'lxml'))
|
'lxml'))
|
||||||
|
|
||||||
def _saveLastUpdatedBatchCodeTable(lastUpdated, batchCodeTableHtmlFile):
|
def saveLastUpdatedBatchCodeTable(lastUpdated, batchCodeTableHtmlFile):
|
||||||
def setLastUpdated(soup):
|
def setLastUpdated(soup):
|
||||||
soup.find(id="last_updated").string.replace_with(
|
soup.find(id="last_updated").string.replace_with(
|
||||||
lastUpdated.strftime(DateProvider.DATE_FORMAT))
|
lastUpdated.strftime(DateProvider.DATE_FORMAT))
|
||||||
|
|||||||
@@ -13,11 +13,12 @@
|
|||||||
"pd.set_option('display.max_columns', None)\n",
|
"pd.set_option('display.max_columns', None)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"import os\n",
|
"import os\n",
|
||||||
|
"from IOUtils import IOUtils\n",
|
||||||
"from VAERSFileDownloader import updateVAERSFiles\n",
|
"from VAERSFileDownloader import updateVAERSFiles\n",
|
||||||
"from datetime import datetime\n",
|
"from datetime import datetime\n",
|
||||||
"from DateProvider import DateProvider\n",
|
"from DateProvider import DateProvider\n",
|
||||||
"from InternationalVaersCovid19Provider import getInternationalVaersCovid19, get_international_VAERSVAX_VAERSSYMPTOMS_Covid19\n",
|
"from InternationalVaersCovid19Provider import getInternationalVaersCovid19, get_international_VAERSVAX_VAERSSYMPTOMS_Covid19\n",
|
||||||
"from BatchCodeTableHtmlUpdater import updateBatchCodeTableHtmlFile\n",
|
"from BatchCodeTableHtmlUpdater import updateBatchCodeTableHtmlFile, saveLastUpdatedBatchCodeTable\n",
|
||||||
"from BatchCodeTablePersister import createGlobalBatchCodeTable\n",
|
"from BatchCodeTablePersister import createGlobalBatchCodeTable\n",
|
||||||
"from SymptomByBatchcodeTableFactory import SymptomByBatchcodeTableFactory\n",
|
"from SymptomByBatchcodeTableFactory import SymptomByBatchcodeTableFactory\n",
|
||||||
"from HistogramFactoryAndPersister import createAndSaveGlobalHistograms\n",
|
"from HistogramFactoryAndPersister import createAndSaveGlobalHistograms\n",
|
||||||
@@ -126,6 +127,19 @@
|
|||||||
"batchCodeTable"
|
"batchCodeTable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "d8e81ffc",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"IOUtils.saveDataFrameAsJson(batchCodeTable, '../docs/data/batchCodeTables/Global.json')\n",
|
||||||
|
"saveLastUpdatedBatchCodeTable(\n",
|
||||||
|
" DateProvider().getLastUpdatedDataSource(),\n",
|
||||||
|
" batchCodeTableHtmlFile=\"../docs/batchCodes.html\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
@@ -133,7 +147,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"updateBatchCodeTableHtmlFile(batchCodeTable, batchCodeTableHtmlFile=\"../docs/batchCodeTable.html\")"
|
"updateBatchCodeTableHtmlFile(batchCodeTable, batchCodeTableHtmlFile=\"../docs/HowBadIsMyBatch.html\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user