Skip to content

Commit 29f9b96

Browse files
authored
Merge pull request #577 from cmu-delphi/sgratzl/bugfixing
fix: trendseries serialization + require signal in coverage endpoint
2 parents 06e8cff + 7ded7fe commit 29f9b96

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/server/endpoints/covidcast.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ def handle_trendseries():
244244
def gen(rows):
245245
for key, group in groupby((parse_row(row, fields_string, fields_int, fields_float) for row in rows), lambda row: (row["geo_type"], row["geo_value"], row["source"], row["signal"])):
246246
trends = compute_trends(key[0], key[1], key[2], key[3], shifter, ((row["time_value"], row["value"]) for row in group))
247-
for t in trends:
248-
yield t
247+
for trend in trends:
248+
yield trend.asdict()
249249

250250
# execute first query
251251
try:
@@ -501,7 +501,7 @@ def handle_coverage():
501501
similar to /signal_dashboard_coverage for a specific signal returns the coverage (number of locations for a given geo_type)
502502
"""
503503

504-
signal = parse_source_signal_arg("signal")
504+
signal = parse_source_signal_pairs()
505505
geo_type = request.args.get("geo_type", "county")
506506
if "window" in request.values:
507507
time_window = parse_day_range_arg("window")
@@ -531,6 +531,7 @@ def handle_coverage():
531531
q.where_source_signal_pairs("source", "signal", signal)
532532
q.where_time_pairs("time_type", "time_value", [TimePair("day", [time_window])])
533533
q.group_by = "c.source, c.signal, c.time_value"
534+
q.set_order("source", "signal", "time_value")
534535

535536
_handle_lag_issues_as_of(q, None, None, None)
536537

0 commit comments

Comments
 (0)