refactoring
This commit is contained in:
15
src/BatchCodeTablePersister.py
Normal file
15
src/BatchCodeTablePersister.py
Normal 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)
|
||||
Reference in New Issue
Block a user