refactoring
This commit is contained in:
@@ -1464,8 +1464,8 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def createAndSaveAndDisplayBatchCodeTableByCountry(internationalLotTableFactory, country, minADRsForLethality = None):\n",
|
"def createAndSaveAndDisplayBatchCodeTableByCountry(createBatchCodeTable, country, minADRsForLethality = None):\n",
|
||||||
" batchCodeTable = internationalLotTableFactory.createBatchCodeTableByCountry(country)\n",
|
" batchCodeTable = createBatchCodeTable(country)\n",
|
||||||
" batchCodeTable.index.set_names(\"Batch\", inplace = True)\n",
|
" batchCodeTable.index.set_names(\"Batch\", inplace = True)\n",
|
||||||
" if minADRsForLethality is not None:\n",
|
" if minADRsForLethality is not None:\n",
|
||||||
" batchCodeTable.loc[batchCodeTable['Adverse Reaction Reports'] < minADRsForLethality, ['Severe reports', 'Lethality']] = [np.nan, np.nan]\n",
|
" batchCodeTable.loc[batchCodeTable['Adverse Reaction Reports'] < minADRsForLethality, ['Severe reports', 'Lethality']] = [np.nan, np.nan]\n",
|
||||||
@@ -1475,7 +1475,7 @@
|
|||||||
"def createAndSaveAndDisplayBatchCodeTablesByCountry(vaers, countries, minADRsForLethality = None):\n",
|
"def createAndSaveAndDisplayBatchCodeTablesByCountry(vaers, countries, minADRsForLethality = None):\n",
|
||||||
" internationalLotTableFactory = InternationalLotTableFactory(vaers)\n",
|
" internationalLotTableFactory = InternationalLotTableFactory(vaers)\n",
|
||||||
" for country in countries:\n",
|
" for country in countries:\n",
|
||||||
" createAndSaveAndDisplayBatchCodeTableByCountry(internationalLotTableFactory, country, minADRsForLethality)"
|
" createAndSaveAndDisplayBatchCodeTableByCountry(lambda country: internationalLotTableFactory.createBatchCodeTableByCountry(country), country, minADRsForLethality)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1533,8 +1533,8 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"internationalLotTableFactory = InternationalLotTableFactory(internationalVaers)\n",
|
"globalBatchCodeTable = InternationalLotTableFactory(internationalVaers).createGlobalBatchCodeTable()\n",
|
||||||
"globalBatchCodeTable = internationalLotTableFactory.createGlobalBatchCodeTable()"
|
"globalBatchCodeTable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1544,13 +1544,10 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
" # FK-TODO: DRY with createAndSaveAndDisplayBatchCodeTableByCountry()\n",
|
"createAndSaveAndDisplayBatchCodeTableByCountry(\n",
|
||||||
" minADRsForLethality = 100\n",
|
" createBatchCodeTable = lambda country: globalBatchCodeTable,\n",
|
||||||
" globalBatchCodeTable.index.set_names(\"Batch\", inplace = True)\n",
|
" country = 'Global',\n",
|
||||||
" if minADRsForLethality is not None:\n",
|
" minADRsForLethality = 100)\n"
|
||||||
" globalBatchCodeTable.loc[globalBatchCodeTable['Adverse Reaction Reports'] < minADRsForLethality, ['Severe reports', 'Lethality']] = [np.nan, np.nan]\n",
|
|
||||||
" IOUtils.saveDataFrame(globalBatchCodeTable, '../docs/data/Global')\n",
|
|
||||||
" display('Global' + \":\", globalBatchCodeTable)\n"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user