sorting VAX_LOTs
This commit is contained in:
@@ -28,7 +28,10 @@ class SymptomsByBatchcodesTableFactory:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _getVaxLotsTable(VAERSVAX, index_columns):
|
def _getVaxLotsTable(VAERSVAX, index_columns):
|
||||||
VAX_LOT_LIST_Table = VAERSVAX.groupby("VAERS_ID").agg(VAX_LOT_LIST = pd.NamedAgg(column = 'VAX_LOT', aggfunc = list))
|
VAX_LOT_LIST_Table = VAERSVAX.groupby("VAERS_ID").agg(
|
||||||
|
VAX_LOT_LIST = pd.NamedAgg(
|
||||||
|
column = 'VAX_LOT',
|
||||||
|
aggfunc = lambda x: sorted(list(x))))
|
||||||
return pd.DataFrame(
|
return pd.DataFrame(
|
||||||
fillLsts(
|
fillLsts(
|
||||||
lsts = VAX_LOT_LIST_Table['VAX_LOT_LIST'].tolist(),
|
lsts = VAX_LOT_LIST_Table['VAX_LOT_LIST'].tolist(),
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ class SymptomsByBatchcodesTableFactoryTest(unittest.TestCase):
|
|||||||
# Given
|
# Given
|
||||||
VAERSVAX = TestHelper.createDataFrame(
|
VAERSVAX = TestHelper.createDataFrame(
|
||||||
columns = ['VAX_TYPE', 'VAX_MANU', 'VAX_LOT', 'VAX_DOSE_SERIES'],
|
columns = ['VAX_TYPE', 'VAX_MANU', 'VAX_LOT', 'VAX_DOSE_SERIES'],
|
||||||
data = [ ['COVID19', 'JANSSEN', '1808982', 'UNK'],
|
data = [ ['COVID19', 'JANSSEN', 'EW0175', 'UNK'],
|
||||||
['COVID19', 'PFIZER\BIONTECH', 'EW0175', '1']],
|
['COVID19', 'PFIZER\BIONTECH', '1808982', '1']],
|
||||||
index = pd.Index(
|
index = pd.Index(
|
||||||
name = 'VAERS_ID',
|
name = 'VAERS_ID',
|
||||||
data=[
|
data=[
|
||||||
@@ -56,7 +56,7 @@ class SymptomsByBatchcodesTableFactoryTest(unittest.TestCase):
|
|||||||
['SARS-CoV-2 antibody test negative']],
|
['SARS-CoV-2 antibody test negative']],
|
||||||
index = pd.MultiIndex.from_tuples(
|
index = pd.MultiIndex.from_tuples(
|
||||||
names = ['VAX_LOT1', 'VAX_LOT2'],
|
names = ['VAX_LOT1', 'VAX_LOT2'],
|
||||||
tuples = [['1808982', 'EW0175']] * 13)))
|
tuples = [['1808982', 'EW0175']] * 13)))
|
||||||
|
|
||||||
def test_createSymptomsByBatchcodesTable_two_patients_same_symptoms(self):
|
def test_createSymptomsByBatchcodesTable_two_patients_same_symptoms(self):
|
||||||
# Given
|
# Given
|
||||||
@@ -166,6 +166,6 @@ class SymptomsByBatchcodesTableFactoryTest(unittest.TestCase):
|
|||||||
['Vision blurred']],
|
['Vision blurred']],
|
||||||
index = pd.MultiIndex.from_tuples(
|
index = pd.MultiIndex.from_tuples(
|
||||||
names = ['VAX_LOT1', 'VAX_LOT2'],
|
names = ['VAX_LOT1', 'VAX_LOT2'],
|
||||||
tuples = [['1808982', 'EW0175']] * 13 + [['EW0175', 'EW0167']] * 10)))
|
tuples = [['1808982', 'EW0175']] * 13 + [['EW0167', 'EW0175']] * 10)))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user