adding summary column

This commit is contained in:
frankknoll
2023-03-10 22:06:14 +01:00
parent bc03ef5277
commit e3c6785513
4 changed files with 59 additions and 18 deletions

View File

@@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Vaccine Distribution by Zipcode</title>
<title>Pfizer Vaccine Distribution by ZIP Code</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" />
@@ -28,16 +28,14 @@
<body>
<span id="forkongithub"><a href="https://github.com/KnollFrank/HowBadIsMyBatch">Fork me on GitHub</a></span>
<h1>Vaccine Distribution by Zipcode</h1>
<h1>Pfizer Vaccine Distribution by ZIP Code</h1>
<table class="display" id="vaccineDistributionByZipcodeTable">
<thead>
<tr>
<th>PROVIDER_NAME</th>
<th>ZIPCODE_SHP</th>
<th>LOT_NUMBER</th>
<th>DOSES_SHIPPED</th>
<th>OVERALL_DOSES_SHIPPED</th>
<th>Adverse Reaction Reports</th>
<th>Provider</th>
<th>ZIP Code</th>
<th>Lot Number</th>
<th>Summary</th>
</tr>
</thead>
</table>

View File

@@ -25,14 +25,15 @@ class VaccineDistributionByZipcodeTableInitializer {
[
{
searchable: false,
targets: [this.#getColumnIndex('DOSES_SHIPPED')]
orderable: false,
targets: [this.#getColumnIndex('Summary')]
},
{
searchable: true,
targets: [
this.#getColumnIndex('PROVIDER_NAME'),
this.#getColumnIndex('ZIPCODE_SHP'),
this.#getColumnIndex('LOT_NUMBER'),
this.#getColumnIndex('Provider'),
this.#getColumnIndex('ZIP Code'),
this.#getColumnIndex('Lot Number'),
]
},
]
@@ -41,13 +42,13 @@ class VaccineDistributionByZipcodeTableInitializer {
#getColumnIndex(columnName) {
switch (columnName) {
case 'PROVIDER_NAME':
case 'Provider':
return 0;
case 'ZIPCODE_SHP':
case 'ZIP Code':
return 1;
case 'LOT_NUMBER':
case 'Lot Number':
return 2;
case 'DOSES_SHIPPED':
case 'Summary':
return 3;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -250,6 +250,48 @@
"vaccineDistributionByZipcode"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3276cce7",
"metadata": {},
"outputs": [],
"source": [
"def summarize(row):\n",
" ADRs = row['DOSES_SHIPPED'] / row['OVERALL_DOSES_SHIPPED'] * row['Adverse Reaction Reports']\n",
" return f\"{row['DOSES_SHIPPED']} (out of {row['OVERALL_DOSES_SHIPPED']}) shipped doses are statistically responsible for <b>{ADRs:.2f}</b> (out of {row['Adverse Reaction Reports']}) adverse reaction reports\"\n",
"\n",
"vaccineDistributionByZipcode['Summary'] = vaccineDistributionByZipcode.apply(summarize, axis = 'columns')\n",
"vaccineDistributionByZipcode"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10cf731f",
"metadata": {},
"outputs": [],
"source": [
"vaccineDistributionByZipcode = vaccineDistributionByZipcode[['PROVIDER_NAME', 'ZIPCODE_SHP', 'LOT_NUMBER', 'Summary']]\n",
"vaccineDistributionByZipcode"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0c2020e9",
"metadata": {},
"outputs": [],
"source": [
"vaccineDistributionByZipcode = vaccineDistributionByZipcode.rename(\n",
" columns = {\n",
" 'PROVIDER_NAME': 'Provider',\n",
" 'ZIPCODE_SHP': 'ZIP Code',\n",
" 'LOT_NUMBER': 'Lot Number'\n",
" })\n",
"vaccineDistributionByZipcode"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -257,7 +299,7 @@
"metadata": {},
"outputs": [],
"source": [
"vaccineDistributionByZipcode.to_excel('tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823_sumDoses.xlsx')"
"# vaccineDistributionByZipcode.to_excel('tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823_sumDoses.xlsx')"
]
},
{