refactoring
This commit is contained in:
@@ -1464,8 +1464,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def createAndSaveAndDisplayBatchCodeTableByCountry(internationalLotTableFactory, country, minADRsForLethality = None):\n",
|
||||
" batchCodeTable = internationalLotTableFactory.createBatchCodeTableByCountry(country)\n",
|
||||
"def createAndSaveAndDisplayBatchCodeTableByCountry(createBatchCodeTable, country, minADRsForLethality = None):\n",
|
||||
" batchCodeTable = createBatchCodeTable(country)\n",
|
||||
" batchCodeTable.index.set_names(\"Batch\", inplace = True)\n",
|
||||
" if minADRsForLethality is not None:\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",
|
||||
" internationalLotTableFactory = InternationalLotTableFactory(vaers)\n",
|
||||
" for country in countries:\n",
|
||||
" createAndSaveAndDisplayBatchCodeTableByCountry(internationalLotTableFactory, country, minADRsForLethality)"
|
||||
" createAndSaveAndDisplayBatchCodeTableByCountry(lambda country: internationalLotTableFactory.createBatchCodeTableByCountry(country), country, minADRsForLethality)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1533,8 +1533,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"internationalLotTableFactory = InternationalLotTableFactory(internationalVaers)\n",
|
||||
"globalBatchCodeTable = internationalLotTableFactory.createGlobalBatchCodeTable()"
|
||||
"globalBatchCodeTable = InternationalLotTableFactory(internationalVaers).createGlobalBatchCodeTable()\n",
|
||||
"globalBatchCodeTable"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1544,13 +1544,10 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
" # FK-TODO: DRY with createAndSaveAndDisplayBatchCodeTableByCountry()\n",
|
||||
" minADRsForLethality = 100\n",
|
||||
" globalBatchCodeTable.index.set_names(\"Batch\", inplace = True)\n",
|
||||
" if minADRsForLethality is not None:\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"
|
||||
"createAndSaveAndDisplayBatchCodeTableByCountry(\n",
|
||||
" createBatchCodeTable = lambda country: globalBatchCodeTable,\n",
|
||||
" country = 'Global',\n",
|
||||
" minADRsForLethality = 100)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user