refactoring
This commit is contained in:
@@ -433,6 +433,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from SymptomsCausedByVaccines.HtmlUpdater import updateHtmlFile\n",
|
||||
"from SymptomsCausedByVaccines.Analyzer import Analyzer\n",
|
||||
"import pandas as pd"
|
||||
]
|
||||
},
|
||||
@@ -468,7 +469,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"updateHtmlFile(\n",
|
||||
" symptomByVaccine,\n",
|
||||
" vaccines = Analyzer(symptomByVaccine).getVaccines(),\n",
|
||||
" htmlFile = \"../docs/SymptomsCausedByVaccines/index.html\",\n",
|
||||
" lastUpdated = dateProvider.getLastUpdatedDataSource())"
|
||||
]
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
from bs4 import BeautifulSoup
|
||||
from HtmlTransformerUtil import HtmlTransformerUtil
|
||||
from DateProvider import DateProvider
|
||||
from SymptomsCausedByVaccines.Analyzer import Analyzer
|
||||
from SymptomsCausedByVaccines.HtmlUtils import getVaccineOptions
|
||||
from SymptomsCausedByVaccines.OptionsSetter import OptionsSetter
|
||||
|
||||
|
||||
def updateHtmlFile(symptomByVaccine, htmlFile, lastUpdated):
|
||||
vaccineOptions = getVaccineOptions(Analyzer(symptomByVaccine).getVaccines())
|
||||
_saveVaccineOptions(vaccineOptions, htmlFile)
|
||||
def updateHtmlFile(vaccines, htmlFile, lastUpdated):
|
||||
_saveVaccineOptions(
|
||||
vaccineOptions = getVaccineOptions(vaccines),
|
||||
htmlFile = htmlFile,
|
||||
vaccineSelectElementId = 'vaccineSelect')
|
||||
saveLastUpdated2HtmlFile(
|
||||
lastUpdated = lastUpdated,
|
||||
htmlFile = htmlFile,
|
||||
lastUpdatedElementId = 'last_updated')
|
||||
|
||||
def _saveVaccineOptions(vaccineOptions, htmlFile):
|
||||
def _saveVaccineOptions(vaccineOptions, htmlFile, vaccineSelectElementId):
|
||||
HtmlTransformerUtil().applySoupTransformerToFile(
|
||||
file=htmlFile,
|
||||
soupTransformer = lambda soup:
|
||||
BeautifulSoup(
|
||||
OptionsSetter().setOptions(
|
||||
html = str(soup),
|
||||
selectElementId = 'vaccineSelect',
|
||||
selectElementId = vaccineSelectElementId,
|
||||
options = vaccineOptions),
|
||||
'lxml'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user