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