refactoring

This commit is contained in:
frankknoll
2023-04-03 00:39:00 +02:00
parent 53797cb3a0
commit c4beab12ee
2 changed files with 6 additions and 21 deletions

View File

@@ -2,19 +2,8 @@ from IOUtils import IOUtils
import numpy as np
def createAndSaveBatchCodeTables(
minADRsForLethality,
batchCodeTableFactory,
onCountryProcessed = lambda country: None):
_createAndSaveBatchCodeTableForCountry(
createBatchCodeTableForCountry = lambda country: batchCodeTableFactory.createGlobalBatchCodeTable(),
country = 'Global',
minADRsForLethality = minADRsForLethality,
onCountryProcessed = onCountryProcessed)
def _createAndSaveBatchCodeTableForCountry(createBatchCodeTableForCountry, country, minADRsForLethality, onCountryProcessed):
batchCodeTable = createBatchCodeTableForCountry(country)
def createAndSaveGlobalBatchCodeTable(minADRsForLethality, batchCodeTableFactory):
batchCodeTable = batchCodeTableFactory.createGlobalBatchCodeTable()
batchCodeTable.index.set_names("Batch", inplace=True)
if minADRsForLethality is not None:
batchCodeTable.loc[
@@ -33,7 +22,4 @@ def _createAndSaveBatchCodeTableForCountry(createBatchCodeTableForCountry, count
'Severe reports',
'Lethality'
]]
IOUtils.saveDataFrameAsJson(
batchCodeTable,
'../docs/data/batchCodeTables/' + country + '.json')
onCountryProcessed(country)
IOUtils.saveDataFrameAsJson(batchCodeTable, '../docs/data/batchCodeTables/Global.json')

View File

@@ -18,7 +18,7 @@
"from DateProvider import DateProvider\n",
"from InternationalVaersCovid19Provider import getInternationalVaersCovid19, get_international_VAERSVAX_VAERSSYMPTOMS_Covid19\n",
"from BatchCodeTableHtmlUpdater import updateBatchCodeTableHtmlFile\n",
"from BatchCodeTablePersister import createAndSaveBatchCodeTables\n",
"from BatchCodeTablePersister import createAndSaveGlobalBatchCodeTable\n",
"from SymptomByBatchcodeTableFactory import SymptomByBatchcodeTableFactory\n",
"from HistogramFactoryAndPersister import createAndSaveGlobalHistograms\n",
"from BatchCodeTableFactory import BatchCodeTableFactory"
@@ -149,10 +149,9 @@
"metadata": {},
"outputs": [],
"source": [
"createAndSaveBatchCodeTables(\n",
"createAndSaveGlobalBatchCodeTable(\n",
" minADRsForLethality = 100,\n",
" batchCodeTableFactory = BatchCodeTableFactory(internationalVaersCovid19),\n",
" onCountryProcessed = display)"
" batchCodeTableFactory = BatchCodeTableFactory(internationalVaersCovid19))"
]
},
{