refactoring

This commit is contained in:
frankknoll
2022-11-22 14:25:36 +01:00
parent e0a86efa96
commit 8d1f38dfb6
4 changed files with 51 additions and 77 deletions

View File

@@ -0,0 +1,15 @@
from IOUtils import IOUtils
import numpy as np
def createAndSaveBatchCodeTableForCountry(createBatchCodeTableForCountry, country, minADRsForLethality = None):
batchCodeTable = createBatchCodeTableForCountry(country)
batchCodeTable.index.set_names("Batch", inplace = True)
if minADRsForLethality is not None:
batchCodeTable.loc[batchCodeTable['Adverse Reaction Reports'] < minADRsForLethality, ['Severe reports', 'Lethality']] = [np.nan, np.nan]
IOUtils.saveDataFrame(batchCodeTable, '../docs/data/batchCodeTables/' + country)
# display(country + ":", batchCodeTable)
display(country)
def createAndSaveBatchCodeTablesForCountries(createBatchCodeTableForCountry, countries, minADRsForLethality = None):
for country in countries:
createAndSaveBatchCodeTableForCountry(createBatchCodeTableForCountry, country, minADRsForLethality)