refactoring

This commit is contained in:
frankknoll
2023-02-12 20:54:17 +01:00
parent 29786cc04a
commit f12519d1b8
4 changed files with 59 additions and 62 deletions

13
src/HistogramPersister.py Normal file
View File

@@ -0,0 +1,13 @@
from MultiIndexValuesProvider import MultiIndexValuesProvider
from HistogramDescriptionPersister import HistogramDescriptionPersister
import shutil
def saveHistograms(dictByBatchcodeTable4Country, country):
batchcodes = MultiIndexValuesProvider.getValues(dictByBatchcodeTable4Country.index)
batchcodes = {batchcode for batchcode in batchcodes if batchcode != 'nan'}
directory = f'../docs/data/histograms/{country}'
shutil.rmtree(directory, ignore_errors = True)
HistogramDescriptionPersister(directory).saveHistogramDescriptionsForBatchcodes(
batchcodes,
dictByBatchcodeTable4Country,
progress = lambda count, size, batchcode: print(f'{count}/{size}: {batchcode}'))