Files
HowBadIsMyBatch/src/BatchCodeTablePersister.py
frankknoll 8d1f38dfb6 refactoring
2022-11-22 14:25:36 +01:00

15 lines
872 B
Python

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)