adding symptoms to UI

This commit is contained in:
frankknoll
2023-10-10 11:04:38 +02:00
parent 0270d385a2
commit 4371a4c4ec
4 changed files with 13498 additions and 132 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -448,7 +448,7 @@
" 'data/ratings-1990-2022.csv',\n",
" index_col = 'VAX_TYPE',\n",
" usecols = lambda columnName: columnName != 'Unnamed: 0')\n",
"symptomByVaccine"
"# symptomByVaccine"
]
},
{
@@ -468,8 +468,11 @@
"metadata": {},
"outputs": [],
"source": [
"analyzer = Analyzer(symptomByVaccine)\n",
"\n",
"updateHtmlFile(\n",
" vaccines = Analyzer(symptomByVaccine).getVaccines(),\n",
" vaccines = analyzer.getVaccines(),\n",
" symptoms = analyzer.getSymptoms(),\n",
" htmlFile = \"../docs/SymptomsCausedByVaccines/index.html\",\n",
" lastUpdated = dateProvider.getLastUpdatedDataSource())"
]

View File

@@ -1,29 +1,35 @@
from bs4 import BeautifulSoup
from HtmlTransformerUtil import HtmlTransformerUtil
from DateProvider import DateProvider
from SymptomsCausedByVaccines.HtmlUtils import getVaccineOptions
from SymptomsCausedByVaccines.HtmlUtils import getVaccineOptions, getSymptomOptions
from SymptomsCausedByVaccines.OptionsSetter import OptionsSetter
def updateHtmlFile(vaccines, htmlFile, lastUpdated):
_saveVaccineOptions(
vaccineOptions = getVaccineOptions(vaccines),
def updateHtmlFile(vaccines, symptoms, htmlFile, lastUpdated):
_saveOptions(
options = getVaccineOptions(vaccines),
htmlFile = htmlFile,
vaccineSelectElementId = 'vaccineSelect')
selectElementId = 'vaccineSelect')
_saveOptions(
options = getSymptomOptions(symptoms),
htmlFile = htmlFile,
selectElementId = 'symptomSelect')
saveLastUpdated2HtmlFile(
lastUpdated = lastUpdated,
htmlFile = htmlFile,
lastUpdatedElementId = 'last_updated')
def _saveVaccineOptions(vaccineOptions, htmlFile, vaccineSelectElementId):
def _saveOptions(options, htmlFile, selectElementId):
HtmlTransformerUtil().applySoupTransformerToFile(
file=htmlFile,
soupTransformer = lambda soup:
BeautifulSoup(
OptionsSetter().setOptions(
html = str(soup),
selectElementId = vaccineSelectElementId,
options = vaccineOptions),
selectElementId = selectElementId,
options = options),
'lxml'))
def saveLastUpdated2HtmlFile(lastUpdated, htmlFile, lastUpdatedElementId):

View File

@@ -1,10 +1,14 @@
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):
return [_getVaccineOption(vaccine) for vaccine in vaccines]
def getSymptomOptions(symptoms):
return ['<option hidden disabled selected value>Select Symptom</option>'] + _getOptions(symptoms)
def _getVaccineOption(vaccine):
return '<option value="{vaccine}">{vaccine}</option>'.format(vaccine=vaccine)
def _getOptions(values):
return [_getOption(value) for value in values]
def _getOption(value):
return '<option value="{value}">{value}</option>'.format(value=value)