Skip to content

Commit fd96964

Browse files
authored
Merge pull request #661 from cmu-delphi/sgratzl/alias_fix
fix: handle cornercases where source is not transmitted for aliases
2 parents ba4ed06 + 37c28c9 commit fd96964

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/server/endpoints/covidcast.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ def handle():
160160

161161
_handle_lag_issues_as_of(q, issues, lag, as_of)
162162

163-
def transform_row(row, _):
164-
if is_compatibility or not alias_mapper:
163+
def transform_row(row, proxy):
164+
if is_compatibility or not alias_mapper or 'source' not in row:
165165
return row
166-
row["source"] = alias_mapper(row["source"], row["signal"])
166+
row["source"] = alias_mapper(row["source"], proxy["signal"])
167167
return row
168168

169169
# send query
@@ -608,10 +608,10 @@ def handle_coverage():
608608

609609
_handle_lag_issues_as_of(q, None, None, None)
610610

611-
def transform_row(row, _):
612-
if not alias_mapper:
611+
def transform_row(row, proxy):
612+
if not alias_mapper or 'source' not in row:
613613
return row
614-
row["source"] = alias_mapper(row["source"], row["signal"])
614+
row["source"] = alias_mapper(row["source"], proxy["signal"])
615615
return row
616616

617617
return execute_query(q.query, q.params, fields_string, fields_int, [], transform=transform_row)

0 commit comments

Comments
 (0)