refining SymptomByBatchcodeTableFactoryTest

This commit is contained in:
frankknoll
2023-02-08 09:07:44 +01:00
parent f809f09a14
commit 408f523797
2 changed files with 55 additions and 54 deletions

View File

@@ -14,7 +14,7 @@ class SymptomByBatchcodeTableFactory:
SymptomByBatchcodeTableFactory._getSymptomsTable(VAERSSYMPTOMS, symptomColumn), SymptomByBatchcodeTableFactory._getSymptomsTable(VAERSSYMPTOMS, symptomColumn),
on = 'VAERS_ID') on = 'VAERS_ID')
.set_index(index_columns) .set_index(index_columns)
[[symptomColumn]]) [[symptomColumn, 'COUNTRY']])
@staticmethod @staticmethod
def _getIndexColumns(VAERSVAX): def _getIndexColumns(VAERSVAX):

View File

@@ -10,9 +10,9 @@ class SymptomByBatchcodeTableFactoryTest(unittest.TestCase):
def test_createSymptomByBatchcodeTable(self): def test_createSymptomByBatchcodeTable(self):
# 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', 'COUNTRY'],
data = [ ['COVID19', 'JANSSEN', 'EW0175', 'UNK'], data = [ ['COVID19', 'JANSSEN', 'EW0175', 'UNK', 'Germany'],
['COVID19', 'PFIZER\BIONTECH', '1808982', '1']], ['COVID19', 'PFIZER\BIONTECH', '1808982', '1', 'Germany']],
index = pd.Index( index = pd.Index(
name = 'VAERS_ID', name = 'VAERS_ID',
data = [ data = [
@@ -40,20 +40,20 @@ class SymptomByBatchcodeTableFactoryTest(unittest.TestCase):
assert_frame_equal( assert_frame_equal(
symptomByBatchcodeTable, symptomByBatchcodeTable,
TestHelper.createDataFrame( TestHelper.createDataFrame(
columns = ['SYMPTOM'], columns = ['SYMPTOM', 'COUNTRY'],
data = [ ['Blood pressure orthostatic abnormal'], data = [ ['Blood pressure orthostatic abnormal', 'Germany'],
['Head injury'], ['Head injury', 'Germany'],
['SARS-CoV-2 test positive'], ['SARS-CoV-2 test positive', 'Germany'],
['COVID-19'], ['COVID-19', 'Germany'],
['Headache'], ['Headache', 'Germany'],
['Unresponsive to stimuli'], ['Unresponsive to stimuli', 'Germany'],
['Coma'], ['Coma', 'Germany'],
['Laboratory test'], ['Laboratory test', 'Germany'],
['X-ray'], ['X-ray', 'Germany'],
['Computerised tomogram'], ['Computerised tomogram', 'Germany'],
['Magnetic resonance imaging'], ['Magnetic resonance imaging', 'Germany'],
['Exposure to SARS-CoV-2'], ['Exposure to SARS-CoV-2', 'Germany'],
['SARS-CoV-2 antibody test negative']], ['SARS-CoV-2 antibody test negative', 'Germany']],
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)))
@@ -61,9 +61,9 @@ class SymptomByBatchcodeTableFactoryTest(unittest.TestCase):
def test_createSymptomByBatchcodeTable_two_patients_same_symptoms(self): def test_createSymptomByBatchcodeTable_two_patients_same_symptoms(self):
# 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', 'COUNTRY'],
data = [ ['COVID19', 'JANSSEN', 'EW0175', '1'], data = [ ['COVID19', 'JANSSEN', 'EW0175', '1', 'Germany'],
['COVID19', 'JANSSEN', 'EW0175', '1']], ['COVID19', 'JANSSEN', 'EW0175', '1', 'Russian Federation']],
index = pd.Index( index = pd.Index(
name = 'VAERS_ID', name = 'VAERS_ID',
data = [ data = [
@@ -89,9 +89,9 @@ class SymptomByBatchcodeTableFactoryTest(unittest.TestCase):
assert_frame_equal( assert_frame_equal(
symptomByBatchcodeTable, symptomByBatchcodeTable,
TestHelper.createDataFrame( TestHelper.createDataFrame(
columns = ['SYMPTOM'], columns = ['SYMPTOM', 'COUNTRY'],
data = [ ['Blood pressure orthostatic abnormal'], data = [ ['Blood pressure orthostatic abnormal', 'Germany'],
['Blood pressure orthostatic abnormal']], ['Blood pressure orthostatic abnormal', 'Russian Federation']],
index = pd.Index( index = pd.Index(
name = 'VAX_LOT1', name = 'VAX_LOT1',
data = ['EW0175', data = ['EW0175',
@@ -101,11 +101,11 @@ class SymptomByBatchcodeTableFactoryTest(unittest.TestCase):
def test_createSymptomByBatchcodeTable_two_patients_distinct_symptoms(self): def test_createSymptomByBatchcodeTable_two_patients_distinct_symptoms(self):
# 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', 'COUNTRY'],
data = [ ['COVID19', 'JANSSEN', '1808982', 'UNK'], data = [ ['COVID19', 'JANSSEN', '1808982', 'UNK', 'Germany'],
['COVID19', 'PFIZER\BIONTECH', 'EW0175', '1'], ['COVID19', 'PFIZER\BIONTECH', 'EW0175', '1', 'Germany'],
['COVID19', 'PFIZER\BIONTECH', 'EW0175', '1'], ['COVID19', 'PFIZER\BIONTECH', 'EW0175', '1', 'Russian Federation'],
['COVID19', 'PFIZER\BIONTECH', 'EW0167', '2']], ['COVID19', 'PFIZER\BIONTECH', 'EW0167', '2', 'Russian Federation']],
index = pd.Index( index = pd.Index(
name = 'VAERS_ID', name = 'VAERS_ID',
data = [ data = [
@@ -139,31 +139,32 @@ class SymptomByBatchcodeTableFactoryTest(unittest.TestCase):
assert_frame_equal( assert_frame_equal(
symptomByBatchcodeTable, symptomByBatchcodeTable,
TestHelper.createDataFrame( TestHelper.createDataFrame(
columns = ['SYMPTOM'], columns = ['SYMPTOM', 'COUNTRY'],
data = [ ['Blood pressure orthostatic abnormal'], data = [ ['Blood pressure orthostatic abnormal', 'Germany'],
['Head injury'], ['Head injury', 'Germany'],
['SARS-CoV-2 test positive'], ['SARS-CoV-2 test positive', 'Germany'],
['COVID-19'], ['COVID-19', 'Germany'],
['Headache'], ['Headache', 'Germany'],
['Unresponsive to stimuli'], ['Unresponsive to stimuli', 'Germany'],
['Coma'], ['Coma', 'Germany'],
['Laboratory test'], ['Laboratory test', 'Germany'],
['X-ray'], ['X-ray', 'Germany'],
['Computerised tomogram'], ['Computerised tomogram', 'Germany'],
['Magnetic resonance imaging'], ['Magnetic resonance imaging', 'Germany'],
['Exposure to SARS-CoV-2'], ['Exposure to SARS-CoV-2', 'Germany'],
['SARS-CoV-2 antibody test negative'], ['SARS-CoV-2 antibody test negative', 'Germany'],
['Computerised tomogram head abnormal'], ['Computerised tomogram head abnormal', 'Russian Federation'],
['Lumbar puncture'], ['Lumbar puncture', 'Russian Federation'],
['Ear pain'], ['Ear pain', 'Russian Federation'],
['Magnetic resonance imaging head'], ['Magnetic resonance imaging head', 'Russian Federation'],
['Headache'], ['Headache', 'Russian Federation'],
['Pain'], ['Pain', 'Russian Federation'],
['Idiopathic intracranial hypertension'], ['Idiopathic intracranial hypertension', 'Russian Federation'],
['Swelling'], ['Swelling', 'Russian Federation'],
['Intracranial pressure increased'], ['Intracranial pressure increased', 'Russian Federation'],
['Vision blurred']], ['Vision blurred', 'Russian Federation']],
index = pd.MultiIndex.from_tuples( index = pd.MultiIndex.from_tuples(
names = ['VAX_LOT1', 'VAX_LOT2'], names = ['VAX_LOT1', 'VAX_LOT2'],
tuples = [['1808982', 'EW0175']] * 13 + [['EW0167', 'EW0175']] * 10))) tuples = [['1808982', 'EW0175']] * 13 +
[['EW0167', 'EW0175']] * 10)))