refining AnalyzerTest
This commit is contained in:
@@ -7,3 +7,6 @@ class Analyzer:
|
||||
|
||||
def getSymptomsForVaccine(self, vaxType):
|
||||
return self.symptomByVaccine.loc[vaxType]
|
||||
|
||||
def getVaccinesForSymptom(self, symptom):
|
||||
return self.symptomByVaccine[symptom]
|
||||
|
||||
@@ -6,7 +6,6 @@ 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(
|
||||
@@ -31,3 +30,31 @@ class AnalyzerTest(unittest.TestCase):
|
||||
'17-hydroxyprogesterone': 0.4
|
||||
}))
|
||||
|
||||
def test_getVaccinesForSymptom(self):
|
||||
# Given
|
||||
symptomByVaccine = TestHelper.createDataFrame(
|
||||
columns = ['11-beta-hydroxylase deficiency'],
|
||||
data = [ [0.6],
|
||||
[0.3]],
|
||||
index = pd.Index(
|
||||
name = 'VAX_TYPE',
|
||||
data = [
|
||||
'6VAX-F',
|
||||
'ADEN'
|
||||
]))
|
||||
|
||||
analyzer = Analyzer(symptomByVaccine)
|
||||
|
||||
# When
|
||||
vaccinesForSymptom = analyzer.getVaccinesForSymptom('11-beta-hydroxylase deficiency')
|
||||
|
||||
# Then
|
||||
assert_series_equal(
|
||||
vaccinesForSymptom,
|
||||
TestHelper.createSeries(
|
||||
name = '11-beta-hydroxylase deficiency',
|
||||
data = {
|
||||
'6VAX-F': 0.6,
|
||||
'ADEN': 0.3
|
||||
},
|
||||
indexName = 'VAX_TYPE'))
|
||||
|
||||
@@ -6,3 +6,9 @@ class TestHelper:
|
||||
@staticmethod
|
||||
def createDataFrame(columns, data, dtypes={}, **kwargs):
|
||||
return pd.DataFrame(columns=columns, data=data, **kwargs).astype(dtypes)
|
||||
|
||||
@staticmethod
|
||||
def createSeries(indexName, **kwargs):
|
||||
series = pd.Series(**kwargs)
|
||||
series.index.name = indexName
|
||||
return series
|
||||
|
||||
@@ -5,6 +5,9 @@ FK-FIXME:
|
||||
FK-TODO:
|
||||
- add google captcha to batchCodeTable.html
|
||||
- Symptomhistogramm
|
||||
- create an interface where people
|
||||
1. could input a symptom, and see which vaccines are worst, or
|
||||
2. input a vaccine name, and see which symptoms are strongest for it.
|
||||
|
||||
anacron job:
|
||||
sudo cp src/intensivstationen_howbadismybatch.sh /etc/cron.daily/intensivstationen_howbadismybatch
|
||||
|
||||
Reference in New Issue
Block a user