refactoring
This commit is contained in:
@@ -1464,18 +1464,17 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def createAndSaveAndDisplayBatchCodeTableByCountry(createBatchCodeTable, country, minADRsForLethality = None):\n",
|
"def createAndSaveBatchCodeTableForCountry(createBatchCodeTableForCountry, country, minADRsForLethality = None):\n",
|
||||||
" batchCodeTable = createBatchCodeTable(country)\n",
|
" batchCodeTable = createBatchCodeTableForCountry(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",
|
||||||
" IOUtils.saveDataFrame(batchCodeTable, '../docs/data/' + country)\n",
|
" IOUtils.saveDataFrame(batchCodeTable, '../docs/data/' + country)\n",
|
||||||
" display(country + \":\", batchCodeTable)\n",
|
" display(country + \":\", batchCodeTable)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def createAndSaveAndDisplayBatchCodeTablesByCountry(vaers, countries, minADRsForLethality = None):\n",
|
"def createAndSaveBatchCodeTablesForCountries(createBatchCodeTableForCountry, countries, minADRsForLethality = None):\n",
|
||||||
" internationalLotTableFactory = InternationalLotTableFactory(vaers)\n",
|
|
||||||
" for country in countries:\n",
|
" for country in countries:\n",
|
||||||
" createAndSaveAndDisplayBatchCodeTableByCountry(lambda country: internationalLotTableFactory.createBatchCodeTableByCountry(country), country, minADRsForLethality)"
|
" createAndSaveBatchCodeTableForCountry(createBatchCodeTableForCountry, country, minADRsForLethality)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1520,34 +1519,18 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"createAndSaveAndDisplayBatchCodeTablesByCountry(\n",
|
"minADRsForLethality = 100\n",
|
||||||
" internationalVaers,\n",
|
"internationalLotTableFactory = InternationalLotTableFactory(internationalVaers)\n",
|
||||||
" countries,\n",
|
"\n",
|
||||||
" minADRsForLethality = 100)"
|
"createAndSaveBatchCodeTablesForCountries(\n",
|
||||||
]
|
" createBatchCodeTableForCountry = lambda country: internationalLotTableFactory.createBatchCodeTableByCountry(country),\n",
|
||||||
},
|
" countries = countries,\n",
|
||||||
{
|
" minADRsForLethality = minADRsForLethality)\n",
|
||||||
"cell_type": "code",
|
"\n",
|
||||||
"execution_count": null,
|
"createAndSaveBatchCodeTableForCountry(\n",
|
||||||
"id": "106c0d91",
|
" createBatchCodeTableForCountry = lambda country: internationalLotTableFactory.createGlobalBatchCodeTable(),\n",
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"globalBatchCodeTable = InternationalLotTableFactory(internationalVaers).createGlobalBatchCodeTable()\n",
|
|
||||||
"globalBatchCodeTable"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "e75bd993",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"createAndSaveAndDisplayBatchCodeTableByCountry(\n",
|
|
||||||
" createBatchCodeTable = lambda country: globalBatchCodeTable,\n",
|
|
||||||
" country = 'Global',\n",
|
" country = 'Global',\n",
|
||||||
" minADRsForLethality = 100)\n"
|
" minADRsForLethality = minADRsForLethality)\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user