|
1 | 1 | # first party |
2 | 2 | from delphi.epidata.common.integration_test_base_class import DelphiTestBase |
| 3 | +import pdb |
3 | 4 |
|
4 | 5 |
|
5 | 6 | class rvdssTest(DelphiTestBase): |
6 | 7 | """Basic integration tests for rvdss endpoint.""" |
7 | 8 |
|
8 | 9 | def localSetUp(self): |
9 | | - self.truncate_tables_list = ["rvdss_repiratory_detections", |
10 | | - "rvdss_pct_positive", |
11 | | - "rvdss_detections_counts"] |
| 10 | + self.truncate_tables_list = ["rvdss"] |
12 | 11 |
|
13 | 12 | def test_rvdss_repiratory_detections(self): |
14 | | - """Basic integration test for rvdss_repiratory_detections endpoint""" |
| 13 | + """Basic integration test for rvdss endpoint""" |
15 | 14 | self.cur.execute( |
16 | | - "INSERT INTO `rvdss_repiratory_detections`(`epiweek`, `time_value`, `issue`, `geo_type`, `geo_value`, `sarscov2_tests`, `sarscov2_positive_tests`, `flu_tests`, `flu_positive_tests`, `fluah1n1pdm09_positive_tests`, `fluah3_positive_tests`, `fluauns_positive_tests`, `flua_positive_tests`, `flub_positive_tests`, `rsv_tests`, `rsv_positive_tests`, `hpiv_tests`, `hpiv1_positive_tests`, `hpiv2_positive_tests`, `hpiv3_positive_tests`, `hpiv4_positive_tests`, `hpivother_positive_tests`, `adv_tests`, `adv_positive_tests`, `hmpv_tests`, `hmpv_positive_tests`, `evrv_tests`, `evrv_positive_tests`, `hcov_tests`, `hcov_positive_tests`, `week`, `weekorder`, `year`) VALUES(%(epiweek)s, %(time_value)s, %(issue)s, %(geo_type)s, %(geo_value)s, %(sarscov2_tests)s, %(sarscov2_positive_tests)s, %(flu_tests)s, %(flu_positive_tests)s, %(fluah1n1pdm09_positive_tests)s, %(fluah3_positive_tests)s, %(fluauns_positive_tests)s, %(flua_positive_tests)s, %(flub_positive_tests)s, %(rsv_tests)s, %(rsv_positive_tests)s, %(hpiv_tests)s, %(hpiv1_positive_tests)s, %(hpiv2_positive_tests)s, %(hpiv3_positive_tests)s, %(hpiv4_positive_tests)s, %(hpivother_positive_tests)s, %(adv_tests)s, %(adv_positive_tests)s, %(hmpv_tests)s, %(hmpv_positive_tests)s, %(evrv_tests)s, %(evrv_positive_tests)s, %(hcov_tests)s, %(hcov_positive_tests)s, %(week)s, %(weekorder)s, %(year)s)", |
17 | | - ("201212", "2012-04-12", "2012-04-17", "region","on", "10", "1", "9", "1", "0", "0", "2", "3", "1", "8", "2", "7", "1", "1", "1", "1","1", "6", "5", "100", "13", "92", "9", "167", "52", "12", "34", "2012"), |
| 15 | + "INSERT INTO `rvdss`(`epiweek`, `time_value`,`time_type`, `issue`, `geo_type`, `geo_value`, `sarscov2_tests`, `sarscov2_positive_tests`, `sarscov2_pct_positive`, `flu_tests`, `flu_positive_tests`, `flu_pct_positive`, `fluah1n1pdm09_positive_tests`, `fluah3_positive_tests`, `fluauns_positive_tests`, `flua_positive_tests`, `flua_tests`, `flua_pct_positive`, `flub_positive_tests`, `flub_tests`, `flub_pct_positive`, `rsv_tests`, `rsv_positive_tests`, `rsv_pct_positive`, `hpiv_tests`, `hpiv1_positive_tests`, `hpiv2_positive_tests`, `hpiv3_positive_tests`, `hpiv4_positive_tests`, `hpivother_positive_tests`, `hpiv_positive_tests`, `hpiv_pct_positive`, `adv_tests`, `adv_positive_tests`, `adv_pct_positive`, `hmpv_tests`, `hmpv_positive_tests`, `hmpv_pct_positive`, `evrv_tests`, `evrv_positive_tests`, `evrv_pct_positive`, `hcov_tests`, `hcov_positive_tests`, `hcov_pct_positive`, `year`) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", |
| 16 | + (201212,20120412,"week","2012-04-17",'province','on',10,1,10,20, 10, 50, 1, 1, 1, 5, 20, 25, 4, 20, 20, 30, 3, 10, 40, 2, 2, 2, 1, 1, 8, 20, 40, 16, 40, 10, 2, 20, 1, 0, 0, 24, 3, 12.5, 2012), |
18 | 17 | ) |
19 | 18 | self.cnx.commit() |
20 | | - response = self.epidata_client.rvdss_repiratory_detections(epiweeks=201212, geo_value="on") |
| 19 | + pdb.set_trace() |
| 20 | + response = self.epidata_client.rvdss(geo_type="province", time_values = 20120412,geo_value="on") |
21 | 21 | self.assertEqual( |
22 | 22 | response, |
23 | 23 | { |
24 | 24 | "epidata": [ |
25 | | - {'epiweek':201212, |
26 | | - 'time_value':"2012-04-12", |
27 | | - 'issue':"2012-04-17", |
28 | | - 'geo_type':"region", |
29 | | - 'geo_value':"on", |
30 | | - 'sarscov2_tests':10, |
31 | | - 'sarscov2_positive_tests':1, |
32 | | - 'flu_tests':9, |
33 | | - 'flu_positive_tests':1, |
34 | | - 'fluah1n1pdm09_positive_tests':0, |
35 | | - 'fluah3_positive_tests':0, |
36 | | - 'fluauns_positive_tests':2, |
37 | | - 'flua_positive_tests':3, |
38 | | - 'flub_positive_tests':1, |
39 | | - 'rsv_tests':8, |
40 | | - 'rsv_positive_tests':2, |
41 | | - 'hpiv_tests':8, |
42 | | - 'hpiv1_positive_tests':1, |
43 | | - 'hpiv2_positive_tests':1, |
44 | | - 'hpiv3_positive_tests':1, |
45 | | - 'hpiv4_positive_tests':1, |
46 | | - 'hpivother_positive_tests':1, |
47 | | - 'adv_tests':6, |
48 | | - 'adv_positive_tests':5, |
49 | | - 'hmpv_tests':100, |
50 | | - 'hmpv_positive_tests':13, |
51 | | - 'evrv_tests':92, |
52 | | - 'evrv_positive_tests':9, |
53 | | - 'hcov_tests':167, |
54 | | - 'hcov_positive_tests':52, |
55 | | - 'week':12, |
56 | | - 'weekorder':34, |
57 | | - 'year':2012 |
58 | | - } |
59 | | - ], |
60 | | - "result": 1, |
61 | | - "message": "success", |
62 | | - }, |
63 | | - ) |
64 | | - |
65 | | - def test_rvdss_pct_positive(self): |
66 | | - """Basic integration test for rvdss_pct_positive endpoint""" |
67 | | - self.cur.execute( |
68 | | - "INSERT INTO rvdss_pct_positive (`epiweek`, `time_value`, `issue`, `geo_type`, `geo_value`, `evrv_pct_positive`, `evrv_tests`, `evrv_positive_tests`, `hpiv_pct_positive`, `hpiv_tests`, `hpiv_positive_tests`, `adv_pct_positive`, `adv_tests`, `adv_positive_tests`,`hcov_pct_positive`, `hcov_tests`, `hcov_positive_tests`, `flua_pct_positive`, `flub_pct_positive`, `flu_tests`, `flua_positive_tests`, `flua_tests`, `flub_tests`, `flub_positive_tests`, `flu_positive_tests`, `flu_pct_positive`, `hmpv_pct_positive`, `hmpv_tests`, `hmpv_positive_tests`, `rsv_pct_positive`, `rsv_tests`, `rsv_positive_tests`, `sarscov2_pct_positive`, `sarscov2_tests`, `sarscov2_positive_tests`, `region`, `week`, `weekorder`, `year`) VALUES (%(epiweek)s, %(time_value)s, %(issue)s, %(geo_type)s, %(geo_value)s, %(evrv_pct_positive)s, %(evrv_tests)s, %(evrv_positive_tests)s, %(hpiv_pct_positive)s, %(hpiv_tests)s, %(hpiv_positive_tests)s, %(adv_pct_positive)s, %(adv_tests)s, %(hcov_pct_positive)s, %(hcov_tests)s, %(hcov_positive_tests)s, %(flua_pct_positive)s, %(flub_pct_positive)s, %(flu_tests)s, %(flua_positive_tests)s, %(flua_tests)s, %(flub_tests)s, %(flub_positive_tests)s, %(flu_positive_tests)s, %(flu_pct_positive)s, %(hmpv_pct_positive)s, %(hmpv_tests)s, %(hmpv_positive_tests)s, %(rsv_pct_positive)s, %(rsv_tests)s, %(rsv_positive_tests)s, %(sarscov2_pct_positive)s, %(sarscov2_tests)s, %(sarscov2_positive_tests)s, %(region)s, %(week)s, %(weekorder)s, %(year)s)", |
69 | | - ("201212", "2012-04-12", "2012-04-17", "region","on","0.1","10","1","0.1","10","1","0.1","10","1","0.1","10","1","0.05","0.05","100", "10", "100","100", "10", "20", "0.1","0.1","10","1","0.1","10","1","0.1","10","1","on","12","34","2012") |
70 | | - ) |
71 | | - self.cnx.commit() |
72 | | - response = self.epidata_client.rvdss_pct_positive(epiweeks=201212, geo_value="on") |
73 | | - self.assertEqual( |
74 | | - response, |
75 | | - { |
76 | | - "epidata": [ |
77 | | - {'epiweek':201212, |
78 | | - 'time_value':"2012-04-12", |
79 | | - 'issue':"2012-04-17", |
80 | | - 'geo_type':"region", |
81 | | - 'geo_value':"on", |
82 | | - 'evrv_pct_positive':0.1, |
83 | | - 'evrv_tests':10, |
84 | | - 'evrv_positive_tests':1, |
85 | | - 'hpiv_pct_positive':0.1, |
86 | | - 'hpiv_tests':10, |
87 | | - 'hpiv_positive_tests':1, |
88 | | - 'adv_pct_positive':0.1, |
89 | | - 'adv_tests':10, |
90 | | - 'adv_positive_tests':1, |
91 | | - 'hcov_pct_positive':0.1, |
92 | | - 'hcov_tests':10, |
93 | | - 'hcov_positive_tests':1, |
94 | | - 'flua_pct_positive':0.05, |
95 | | - 'flub_pct_positive':0.05, |
96 | | - 'flu_tests':100, |
97 | | - 'flua_positive_tests':10, |
98 | | - 'flua_tests':100, |
99 | | - 'flub_tests':100, |
100 | | - 'flub_positive_tests':10, |
101 | | - 'flu_positive_tests':20, |
102 | | - 'flu_pct_positive':0.1, |
103 | | - 'hmpv_pct_positive':0.1, |
104 | | - 'hmpv_tests':10, |
105 | | - 'hmpv_positive_tests':1, |
106 | | - 'rsv_pct_positive':0.1, |
107 | | - 'rsv_tests':10, |
108 | | - 'rsv_positive_tests':1, |
109 | | - 'sarscov2_pct_positive':0.1, |
110 | | - 'sarscov2_tests':10, |
111 | | - 'sarscov2_positive_tests':1, |
112 | | - 'region':"on", |
113 | | - 'week':12, |
114 | | - 'weekorder':34, |
115 | | - 'year':2012 |
116 | | - } |
117 | | - ], |
118 | | - "result": 1, |
119 | | - "message": "success", |
120 | | - }, |
121 | | - ) |
122 | | - |
123 | | - def test_rvdss_detections_counts(self): |
124 | | - """Basic integration test for rvdss_detections_counts endpoint""" |
125 | | - self.cur.execute( |
126 | | - "INSERT INTO rvdss_detections_counts (`epiweek`, `time_value`, `issue`, `geo_type`, `geo_value`, `hpiv_positive_tests`, `adv_positive_tests`, `hmpv_positive_tests`, `evrv_positive_tests`, `hcov_positive_tests`, `rsv_positive_tests`, `flu_positive_tests`) VALUES (%(epiweek)s, %(time_value)s, %(issue)s, %(geo_type)s, %(geo_value)s, %(hpiv_positive_tests)s, %(adv_positive_tests)s, %(hmpv_positive_tests)s, %(evrv_positive_tests)s, %(hcov_positive_tests)s, %(rsv_positive_tests)s, %(flu_positive_tests)s)", |
127 | | - ("201212", "2012-04-12", "2012-04-17", "nation","ca", "10", "9", "8", "7", "6", "5", "4"), |
128 | | - ) |
129 | | - self.cnx.commit() |
130 | | - response = self.epidata_client.rvdss_detections_counts(epiweeks=201212, geo_value="ca") |
131 | | - self.assertEqual( |
132 | | - response, |
133 | | - { |
134 | | - "epidata": [ |
135 | | - {'epiweek':201212, |
136 | | - 'time_value':"2012-04-12", |
137 | | - 'issue':"2012-04-17", |
138 | | - 'geo_type':"nation", |
139 | | - 'geo_value':"ca", |
140 | | - 'hpiv_positive_tests':10, |
141 | | - 'adv_positive_tests':9, |
142 | | - 'hmpv_positive_tests':8, |
143 | | - 'evrv_positive_tests':7, |
144 | | - 'hcov_positive_tests':6, |
145 | | - 'rsv_positive_tests':5, |
146 | | - 'flu_positive_tests':4 |
| 25 | + { "epiweek":201212, |
| 26 | + "time_value":20120412, |
| 27 | + "time_type":"week", |
| 28 | + "issue":"2012-04-17", |
| 29 | + "geo_type":"province", |
| 30 | + "geo_value":"on", |
| 31 | + "sarscov2_tests":10, |
| 32 | + "sarscov2_positive_tests":1, |
| 33 | + "sarscov2_pct_positive":10, |
| 34 | + "flu_tests":20, |
| 35 | + "flu_positive_tests":10, |
| 36 | + "flu_pct_positive":50, |
| 37 | + "fluah1n1pdm09_positive_tests":1, |
| 38 | + "fluah3_positive_tests":1, |
| 39 | + "fluauns_positive_tests":1, |
| 40 | + "flua_positive_tests":5, |
| 41 | + "flua_tests":20, |
| 42 | + "flua_pct_positive":25, |
| 43 | + "flub_positive_tests":4, |
| 44 | + "flub_tests":20, |
| 45 | + "flub_pct_positive":25, |
| 46 | + "rsv_tests":30, |
| 47 | + "rsv_positive_tests":3, |
| 48 | + "rsv_pct_positive":10, |
| 49 | + "hpiv_tests":40, |
| 50 | + "hpiv1_positive_tests":2, |
| 51 | + "hpiv2_positive_tests":2, |
| 52 | + "hpiv3_positive_tests":2, |
| 53 | + "hpiv4_positive_tests":1, |
| 54 | + "hpivother_positive_tests":1, |
| 55 | + "hpiv_positive_tests":8, |
| 56 | + "hpiv_pct_positive":20, |
| 57 | + "adv_tests":40, |
| 58 | + "adv_positive_tests":16, |
| 59 | + "adv_pct_positive":40, |
| 60 | + "hmpv_tests":10, |
| 61 | + "hmpv_positive_tests":2, |
| 62 | + "hmpv_pct_positive":20, |
| 63 | + "evrv_tests":1, |
| 64 | + "evrv_positive_tests":0, |
| 65 | + "evrv_pct_positive":0, |
| 66 | + "hcov_tests":24, |
| 67 | + "hcov_positive_tests":3, |
| 68 | + "hcov_pct_positive":12.5, |
| 69 | + "year":2012 |
147 | 70 | } |
148 | 71 | ], |
149 | 72 | "result": 1, |
|
0 commit comments