starting AnalyzerTest
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,3 +16,4 @@ src/intensivstationen/__pycache__/
|
|||||||
google-chrome-stable_current_amd64*
|
google-chrome-stable_current_amd64*
|
||||||
src/captcha/__pycache__
|
src/captcha/__pycache__
|
||||||
src/GoogleAnalytics/__pycache__
|
src/GoogleAnalytics/__pycache__
|
||||||
|
src/SymptomsCausedByVaccines/__pycache__
|
||||||
|
|||||||
9
src/SymptomsCausedByVaccines/Analyzer.py
Normal file
9
src/SymptomsCausedByVaccines/Analyzer.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
class Analyzer:
|
||||||
|
|
||||||
|
def __init__(self, symptomByVaccine: pd.DataFrame):
|
||||||
|
self.symptomByVaccine = symptomByVaccine
|
||||||
|
|
||||||
|
def getSymptomsForVaccine(self, vaxType):
|
||||||
|
return self.symptomByVaccine.loc[vaxType]
|
||||||
33
src/SymptomsCausedByVaccines/AnalyzerTest.py
Normal file
33
src/SymptomsCausedByVaccines/AnalyzerTest.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import unittest
|
||||||
|
from pandas.testing import assert_series_equal
|
||||||
|
from TestHelper import TestHelper
|
||||||
|
import pandas as pd
|
||||||
|
from SymptomsCausedByVaccines.Analyzer import Analyzer
|
||||||
|
|
||||||
|
class AnalyzerTest(unittest.TestCase):
|
||||||
|
|
||||||
|
# input a vaccine name, and see which symptoms are strongest for it.
|
||||||
|
def test_getSymptomsForVaccine(self):
|
||||||
|
# Given
|
||||||
|
symptomByVaccine = TestHelper.createDataFrame(
|
||||||
|
columns = ['11-beta-hydroxylase deficiency', '17-hydroxyprogesterone'],
|
||||||
|
data = [ [0.6, 0.4]],
|
||||||
|
index = pd.Index(
|
||||||
|
name = 'VAX_TYPE',
|
||||||
|
data = ['6VAX-F']))
|
||||||
|
|
||||||
|
analyzer = Analyzer(symptomByVaccine)
|
||||||
|
|
||||||
|
# When
|
||||||
|
symptomsForVaccine = analyzer.getSymptomsForVaccine('6VAX-F')
|
||||||
|
|
||||||
|
# Then
|
||||||
|
assert_series_equal(
|
||||||
|
symptomsForVaccine,
|
||||||
|
pd.Series(
|
||||||
|
name = '6VAX-F',
|
||||||
|
data = {
|
||||||
|
'11-beta-hydroxylase deficiency': 0.6,
|
||||||
|
'17-hydroxyprogesterone': 0.4
|
||||||
|
}))
|
||||||
|
|
||||||
0
src/SymptomsCausedByVaccines/__init__.py
Normal file
0
src/SymptomsCausedByVaccines/__init__.py
Normal file
Reference in New Issue
Block a user