diff --git a/src/BatchCodeTableHavingGuessedCountriesFactory.py b/src/BatchCodeTableHavingGuessedCountriesFactory.py index 3da70623545..32599c01236 100644 --- a/src/BatchCodeTableHavingGuessedCountriesFactory.py +++ b/src/BatchCodeTableHavingGuessedCountriesFactory.py @@ -21,5 +21,6 @@ class BatchCodeTableHavingGuessedCountriesFactory: def _guessCountries(self, batchCodeTable, countriesAsList): batchCodeTable['Countries'] = CountriesMerger.mergeSrcIntoDst( dst = batchCodeTable['Countries'], + # FK-TODO: zusätzlich zu self.countriesByBatchcodeBeforeDeletion auch noch mit dem Ergebnis der noch zu implementierenden Funktion CountriesByBatchcodeProvider.getCountriesByClickedBatchcode() mergen. src = self.countriesByBatchcodeBeforeDeletion['Countries']) BatchCodeTableFactory._convertCountries(batchCodeTable, countriesAsList) diff --git a/src/CountriesByBatchcodeProvider.py b/src/CountriesByBatchcodeProvider.py index 325534783a4..2b63e678403 100644 --- a/src/CountriesByBatchcodeProvider.py +++ b/src/CountriesByBatchcodeProvider.py @@ -1,6 +1,7 @@ import pandas as pd from BatchCodeTableFactory import BatchCodeTableFactory from InternationalVaersCovid19Provider import getInternationalVaersCovid19 +from SummationTableFactory import SummationTableFactory def getCountryCountsByBatchcodeTable(): @@ -45,6 +46,17 @@ def _combineCountryCountsByBatchcodeTables(countryCountsByClickedBatchcode, coun return countryCountsByBatchcode +def getCountriesByClickedBatchcode(): + return (_getCountryCountsByClickedBatchcode() + .reset_index(level = 'COUNTRY') + .groupby('VAX_LOT') + .agg( + Countries = + pd.NamedAgg( + column = 'COUNTRY', + aggfunc = SummationTableFactory.sortCountries))) + + def getCountriesByBatchcodeBeforeDeletion(): internationalVaersCovid19 = getInternationalVaersCovid19(dataDir = 'VAERS/VAERSBeforeDeletion', years = [2020, 2021, 2022]) batchCodeTable = BatchCodeTableFactory(internationalVaersCovid19).createGlobalBatchCodeTable(countriesAsList = True)