generating histograms for all countries
This commit is contained in:
@@ -107,21 +107,9 @@
|
||||
"from SymptomByBatchcodeTableFactory import SymptomByBatchcodeTableFactory\n",
|
||||
"\n",
|
||||
"symptomByBatchcodeTable = SymptomByBatchcodeTableFactory.createSymptomByBatchcodeTable(international_VAERSVAX_Covid19, international_VAERSSYMPTOMS)\n",
|
||||
"# symptomByBatchcodeTable.to_pickle('tmp/symptomByBatchcodeTable.pkl')\n",
|
||||
"symptomByBatchcodeTable"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "b5a70fa0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# symptomByBatchcodeTable = pd.read_pickle('tmp/symptomByBatchcodeTable.pkl')\n",
|
||||
"# symptomByBatchcodeTable"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -151,31 +139,41 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "5e2a0a30",
|
||||
"id": "a57e0fd5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"batchcodes = international_VAERSVAX_Covid19['VAX_LOT'].dropna().drop_duplicates().to_list()\n",
|
||||
"batchcodes"
|
||||
"from HtmlUtils import getCountries\n",
|
||||
"from MultiIndexValuesProvider import MultiIndexValuesProvider\n",
|
||||
"from HistogramDescriptionPersister import HistogramDescriptionPersister\n",
|
||||
"import shutil\n",
|
||||
"\n",
|
||||
"countries = getCountries(international_VAERSVAX_Covid19)\n",
|
||||
"\n",
|
||||
"for count, country in enumerate(countries, start = 1):\n",
|
||||
" # FK-TODO: use https://github.com/tqdm/tqdm\n",
|
||||
" print(f'saving histograms for country {count}/{len(countries)}: {country}')\n",
|
||||
" dictByBatchcodeTable4Country = dictByBatchcodeTable[dictByBatchcodeTable['COUNTRY'] == country]\n",
|
||||
" batchcodes = MultiIndexValuesProvider.getValues(dictByBatchcodeTable4Country.index)\n",
|
||||
" batchcodes = {batchcode for batchcode in batchcodes if batchcode != 'nan'}\n",
|
||||
" directory = f'../docs/data/histograms/{country}'\n",
|
||||
" shutil.rmtree(directory, ignore_errors = True)\n",
|
||||
" histogramDescriptionPersister = HistogramDescriptionPersister(directory)\n",
|
||||
" histogramDescriptionPersister.saveHistogramDescriptionsForBatchcodes(\n",
|
||||
" batchcodes,\n",
|
||||
" dictByBatchcodeTable4Country,\n",
|
||||
" progress = lambda count, size, batchcode: print(f'{count}/{size}: {batchcode}'))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6e6efc19",
|
||||
"id": "5e2a0a30",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from HistogramDescriptionPersister import HistogramDescriptionPersister\n",
|
||||
"import shutil\n",
|
||||
"\n",
|
||||
"directory = '../docs/data/histograms'\n",
|
||||
"shutil.rmtree(directory)\n",
|
||||
"histogramDescriptionPersister = HistogramDescriptionPersister(directory)\n",
|
||||
"histogramDescriptionPersister.saveHistogramDescriptionsForBatchcodes(\n",
|
||||
" batchcodes,\n",
|
||||
" dictByBatchcodeTable,\n",
|
||||
" progress = lambda count, size, batchcode: print(f'{count}/{size}: {batchcode}'))"
|
||||
"# batchcodes = international_VAERSVAX_Covid19['VAX_LOT'].dropna().drop_duplicates().to_list()\n",
|
||||
"# batchcodes"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -215,9 +213,9 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "howbadismybatch-venv",
|
||||
"display_name": "howbadismybatch-venv-kernel",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
"name": "howbadismybatch-venv-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
|
||||
Reference in New Issue
Block a user