@@ -120,17 +120,21 @@ def get_geo_signal_combos(data_source, api_key):
120
120
source_signal_mappings = {i ['source' ]:i ['db_source' ] for i in
121
121
meta_response .json ()}
122
122
123
- response = Epidata .covidcast_meta ()
123
+ with warnings .catch_warnings ():
124
+ warnings .simplefilter ("ignore" )
124
125
125
- if response ["result" ] != 1 :
126
- # Something failed in the API and we did not get real metadata
127
- raise RuntimeError ("Error when fetching metadata from the API" , response ["message" ])
126
+ response = Epidata .covidcast_meta ()
127
+
128
+ if response ["result" ] != 1 :
129
+ # Something failed in the API and we did not get real metadata
130
+ raise RuntimeError ("Error when fetching metadata from the API" , response ["message" ])
128
131
129
- meta = pd .DataFrame .from_dict (response ["epidata" ])
130
- # note: this will fail for signals with weekly data, but currently not supported for validation
131
- meta ["min_time" ] = meta .apply (lambda x : pd .to_datetime (str (x .min_time ), format = "%Y%m%d" ), axis = 1 )
132
- meta ["max_time" ] = meta .apply (lambda x : pd .to_datetime (str (x .max_time ), format = "%Y%m%d" ), axis = 1 )
133
- meta ["last_update" ] = pd .to_datetime (meta ["last_update" ], unit = "s" )
132
+ meta = pd .DataFrame .from_dict (response ["epidata" ])
133
+ # note: this will fail for signals with weekly data, but currently not supported for validation
134
+ meta = meta [meta ["time_type" ] == "day" ]
135
+ meta ["min_time" ] = meta .apply (lambda x : pd .to_datetime (str (x .min_time ), format = "%Y%m%d" ), axis = 1 )
136
+ meta ["max_time" ] = meta .apply (lambda x : pd .to_datetime (str (x .max_time ), format = "%Y%m%d" ), axis = 1 )
137
+ meta ["last_update" ] = pd .to_datetime (meta ["last_update" ], unit = "s" )
134
138
135
139
source_meta = meta [meta ['data_source' ] == data_source ]
136
140
# Need to convert np.records to tuples so they are hashable and can be used in sets and dicts.
@@ -184,7 +188,7 @@ def fetch_api_reference(data_source, start_date, end_date, geo_type, signal_type
184
188
time_type = "day" ,
185
189
geo_type = geo_type ,
186
190
time_values = Epidata .range (start_date .strftime ("%Y%m%d" ), end_date .strftime ("%Y%m%d" )),
187
- geo_value = geo_type ,
191
+ geo_value = "*"
188
192
)
189
193
if response ["result" ] != 1 :
190
194
# Something failed in the API and we did not get real metadata
@@ -193,6 +197,7 @@ def fetch_api_reference(data_source, start_date, end_date, geo_type, signal_type
193
197
api_df = None
194
198
if len (response ["epidata" ]) > 0 :
195
199
api_df = pd .DataFrame .from_dict (response ["epidata" ])
200
+ # note: this will fail for signals with weekly data, but currently not supported for validation
196
201
api_df ["issue" ] = pd .to_datetime (api_df ["issue" ], format = "%Y%m%d" )
197
202
api_df ["time_value" ] = pd .to_datetime (api_df ["time_value" ], format = "%Y%m%d" )
198
203
api_df .drop ("direction" , axis = 1 , inplace = True )
0 commit comments