refining DictByBatchcodeTable2JsonConverterTest
This commit is contained in:
@@ -17,9 +17,13 @@ class DictByBatchcodeTable2JsonConverter:
|
||||
dictByBatchcodeTable
|
||||
.apply(
|
||||
lambda row: {
|
||||
"batchcodes": list(row.name),
|
||||
"batchcodes": DictByBatchcodeTable2JsonConverter._getNaNBatchcodes(row.name),
|
||||
"histogram": row['SYMPTOM_COUNT_BY_VAX_LOT']
|
||||
},
|
||||
axis = 'columns')
|
||||
.to_list()
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _getNaNBatchcodes(batchcodes):
|
||||
return [batchcode for batchcode in batchcodes if batchcode != 'nan']
|
||||
|
||||
@@ -23,9 +23,9 @@ class DictByBatchcodeTable2JsonConverterTest(unittest.TestCase):
|
||||
]
|
||||
],
|
||||
index = pd.MultiIndex.from_tuples(
|
||||
names = ['VAX_LOT1', 'VAX_LOT2'],
|
||||
tuples = [['1808982', 'EW0175'],
|
||||
['015M20A', '1808982']]))
|
||||
names = ['VAX_LOT1', 'VAX_LOT2', 'VAX_LOT3'],
|
||||
tuples = [['1808982', 'EW0175', 'FD1921'],
|
||||
['015M20A', '1808982', 'nan']]))
|
||||
|
||||
# When
|
||||
jsonActual = DictByBatchcodeTable2JsonConverter.convertDictByBatchcodeTable2Json(dictByBatchcodeTable, '1808982')
|
||||
@@ -38,7 +38,7 @@ class DictByBatchcodeTable2JsonConverterTest(unittest.TestCase):
|
||||
"batchcode": "1808982",
|
||||
"histograms": [
|
||||
{
|
||||
"batchcodes": ["1808982", "EW0175"],
|
||||
"batchcodes": ["1808982", "EW0175", "FD1921"],
|
||||
"histogram": {
|
||||
"Blood pressure orthostatic abnormal": 5,
|
||||
"Chest discomfort": 1
|
||||
|
||||
Reference in New Issue
Block a user