combining batch code tables of all companies
This commit is contained in:
@@ -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\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user