invoking global versions of methods

This commit is contained in:
frankknoll
2023-02-11 02:20:18 +01:00
parent c80d570907
commit 10a7185b0a

View File

@@ -110,6 +110,16 @@
"symptomByBatchcodeTable" "symptomByBatchcodeTable"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "5997ee59",
"metadata": {},
"outputs": [],
"source": [
"isGlobal = True"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -119,7 +129,7 @@
"source": [ "source": [
"from SymptomHistogramByBatchcodeTableFactory import SymptomHistogramByBatchcodeTableFactory\n", "from SymptomHistogramByBatchcodeTableFactory import SymptomHistogramByBatchcodeTableFactory\n",
"\n", "\n",
"symptomHistogramByBatchcodeTable = SymptomHistogramByBatchcodeTableFactory.createSymptomHistogramByBatchcodeTable(symptomByBatchcodeTable)\n", "symptomHistogramByBatchcodeTable = SymptomHistogramByBatchcodeTableFactory.createGlobalSymptomHistogramByBatchcodeTable(symptomByBatchcodeTable) if isGlobal else SymptomHistogramByBatchcodeTableFactory.createSymptomHistogramByBatchcodeTable(symptomByBatchcodeTable)\n",
"symptomHistogramByBatchcodeTable" "symptomHistogramByBatchcodeTable"
] ]
}, },
@@ -132,7 +142,7 @@
"source": [ "source": [
"from HistogramTable2DictTableConverter import HistogramTable2DictTableConverter\n", "from HistogramTable2DictTableConverter import HistogramTable2DictTableConverter\n",
"\n", "\n",
"dictByBatchcodeTable = HistogramTable2DictTableConverter.convertHistogramTable2DictTable(symptomHistogramByBatchcodeTable)\n", "dictByBatchcodeTable = HistogramTable2DictTableConverter.convertGlobalHistogramTable2DictTable(symptomHistogramByBatchcodeTable) if isGlobal else HistogramTable2DictTableConverter.convertHistogramTable2DictTable(symptomHistogramByBatchcodeTable)\n",
"dictByBatchcodeTable" "dictByBatchcodeTable"
] ]
}, },
@@ -148,9 +158,20 @@
"from HistogramDescriptionPersister import HistogramDescriptionPersister\n", "from HistogramDescriptionPersister import HistogramDescriptionPersister\n",
"import shutil\n", "import shutil\n",
"\n", "\n",
"countries = getCountries(international_VAERSVAX_Covid19)\n", "if isGlobal:\n",
"\n", " batchcodes = MultiIndexValuesProvider.getValues(dictByBatchcodeTable.index)\n",
"for count, country in enumerate(countries, start = 1):\n", " batchcodes = {batchcode for batchcode in batchcodes if batchcode != 'nan'}\n",
" # directory = f'../docs/data/histograms/global'\n",
" directory = f'../docs/data/histograms'\n",
" shutil.rmtree(directory, ignore_errors = True)\n",
" histogramDescriptionPersister = HistogramDescriptionPersister(directory)\n",
" histogramDescriptionPersister.saveHistogramDescriptionsForBatchcodes(\n",
" batchcodes,\n",
" dictByBatchcodeTable,\n",
" progress = lambda count, size, batchcode: print(f'{count}/{size}: {batchcode}'))\n",
"else:\n",
" countries = getCountries(international_VAERSVAX_Covid19)\n",
" for count, country in enumerate(countries, start = 1):\n",
" # FK-TODO: use https://github.com/tqdm/tqdm\n", " # FK-TODO: use https://github.com/tqdm/tqdm\n",
" print(f'saving histograms for country {count}/{len(countries)}: {country}')\n", " print(f'saving histograms for country {count}/{len(countries)}: {country}')\n",
" dictByBatchcodeTable4Country = dictByBatchcodeTable[dictByBatchcodeTable['COUNTRY'] == country]\n", " dictByBatchcodeTable4Country = dictByBatchcodeTable[dictByBatchcodeTable['COUNTRY'] == country]\n",
@@ -213,9 +234,9 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "howbadismybatch-venv-kernel", "display_name": "howbadismybatch-venv",
"language": "python", "language": "python",
"name": "howbadismybatch-venv-kernel" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {