starting VaccineDistributionByZipcode

This commit is contained in:
frankknoll
2023-03-08 21:41:56 +01:00
parent f5a260b0d2
commit c1c5df5d8d
6 changed files with 240 additions and 11 deletions

View File

@@ -0,0 +1,50 @@
<!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>
<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 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="./Utils.js"></script>
<script src="./UIUtils.js"></script>
<script src="./VaccineDistributionByZipcodeTableInitializer.js"></script>
<script>
$(document).ready(function () {
const tableInitializer =
new VaccineDistributionByZipcodeTableInitializer(
{
tableElement: $('#vaccineDistributionByZipcodeTable')
});
tableInitializer.initialize();
});
</script>
</head>
<body>
<span id="forkongithub"><a href="https://github.com/KnollFrank/HowBadIsMyBatch">Fork me on GitHub</a></span>
<h1>Batch Codes of Coronavirus 2019 Vaccines</h1>
<table class="display" id="vaccineDistributionByZipcodeTable">
<thead>
<tr>
<th>PROVIDER_NAME</th>
<th>ZIPCODE_SHP</th>
<th>LOT_NUMBER</th>
<th>DOSES_SHIPPED</th>
</tr>
</thead>
</table>
<p><b>Data Sources:</b>
<a href="https://vaers.hhs.gov/data/datasets.html" target="_blank">Vaccine Adverse Event Reporting System
(VAERS)</a> and
<a href="https://icandecide.org/wp-content/uploads/2022/09/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823.xlsx"
target="_blank">Vaccine Distribution by Zipcode</a>
</p>
</body>
</html>

View File

@@ -0,0 +1,81 @@
class VaccineDistributionByZipcodeTableInitializer {
#tableElement;
#table;
constructor({ tableElement }) {
this.#tableElement = tableElement;
}
initialize() {
this.#table = this.#createEmptyTable();
this.#loadDataIntoTable();
}
#createEmptyTable() {
return this.#tableElement.DataTable(
{
language:
{
searchPlaceholder: "Enter Batch Code"
},
search:
{
return: false
},
processing: true,
deferRender: true,
columnDefs:
[
{
searchable: false,
targets: [this.#getColumnIndex('DOSES_SHIPPED')]
},
{
searchable: true,
targets: [
this.#getColumnIndex('PROVIDER_NAME'),
this.#getColumnIndex('ZIPCODE_SHP'),
this.#getColumnIndex('LOT_NUMBER'),
]
},
]
});
}
#getColumnIndex(columnName) {
switch (columnName) {
case 'PROVIDER_NAME':
return 0;
case 'ZIPCODE_SHP':
return 1;
case 'LOT_NUMBER':
return 2;
case 'DOSES_SHIPPED':
return 3;
}
}
#loadDataIntoTable() {
// FK-TODO: show "Loading.." message or spinning wheel.
fetch('data/vaccineDistributionByZipcode/VaccineDistributionByZipcode.json')
.then(response => response.json())
.then(json => {
this.#setTableRows(json.data);
this.#selectInput();
});
}
#setTableRows(rows) {
this.#table
.clear()
.rows.add(rows)
.draw();
}
#selectInput() {
const input = document.querySelector(".dataTables_filter input");
input.focus();
input.select();
}
}

File diff suppressed because one or more lines are too long