combining batch code tables of all companies

This commit is contained in:
frankknoll
2022-02-12 21:06:49 +01:00
parent e7ae087108
commit 732c273095
7 changed files with 24 additions and 105 deletions

View File

@@ -4,7 +4,7 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>batch codes</title>
<title>Batch codes</title>
<!-- FK-TODO: keine externen Links -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="batchCodeTable.css">
@@ -15,31 +15,13 @@
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.min.js"></script>
<script>
function getSearchParams() {
const searchParams = new URLSearchParams(window.location.search);
return {
company: searchParams.get('company'),
companyName: searchParams.get('companyName'),
title: searchParams.get('title')
};
}
function replaceCssClassesWithStrs({ title, companyName }) {
replaceCssClassWithStr(".title", title);
replaceCssClassWithStr(".companyName", companyName);
}
function replaceCssClassWithStr(cssClass, str) {
document.querySelectorAll(cssClass).forEach(element => element.textContent = str);
}
function loadBatchCodeTable(file, searchPlaceholder) {
function loadBatchCodeTable() {
$('#batchCodeTable').DataTable(
{
ajax: file,
ajax: "data/batchCodeTable.json",
language:
{
searchPlaceholder: searchPlaceholder
searchPlaceholder: "Enter Batch Code"
},
search:
{
@@ -52,26 +34,23 @@
[
{
searchable: false,
targets: [1, 2, 3, 4]
targets: [1, 2, 3, 4, 5]
}
]
});
}
$(document).ready(function () {
const { company, companyName, title } = getSearchParams();
document.title = title;
replaceCssClassesWithStrs({ title, companyName });
loadBatchCodeTable("data/" + company + ".json", "Enter " + companyName + " Batch Code");
loadBatchCodeTable();
});
</script>
</head>
<body>
<span id="forkongithub"><a href="https://github.com/KnollFrank/HowBadIsMyBatch">Fork me on GitHub</a></span>
<h1 class="title"></h1>
<h1>Batch codes</h1>
<p>
<b>Check out your <span class="companyName"></span> batch code </b>&emsp;<font size="-2">(last updated 11th February
<b>Check out your batch code </b>&emsp;<font size="-2">(last updated 11th February
2022)</font>
<table class="display" id="batchCodeTable">
<thead>
@@ -81,6 +60,7 @@
<th>DEATHS</th>
<th>DISABILITIES</th>
<th>LIFE THREATENING ILLNESSES</th>
<th>COMPANY</th>
</tr>
</thead>
</table>

1
data/batchCodeTable.json Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,23 +1,11 @@
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>How Bad is My Batch</title>
<link rel="stylesheet" type="text/css" href="forkMeOnGitHub.css">
<meta http-equiv="refresh" content="0; url=batchCodeTable.html" />
</head>
<body>
<span id="forkongithub"><a href="https://github.com/KnollFrank/HowBadIsMyBatch">Fork me on GitHub</a></span>
<h1>How Bad is My Batch</h1>
<p>
<ul>
<li><a href="batchCodeTable.html?company=moderna&companyName=Moderna&title=Moderna">Moderna</a></li>
<li><a href="batchCodeTable.html?company=pfizer&companyName=Pfizer&title=Pfizer">Pfizer</a></li>
<li><a href="batchCodeTable.html?company=janssen&companyName=Janssen&title=Janssen">Janssen</a></li>
</ul>
</p>
</body>
</html>

View File

@@ -228,10 +228,10 @@
"class BatchCodeTableFactory:\n",
"\n",
" @staticmethod\n",
" def createBatchCodeTable(dataFrame : pd.DataFrame, manufacturer, dose):\n",
" def createBatchCodeTable(dataFrame : pd.DataFrame, dose):\n",
" dataFrame = DataFrameFilter().filterByCovid19(dataFrame)\n",
" dataFrame = DataFrameFilter().filterBy(dataFrame, manufacturer = manufacturer, dose = dose)\n",
" return BatchCodeTableFactory._createSummationTableByVAX_LOT(dataFrame)[['ADRs', 'DEATHS', 'DISABILITIES', 'LIFE THREATENING ILLNESSES']]\n",
" dataFrame = DataFrameFilter().filterBy(dataFrame, dose = dose)\n",
" return BatchCodeTableFactory._createSummationTableByVAX_LOT(dataFrame)[['ADRs', 'DEATHS', 'DISABILITIES', 'LIFE THREATENING ILLNESSES', 'COMPANY']]\n",
"\n",
" # create table from https://www.howbadismybatch.com/combined.html\n",
" @staticmethod\n",
@@ -740,17 +740,17 @@
" dtypes = {'VAX_DOSE_SERIES': \"string\"})\n",
" }\n",
" ])\n",
" self._test_createBatchCodeTable(dataFrame, \"MODERNA\", '1')\n",
" self._test_createBatchCodeTable(dataFrame, '1')\n",
"\n",
" def test_createBatchCodeTable(self):\n",
" dataFrame = VaersDescr2DataFrameConverter.createDataFrameFromDescrs(\n",
" VaersDescrReader(dataDir = \"test/VAERS\").readAllVaersDescrs())\n",
" DataFrameNormalizer.normalize(dataFrame)\n",
" self._test_createBatchCodeTable(dataFrame, \"MODERNA\", '1')\n",
" self._test_createBatchCodeTable(dataFrame, '1')\n",
"\n",
" def _test_createBatchCodeTable(self, dataFrame, manufacturer, dose):\n",
" def _test_createBatchCodeTable(self, dataFrame, dose):\n",
" # When\n",
" batchCodeTable = BatchCodeTableFactory.createBatchCodeTable(dataFrame, manufacturer, dose)\n",
" batchCodeTable = BatchCodeTableFactory.createBatchCodeTable(dataFrame, dose)\n",
"\n",
" # Then\n",
" batchCodeTableExpected = pd.DataFrame(\n",
@@ -758,7 +758,8 @@
" 'ADRs': [2, 1],\n",
" 'DEATHS': [0, 1],\n",
" 'DISABILITIES': [2, 0],\n",
" 'LIFE THREATENING ILLNESSES': [0, 0]\n",
" 'LIFE THREATENING ILLNESSES': [0, 0],\n",
" 'COMPANY': ['MODERNA', 'MODERNA']\n",
" },\n",
" index = pd.Index(['025L20A', '037K20A'], name = 'VAX_LOT'))\n",
" assert_frame_equal(batchCodeTable, batchCodeTableExpected, check_dtype = False)\n"
@@ -961,8 +962,8 @@
"metadata": {},
"outputs": [],
"source": [
"def saveBatchCodeTable(vaers, manufacturer, file):\n",
" batchCodeTable = BatchCodeTableFactory.createBatchCodeTable(vaers, manufacturer = manufacturer, dose = '1')\n",
"def saveBatchCodeTable(vaers, file):\n",
" batchCodeTable = BatchCodeTableFactory.createBatchCodeTable(vaers, dose = '1')\n",
" display(batchCodeTable)\n",
" IOUtils.saveDataFrame(batchCodeTable, file)"
]
@@ -997,22 +998,12 @@
"internationalVaers = getInternationalVaers()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f74475e8",
"metadata": {},
"outputs": [],
"source": [
"internationalVaers"
]
},
{
"cell_type": "markdown",
"id": "987a04d1",
"metadata": {},
"source": [
"### Moderna batch codes"
"### Batch codes"
]
},
{
@@ -1023,45 +1014,7 @@
"outputs": [],
"source": [
"# https://www.howbadismybatch.com/moderna.html\n",
"saveBatchCodeTable(internationalVaers, \"MODERNA\", \"../data/moderna\")"
]
},
{
"cell_type": "markdown",
"id": "29dd4daa",
"metadata": {},
"source": [
"### Pfizer batch codes"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6121e2b3",
"metadata": {},
"outputs": [],
"source": [
"# https://www.howbadismybatch.com/pfizer.html\n",
"saveBatchCodeTable(internationalVaers, \"PFIZER\\BIONTECH\", \"../data/pfizer\")"
]
},
{
"cell_type": "markdown",
"id": "7e83a551",
"metadata": {},
"source": [
"### Janssen batch codes"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1a64eef5",
"metadata": {},
"outputs": [],
"source": [
"# https://www.howbadismybatch.com/janssen.html\n",
"saveBatchCodeTable(internationalVaers, \"JANSSEN\", \"../data/janssen\")"
"saveBatchCodeTable(internationalVaers, \"../data/batchCodeTable\")"
]
},
{