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