Skip to content

Commit 592c237

Browse files
authored
Merge pull request #1034 from cmu-delphi/release/delphi-epidata-0.4.2
Release Delphi Epidata 0.4.2
2 parents 5bd05ee + d6e67ed commit 592c237

File tree

33 files changed

+890
-591
lines changed

33 files changed

+890
-591
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.4.1
2+
current_version = 0.4.2
33
commit = False
44
tag = False
55

docs/Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ GEM
211211
jekyll-seo-tag (~> 2.1)
212212
minitest (5.14.4)
213213
multipart-post (2.1.1)
214-
nokogiri (1.13.6)
214+
nokogiri (1.13.9)
215215
mini_portile2 (~> 2.8.0)
216216
racc (~> 1.4)
217217
octokit (4.20.0)

integrations/acquisition/covid_hosp/facility/test_scenarios.py

+27-10
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_acquire_dataset(self):
7676
response = Epidata.covid_hosp_facility(
7777
'450822', Epidata.range(20200101, 20210101))
7878
self.assertEqual(response['result'], 1)
79-
self.assertEqual(len(response['epidata']), 1)
79+
self.assertEqual(len(response['epidata']), 2)
8080
row = response['epidata'][0]
8181
for k,v in expected_spotchecks.items():
8282
self.assertTrue(
@@ -101,9 +101,9 @@ def test_acquire_dataset(self):
101101
response = Epidata.covid_hosp_facility(
102102
'450822', Epidata.range(20200101, 20210101))
103103
self.assertEqual(response['result'], 1)
104-
self.assertEqual(len(response['epidata']), 1)
104+
self.assertEqual(len(response['epidata']), 2)
105105

106-
@freeze_time("2021-03-16")
106+
@freeze_time("2021-03-17")
107107
def test_facility_lookup(self):
108108
"""Lookup facilities using various filters."""
109109

@@ -120,7 +120,7 @@ def test_facility_lookup(self):
120120
self.assertTrue(acquired)
121121

122122
# texas ground truth, sorted by `hospital_pk`
123-
# see sample data at testdata/acquisition/covid_hosp/facility/dataset_old.csv
123+
# see sample data at testdata/acquisition/covid_hosp/facility/dataset.csv
124124
texas_hospitals = [{
125125
'hospital_pk': '450771',
126126
'state': 'TX',
@@ -139,7 +139,7 @@ def test_facility_lookup(self):
139139
'hospital_name': 'MEDICAL CITY LAS COLINAS',
140140
'address': '6800 N MACARTHUR BLVD',
141141
'city': 'IRVING',
142-
'zip': '75039',
142+
'zip': '77777', # most-recent collection week should take precedence
143143
'hospital_subtype': 'Short Term',
144144
'fips_code': '48113',
145145
'is_metro_micro': 1,
@@ -150,7 +150,7 @@ def test_facility_lookup(self):
150150
'hospital_name': 'RANKIN HOSPITAL MEDICAL CLINIC',
151151
'address': '1611 SPUR 576',
152152
'city': 'RANKIN',
153-
'zip': '79778',
153+
'zip': '99999', # most-recent collection week should take precedence
154154
'hospital_subtype': 'Critical Access Hospitals',
155155
'fips_code': '48461',
156156
'is_metro_micro': 0,
@@ -160,16 +160,16 @@ def test_facility_lookup(self):
160160
response = Epidata.covid_hosp_facility_lookup(state='tx')
161161
self.assertEqual(response['epidata'], texas_hospitals)
162162

163-
with self.subTest(name='by ccn'):
164-
response = Epidata.covid_hosp_facility_lookup(ccn='450771')
163+
with self.subTest(name='by zip'):
164+
response = Epidata.covid_hosp_facility_lookup(zip='75093')
165165
self.assertEqual(response['epidata'], texas_hospitals[0:1])
166166

167167
with self.subTest(name='by city'):
168168
response = Epidata.covid_hosp_facility_lookup(city='irving')
169169
self.assertEqual(response['epidata'], texas_hospitals[1:2])
170170

171-
with self.subTest(name='by zip'):
172-
response = Epidata.covid_hosp_facility_lookup(zip='79778')
171+
with self.subTest(name='by ccn'):
172+
response = Epidata.covid_hosp_facility_lookup(ccn='451329')
173173
self.assertEqual(response['epidata'], texas_hospitals[2:3])
174174

175175
with self.subTest(name='by fips_code'):
@@ -179,3 +179,20 @@ def test_facility_lookup(self):
179179
with self.subTest(name='no results'):
180180
response = Epidata.covid_hosp_facility_lookup(state='not a state')
181181
self.assertEqual(response['result'], -2)
182+
183+
# update facility info
184+
mock_network = MagicMock()
185+
mock_network.fetch_metadata.return_value = \
186+
self.test_utils.load_sample_metadata('metadata_update_facility.csv')
187+
mock_network.fetch_dataset.return_value = \
188+
self.test_utils.load_sample_dataset('dataset_update_facility.csv')
189+
190+
# acquire sample data into local database
191+
with self.subTest(name='second acquisition'):
192+
acquired = Update.run(network=mock_network)
193+
self.assertTrue(acquired)
194+
195+
texas_hospitals[1]['zip'] = '88888'
196+
with self.subTest(name='by city after update'):
197+
response = Epidata.covid_hosp_facility_lookup(city='irving')
198+
self.assertEqual(response['epidata'], texas_hospitals[1:2])

package-lock.json

+157-46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ scipy==1.6.2
1111
tenacity==7.0.0
1212
newrelic
1313
epiweeks==2.1.2
14+
typing-extensions

0 commit comments

Comments
 (0)