adding symptoms to UI
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -448,7 +448,7 @@
|
|||||||
" 'data/ratings-1990-2022.csv',\n",
|
" 'data/ratings-1990-2022.csv',\n",
|
||||||
" index_col = 'VAX_TYPE',\n",
|
" index_col = 'VAX_TYPE',\n",
|
||||||
" usecols = lambda columnName: columnName != 'Unnamed: 0')\n",
|
" usecols = lambda columnName: columnName != 'Unnamed: 0')\n",
|
||||||
"symptomByVaccine"
|
"# symptomByVaccine"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -468,8 +468,11 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"analyzer = Analyzer(symptomByVaccine)\n",
|
||||||
|
"\n",
|
||||||
"updateHtmlFile(\n",
|
"updateHtmlFile(\n",
|
||||||
" vaccines = Analyzer(symptomByVaccine).getVaccines(),\n",
|
" vaccines = analyzer.getVaccines(),\n",
|
||||||
|
" symptoms = analyzer.getSymptoms(),\n",
|
||||||
" htmlFile = \"../docs/SymptomsCausedByVaccines/index.html\",\n",
|
" htmlFile = \"../docs/SymptomsCausedByVaccines/index.html\",\n",
|
||||||
" lastUpdated = dateProvider.getLastUpdatedDataSource())"
|
" lastUpdated = dateProvider.getLastUpdatedDataSource())"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,29 +1,35 @@
|
|||||||
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.HtmlUtils import getVaccineOptions
|
from SymptomsCausedByVaccines.HtmlUtils import getVaccineOptions, getSymptomOptions
|
||||||
from SymptomsCausedByVaccines.OptionsSetter import OptionsSetter
|
from SymptomsCausedByVaccines.OptionsSetter import OptionsSetter
|
||||||
|
|
||||||
|
|
||||||
def updateHtmlFile(vaccines, htmlFile, lastUpdated):
|
def updateHtmlFile(vaccines, symptoms, htmlFile, lastUpdated):
|
||||||
_saveVaccineOptions(
|
_saveOptions(
|
||||||
vaccineOptions = getVaccineOptions(vaccines),
|
options = getVaccineOptions(vaccines),
|
||||||
htmlFile = htmlFile,
|
htmlFile = htmlFile,
|
||||||
vaccineSelectElementId = 'vaccineSelect')
|
selectElementId = 'vaccineSelect')
|
||||||
|
|
||||||
|
_saveOptions(
|
||||||
|
options = getSymptomOptions(symptoms),
|
||||||
|
htmlFile = htmlFile,
|
||||||
|
selectElementId = 'symptomSelect')
|
||||||
|
|
||||||
saveLastUpdated2HtmlFile(
|
saveLastUpdated2HtmlFile(
|
||||||
lastUpdated = lastUpdated,
|
lastUpdated = lastUpdated,
|
||||||
htmlFile = htmlFile,
|
htmlFile = htmlFile,
|
||||||
lastUpdatedElementId = 'last_updated')
|
lastUpdatedElementId = 'last_updated')
|
||||||
|
|
||||||
def _saveVaccineOptions(vaccineOptions, htmlFile, vaccineSelectElementId):
|
def _saveOptions(options, htmlFile, selectElementId):
|
||||||
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 = vaccineSelectElementId,
|
selectElementId = selectElementId,
|
||||||
options = vaccineOptions),
|
options = options),
|
||||||
'lxml'))
|
'lxml'))
|
||||||
|
|
||||||
def saveLastUpdated2HtmlFile(lastUpdated, htmlFile, lastUpdatedElementId):
|
def saveLastUpdated2HtmlFile(lastUpdated, htmlFile, lastUpdatedElementId):
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
def getVaccineOptions(vaccines):
|
def getVaccineOptions(vaccines):
|
||||||
return ['<option hidden disabled selected value>Select Vaccine</option>'] + _getVaccineOptions(vaccines)
|
return ['<option hidden disabled selected value>Select Vaccine</option>'] + _getOptions(vaccines)
|
||||||
|
|
||||||
|
|
||||||
def _getVaccineOptions(vaccines):
|
def getSymptomOptions(symptoms):
|
||||||
return [_getVaccineOption(vaccine) for vaccine in vaccines]
|
return ['<option hidden disabled selected value>Select Symptom</option>'] + _getOptions(symptoms)
|
||||||
|
|
||||||
|
|
||||||
def _getVaccineOption(vaccine):
|
def _getOptions(values):
|
||||||
return '<option value="{vaccine}">{vaccine}</option>'.format(vaccine=vaccine)
|
return [_getOption(value) for value in values]
|
||||||
|
|
||||||
|
|
||||||
|
def _getOption(value):
|
||||||
|
return '<option value="{value}">{value}</option>'.format(value=value)
|
||||||
|
|||||||
Reference in New Issue
Block a user