starting VaccineDistributionByZipcode
This commit is contained in:
50
docs/VaccineDistributionByZipcode.html
Normal file
50
docs/VaccineDistributionByZipcode.html
Normal 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>
|
||||||
81
docs/VaccineDistributionByZipcodeTableInitializer.js
Normal file
81
docs/VaccineDistributionByZipcodeTableInitializer.js
Normal 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
@@ -42,9 +42,9 @@ def _createAndSaveBatchCodeTableForCountry(createBatchCodeTableForCountry, count
|
|||||||
'Severe reports',
|
'Severe reports',
|
||||||
'Lethality'
|
'Lethality'
|
||||||
]]
|
]]
|
||||||
IOUtils.saveDataFrame(
|
IOUtils.saveDataFrameAsJson(
|
||||||
batchCodeTable,
|
batchCodeTable,
|
||||||
'../docs/data/batchCodeTables/' + country)
|
'../docs/data/batchCodeTables/' + country + '.json')
|
||||||
onCountryProcessed(country)
|
onCountryProcessed(country)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,22 +3,16 @@ import json
|
|||||||
|
|
||||||
class IOUtils:
|
class IOUtils:
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def saveDataFrame(dataFrame, file):
|
|
||||||
# IOUtils.saveDataFrameAsExcelFile(dataFrame, file)
|
|
||||||
# IOUtils.saveDataFrameAsHtml(dataFrame, file)
|
|
||||||
IOUtils.saveDataFrameAsJson(dataFrame, file)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def saveDataFrameAsExcelFile(dataFrame, file):
|
def saveDataFrameAsExcelFile(dataFrame, file):
|
||||||
IOUtils.ensurePath(file)
|
IOUtils.ensurePath(file)
|
||||||
dataFrame.to_excel(file + '.xlsx')
|
dataFrame.to_excel(file)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def saveDataFrameAsHtml(dataFrame, file):
|
def saveDataFrameAsHtml(dataFrame, file):
|
||||||
IOUtils.ensurePath(file)
|
IOUtils.ensurePath(file)
|
||||||
dataFrame.to_html(
|
dataFrame.to_html(
|
||||||
file + '.html',
|
file,
|
||||||
index = False,
|
index = False,
|
||||||
table_id = 'batchCodeTable',
|
table_id = 'batchCodeTable',
|
||||||
classes = 'display',
|
classes = 'display',
|
||||||
@@ -29,7 +23,7 @@ class IOUtils:
|
|||||||
def saveDataFrameAsJson(dataFrame, file):
|
def saveDataFrameAsJson(dataFrame, file):
|
||||||
IOUtils.ensurePath(file)
|
IOUtils.ensurePath(file)
|
||||||
dataFrame.to_json(
|
dataFrame.to_json(
|
||||||
file + '.json',
|
file,
|
||||||
orient = "split",
|
orient = "split",
|
||||||
index = False)
|
index = False)
|
||||||
|
|
||||||
|
|||||||
103
src/VaccineDistributionByZipcode.ipynb
Normal file
103
src/VaccineDistributionByZipcode.ipynb
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import pandas as pd\n",
|
||||||
|
"\n",
|
||||||
|
"vaccineDistributionByZipcode = pd.read_excel('tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823_edited.xlsx')\n",
|
||||||
|
"vaccineDistributionByZipcode"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"len(vaccineDistributionByZipcode['PROVIDER_NAME'].unique())"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"len(vaccineDistributionByZipcode['ZIPCODE_SHP'].unique())"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"vaccineDistributionByZipcode['AWARDEE'].unique()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"vaccineDistributionByZipcode['STATE_SHP'].unique()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"vaccineDistributionByZipcode[vaccineDistributionByZipcode['ZIPCODE_SHP'] == '37801']"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"from IOUtils import IOUtils\n",
|
||||||
|
"\n",
|
||||||
|
"IOUtils.saveDataFrameAsJson(vaccineDistributionByZipcode, '../docs/data/vaccineDistributionByZipcode/VaccineDistributionByZipcode.json')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"IOUtils.saveDataFrameAsHtml(vaccineDistributionByZipcode, '../docs/data/vaccineDistributionByZipcode/VaccineDistributionByZipcode.html')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "howbadismybatch-venv-kernel",
|
||||||
|
"language": "python",
|
||||||
|
"name": "howbadismybatch-venv-kernel"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.10.8"
|
||||||
|
},
|
||||||
|
"orig_nbformat": 4
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user