From 4371a4c4ec8e8ed806d376099645379b7dcee85a Mon Sep 17 00:00:00 2001 From: frankknoll Date: Tue, 10 Oct 2023 11:04:38 +0200 Subject: [PATCH] adding symptoms to UI --- docs/SymptomsCausedByVaccines/index.html | 13587 +++++++++++++++++- src/HowBadIsMyBatch.ipynb | 7 +- src/SymptomsCausedByVaccines/HtmlUpdater.py | 22 +- src/SymptomsCausedByVaccines/HtmlUtils.py | 14 +- 4 files changed, 13498 insertions(+), 132 deletions(-) diff --git a/docs/SymptomsCausedByVaccines/index.html b/docs/SymptomsCausedByVaccines/index.html index 41dcd5c8e9d..dcf5ed70771 100644 --- a/docs/SymptomsCausedByVaccines/index.html +++ b/docs/SymptomsCausedByVaccines/index.html @@ -1,14 +1,15 @@ + - - - - - -Symptoms caused by Vaccines - - + + + + Symptoms caused by Vaccines + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + -
-
- -
-
- - -
-
-
-
-

Symptoms caused by Vaccines

-
-
-
-

- - - or view a table of all batch codes - -

-
-
-
-
-

Outcomes of Adverse Events

-
-
-
- -
-
-
-
-
-
-

Frequencies of Reported Symptoms

-
-
-
- - - - - - - -
SymptomFrequency
-
-
-
-
-
-
-
-
- - -
-
-
Data Source:
-
Vaccine Adverse Event Reporting System +
+
+ +
+
+ + +
+
+
+
+

Symptoms caused by Vaccines

+
+
+
+

+ + + or view a table of all batch codes + + +

+
+
+
+
+

Outcomes of Adverse Events

+
+
+
+ +
+
+
+
+
+
+

Frequencies of Reported Symptoms

+
+
+
+ + + + + + + +
SymptomFrequency
+
+
+
+
+
+
+
+
+ + +
+
Last updated:
+
October 06, 2023
+
+ Fork me on GitHub - -
-
-
- - - - - - - - - - - - - - + +
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/HowBadIsMyBatch.ipynb b/src/HowBadIsMyBatch.ipynb index b87a97ec1c1..ea755ca4d6a 100644 --- a/src/HowBadIsMyBatch.ipynb +++ b/src/HowBadIsMyBatch.ipynb @@ -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())" ] diff --git a/src/SymptomsCausedByVaccines/HtmlUpdater.py b/src/SymptomsCausedByVaccines/HtmlUpdater.py index 0e9cd8ede52..2e2c869b313 100644 --- a/src/SymptomsCausedByVaccines/HtmlUpdater.py +++ b/src/SymptomsCausedByVaccines/HtmlUpdater.py @@ -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): diff --git a/src/SymptomsCausedByVaccines/HtmlUtils.py b/src/SymptomsCausedByVaccines/HtmlUtils.py index 8bd4fcfb8f4..e8213295a18 100644 --- a/src/SymptomsCausedByVaccines/HtmlUtils.py +++ b/src/SymptomsCausedByVaccines/HtmlUtils.py @@ -1,10 +1,14 @@ def getVaccineOptions(vaccines): - return [''] + _getVaccineOptions(vaccines) + return [''] + _getOptions(vaccines) -def _getVaccineOptions(vaccines): - return [_getVaccineOption(vaccine) for vaccine in vaccines] +def getSymptomOptions(symptoms): + return [''] + _getOptions(symptoms) -def _getVaccineOption(vaccine): - return ''.format(vaccine=vaccine) +def _getOptions(values): + return [_getOption(value) for value in values] + + +def _getOption(value): + return ''.format(value=value)