adding last_updated to VaccineDistributionByZipcode.html
This commit is contained in:
@@ -5,29 +5,27 @@ from HtmlUtils import getBatchcodeOptions, getBatchcodes
|
||||
from DateProvider import DateProvider
|
||||
|
||||
|
||||
def updateBatchCodeTableHtmlFile(batchCodeTable, batchCodeTableHtmlFile):
|
||||
def updateBatchCodeTableHtmlFile(batchCodeTable, batchCodeTableHtmlFile, lastUpdated):
|
||||
batchcodeOptions = getBatchcodeOptions(getBatchcodes(batchCodeTable.sort_values(by = 'Adverse Reaction Reports', ascending = False)))
|
||||
_saveBatchcodeOptions(batchcodeOptions, batchCodeTableHtmlFile)
|
||||
saveLastUpdatedBatchCodeTable(
|
||||
DateProvider().getLastUpdatedDataSource(),
|
||||
batchCodeTableHtmlFile)
|
||||
saveLastUpdated2HtmlFile(lastUpdated, batchCodeTableHtmlFile)
|
||||
|
||||
def _saveBatchcodeOptions(batchcodeOptions, batchCodeTableHtmlFile):
|
||||
HtmlTransformerUtil().applySoupTransformerToFile(
|
||||
file=batchCodeTableHtmlFile,
|
||||
soupTransformer=lambda soup:
|
||||
soupTransformer = lambda soup:
|
||||
BeautifulSoup(
|
||||
BatchcodeOptionsSetter().setBatchcodeOptions(
|
||||
html=str(soup),
|
||||
options=batchcodeOptions),
|
||||
'lxml'))
|
||||
|
||||
def saveLastUpdatedBatchCodeTable(lastUpdated, batchCodeTableHtmlFile):
|
||||
def saveLastUpdated2HtmlFile(lastUpdated, htmlFile):
|
||||
def setLastUpdated(soup):
|
||||
soup.find(id="last_updated").string.replace_with(
|
||||
lastUpdated.strftime(DateProvider.DATE_FORMAT))
|
||||
return soup
|
||||
|
||||
HtmlTransformerUtil().applySoupTransformerToFile(
|
||||
file=batchCodeTableHtmlFile,
|
||||
soupTransformer=setLastUpdated)
|
||||
file = htmlFile,
|
||||
soupTransformer = setLastUpdated)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"from HistogramFactoryAndPersister import createAndSaveGlobalHistograms\n",
|
||||
"from SymptomByBatchcodeTableFactory import SymptomByBatchcodeTableFactory\n",
|
||||
"from BatchCodeTablePersister import createGlobalBatchCodeTable\n",
|
||||
"from BatchCodeTableHtmlUpdater import updateBatchCodeTableHtmlFile, saveLastUpdatedBatchCodeTable\n",
|
||||
"from BatchCodeTableHtmlUpdater import updateBatchCodeTableHtmlFile, saveLastUpdated2HtmlFile\n",
|
||||
"from InternationalVaersCovid19Provider import getInternationalVaersCovid19, getInternationalVaersCovid19BeforeDeletion, get_international_VAERSVAX_VAERSSYMPTOMS_Covid19\n",
|
||||
"from DateProvider import DateProvider\n",
|
||||
"from BarChartDescriptionTable2DictionaryConverter import BarChartDescriptionTable2DictionaryConverter\n",
|
||||
@@ -151,9 +151,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"IOUtils.saveDataFrameAsJson(batchCodeTable, '../docs/data/batchCodeTables/Global.json')\n",
|
||||
"saveLastUpdatedBatchCodeTable(\n",
|
||||
" DateProvider().getLastUpdatedDataSource(),\n",
|
||||
" batchCodeTableHtmlFile = \"../docs/batchCodes.html\")"
|
||||
"saveLastUpdated2HtmlFile(dateProvider.getLastUpdatedDataSource(), \"../docs/batchCodes.html\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -163,7 +161,10 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"updateBatchCodeTableHtmlFile(batchCodeTable, batchCodeTableHtmlFile=\"../docs/HowBadIsMyBatch.html\")"
|
||||
"updateBatchCodeTableHtmlFile(\n",
|
||||
" batchCodeTable,\n",
|
||||
" batchCodeTableHtmlFile = \"../docs/HowBadIsMyBatch.html\",\n",
|
||||
" lastUpdated = dateProvider.getLastUpdatedDataSource())"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -364,7 +365,8 @@
|
||||
"source": [
|
||||
"from IOUtils import IOUtils\n",
|
||||
"\n",
|
||||
"IOUtils.saveDataFrameAsJson(vaccineDistributionByZipcode, '../docs/data/vaccineDistributionByZipcode/VaccineDistributionByZipcode.json')"
|
||||
"IOUtils.saveDataFrameAsJson(vaccineDistributionByZipcode, '../docs/data/vaccineDistributionByZipcode/VaccineDistributionByZipcode.json')\n",
|
||||
"saveLastUpdated2HtmlFile(dateProvider.getLastUpdatedDataSource(), \"../docs/VaccineDistributionByZipcode.html\")"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user