refining SymptomByBatchcodeTableFactoryTest
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from DataFrameNormalizer import DataFrameNormalizer
|
||||
|
||||
class SymptomByBatchcodeTableFactory:
|
||||
|
||||
@staticmethod
|
||||
def createSymptomByBatchcodeTable(VAERSVAX, VAERSSYMPTOMS):
|
||||
DataFrameNormalizer.convertVAX_LOTColumnToUpperCase(VAERSVAX)
|
||||
index_columns = SymptomByBatchcodeTableFactory._getIndexColumns(VAERSVAX)
|
||||
symptomColumn = 'SYMPTOM'
|
||||
return (pd
|
||||
|
||||
@@ -5,7 +5,6 @@ from SymptomByBatchcodeTableFactory import SymptomByBatchcodeTableFactory
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
# FIXME: brauchen Normalisierung analog zu DataFrameNormalizer.removeUnknownBatchCodes(dataFrame) und DataFrameNormalizer.convertVAX_LOTColumnToUpperCase(dataFrame)
|
||||
class SymptomByBatchcodeTableFactoryTest(unittest.TestCase):
|
||||
|
||||
def test_createSymptomByBatchcodeTable(self):
|
||||
@@ -168,3 +167,45 @@ class SymptomByBatchcodeTableFactoryTest(unittest.TestCase):
|
||||
index = pd.MultiIndex.from_tuples(
|
||||
names = ['VAX_LOT1', 'VAX_LOT2'],
|
||||
tuples = [['1808982', 'EW0175']] * 13 + [['EW0167', 'EW0175']] * 10)))
|
||||
|
||||
def test_createSymptomByBatchcodeTable_after_convertVAX_LOTColumnToUpperCase(self):
|
||||
# Given
|
||||
VAX_LOT = 'EW0175'
|
||||
VAX_LOT_lower = VAX_LOT.lower()
|
||||
VAERSVAX = TestHelper.createDataFrame(
|
||||
columns = ['VAX_TYPE', 'VAX_MANU', 'VAX_LOT', 'VAX_DOSE_SERIES'],
|
||||
data = [ ['COVID19', 'JANSSEN', VAX_LOT, '1'],
|
||||
['COVID19', 'JANSSEN', VAX_LOT_lower, '1']],
|
||||
index = pd.Index(
|
||||
name = 'VAERS_ID',
|
||||
data=[
|
||||
2547730,
|
||||
2547731]),
|
||||
dtypes = {
|
||||
'VAX_DOSE_SERIES': 'string',
|
||||
'VAX_LOT': 'string'})
|
||||
VAERSSYMPTOMS = TestHelper.createDataFrame(
|
||||
columns = ['SYMPTOM1', 'SYMPTOM2', 'SYMPTOM3', 'SYMPTOM4', 'SYMPTOM5'],
|
||||
data = [ ['Blood pressure orthostatic abnormal', np.nan, np.nan, np.nan, np.nan],
|
||||
['Blood pressure orthostatic abnormal', np.nan, np.nan, np.nan, np.nan]],
|
||||
index = pd.Index(
|
||||
name = 'VAERS_ID',
|
||||
data=[
|
||||
2547730,
|
||||
2547731]))
|
||||
|
||||
# When
|
||||
symptomByBatchcodeTable = SymptomByBatchcodeTableFactory.createSymptomByBatchcodeTable(VAERSVAX, VAERSSYMPTOMS)
|
||||
|
||||
# Then
|
||||
assert_frame_equal(
|
||||
symptomByBatchcodeTable,
|
||||
TestHelper.createDataFrame(
|
||||
columns = ['SYMPTOM'],
|
||||
data = [ ['Blood pressure orthostatic abnormal'],
|
||||
['Blood pressure orthostatic abnormal']],
|
||||
index = pd.Index(
|
||||
name = 'VAX_LOT1',
|
||||
data = [VAX_LOT,
|
||||
VAX_LOT])),
|
||||
check_dtype = False)
|
||||
|
||||
Reference in New Issue
Block a user