refactoring
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
from GoogleAnalyticsReader import GoogleAnalyticsReader
|
||||
from CountriesByBatchcodeProvider import getDateRangeOfVAERSReportsBeforeDeletionOfCountryCodes
|
||||
from CountriesByBatchcodeProvider import getDateRangeOfVAERSReports
|
||||
|
||||
|
||||
class BarChartDescriptionTable2DictionaryConverter:
|
||||
|
||||
@staticmethod
|
||||
def convert2Dictionary(barChartDescriptionTable):
|
||||
def convert2Dictionary(barChartDescriptionTable, internationalVaersCovid19):
|
||||
return {
|
||||
'date range guessed': BarChartDescriptionTable2DictionaryConverter.dateRange2Str(GoogleAnalyticsReader(dataDir='data/GoogleAnalytics').getDateRange()),
|
||||
'date range known': BarChartDescriptionTable2DictionaryConverter.dateRange2Str(getDateRangeOfVAERSReportsBeforeDeletionOfCountryCodes()),
|
||||
'date range known': BarChartDescriptionTable2DictionaryConverter.dateRange2Str(getDateRangeOfVAERSReports(internationalVaersCovid19)),
|
||||
'barChartDescriptions': barChartDescriptionTable['BAR_CHART_DESCRIPTION'].to_dict()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import pandas as pd
|
||||
from InternationalVaersCovid19Provider import getInternationalVaersCovid19
|
||||
from InternationalVaersCovid19Provider import getInternationalVaersCovid19BeforeDeletion
|
||||
from CountryCountsByBatchcodeTablesMerger import CountryCountsByBatchcodeTablesMerger
|
||||
|
||||
|
||||
@@ -10,17 +10,12 @@ def getCountryCountsByBatchcodeTable():
|
||||
|
||||
|
||||
def _getCountryCountsByBatchcodeBeforeDeletion():
|
||||
internationalVaersCovid19 = _getInternationalVaersCovid19BeforeDeletion()
|
||||
return (internationalVaersCovid19
|
||||
return (getInternationalVaersCovid19BeforeDeletion()
|
||||
.groupby('VAX_LOT')
|
||||
['COUNTRY'].value_counts()
|
||||
.to_frame(name = 'COUNTRY_COUNT_BY_VAX_LOT'))
|
||||
|
||||
|
||||
def _getInternationalVaersCovid19BeforeDeletion():
|
||||
return getInternationalVaersCovid19(dataDir = 'VAERS/VAERSBeforeDeletion', years = [2020, 2021, 2022])
|
||||
|
||||
|
||||
def _combineCountryCountsByBatchcodeTables(countryCountsByClickedBatchcode, countryCountsByBatchcodeBeforeDeletion):
|
||||
countryCountsByBatchcode = pd.merge(
|
||||
countryCountsByClickedBatchcode,
|
||||
@@ -35,8 +30,8 @@ def _combineCountryCountsByBatchcodeTables(countryCountsByClickedBatchcode, coun
|
||||
return countryCountsByBatchcode
|
||||
|
||||
|
||||
def getDateRangeOfVAERSReportsBeforeDeletionOfCountryCodes():
|
||||
dates = _getInternationalVaersCovid19BeforeDeletion()['RECVDATE']
|
||||
def getDateRangeOfVAERSReports(internationalVaersCovid19):
|
||||
dates = internationalVaersCovid19['RECVDATE']
|
||||
return dates.min(), dates.max()
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
"from SymptomByBatchcodeTableFactory import SymptomByBatchcodeTableFactory\n",
|
||||
"from BatchCodeTablePersister import createGlobalBatchCodeTable\n",
|
||||
"from BatchCodeTableHtmlUpdater import updateBatchCodeTableHtmlFile, saveLastUpdatedBatchCodeTable\n",
|
||||
"from InternationalVaersCovid19Provider import getInternationalVaersCovid19, get_international_VAERSVAX_VAERSSYMPTOMS_Covid19\n",
|
||||
"from InternationalVaersCovid19Provider import getInternationalVaersCovid19, getInternationalVaersCovid19BeforeDeletion, get_international_VAERSVAX_VAERSSYMPTOMS_Covid19\n",
|
||||
"from DateProvider import DateProvider\n",
|
||||
"from BarChartDescriptionTable2DictionaryConverter import BarChartDescriptionTable2DictionaryConverter\n",
|
||||
"from CountryColumnsMerger import CountryColumnsMerger\n",
|
||||
"from datetime import datetime\n",
|
||||
"from VAERSFileDownloader import updateVAERSFiles\n",
|
||||
"from IOUtils import IOUtils\n",
|
||||
@@ -115,6 +116,19 @@
|
||||
"internationalVaersCovid19"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "29366235",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"internationalVaersCovid19 = CountryColumnsMerger.mergeCountryColumnOfSrcIntoDst(\n",
|
||||
" src = getInternationalVaersCovid19BeforeDeletion(),\n",
|
||||
" dst = internationalVaersCovid19)\n",
|
||||
"internationalVaersCovid19"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -139,7 +153,7 @@
|
||||
"IOUtils.saveDataFrameAsJson(batchCodeTable, '../docs/data/batchCodeTables/Global.json')\n",
|
||||
"saveLastUpdatedBatchCodeTable(\n",
|
||||
" DateProvider().getLastUpdatedDataSource(),\n",
|
||||
" batchCodeTableHtmlFile=\"../docs/batchCodes.html\")"
|
||||
" batchCodeTableHtmlFile = \"../docs/batchCodes.html\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -205,7 +219,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"IOUtils.saveDictAsJson(\n",
|
||||
" BarChartDescriptionTable2DictionaryConverter.convert2Dictionary(barChartDescriptionTable),\n",
|
||||
" BarChartDescriptionTable2DictionaryConverter.convert2Dictionary(barChartDescriptionTable, internationalVaersCovid19),\n",
|
||||
" '../docs/data/barChartDescriptionTable.json')\n"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -15,6 +15,9 @@ def getInternationalVaersCovid19(dataDir, years):
|
||||
return internationalVaersCovid19
|
||||
|
||||
|
||||
def getInternationalVaersCovid19BeforeDeletion():
|
||||
return getInternationalVaersCovid19(dataDir = 'VAERS/VAERSBeforeDeletion', years = [2020, 2021, 2022])
|
||||
|
||||
def get_international_VAERSVAX_VAERSSYMPTOMS_Covid19(years):
|
||||
VAERSDATA, VAERSVAX, VAERSSYMPTOMS = _get_VAERSDATA_VAERSVAX_VAERSSYMPTOMS(years)
|
||||
VAERSVAX_Covid19_CountryColumn = _get_VAERSVAX_Covid19_CountryColumn(VAERSVAX, CountryColumnAdder(VAERSDATA))
|
||||
|
||||
Reference in New Issue
Block a user