You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/server/endpoints/covid_hosp_state_timeseries.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -95,11 +95,11 @@ def handle():
95
95
ifissuesisnotNone:
96
96
q.where_integers("issue", issues)
97
97
# final query using specific issues
98
-
query=f"WITH c as (SELECT {q.fields_clause}, ROW_NUMBER() OVER (PARTITION BY date, state, issue ORDER BY record_type) row FROM {q.table} WHERE {q.conditions_clause}) SELECT {q.fields_clause} FROM {q.alias}where row = 1 ORDER BY {q.order_clause}"
98
+
query=f"WITH c as (SELECT {q.fields_clause}, ROW_NUMBER() OVER (PARTITION BY date, state, issue ORDER BY record_type) row FROM {q.table} WHERE {q.conditions_clause}) SELECT {q.fields_clause} FROM {q.alias}WHERE row = 1 ORDER BY {q.order_clause}"
99
99
elifas_ofisnotNone:
100
100
sub_condition_asof="(issue <= :as_of)"
101
101
q.params["as_of"] =as_of
102
-
query=f"WITH c as (SELECT {q.fields_clause}, ROW_NUMBER() OVER (PARTITION BY date, state, issue ORDER BY record_type) row FROM {q.table} WHERE {q.conditions_clause}and{sub_condition_asof}) SELECT {q.fields_clause} FROM {q.alias}where row = 1 ORDER BY {q.order_clause}"
102
+
query=f"WITH c as (SELECT {q.fields_clause}, ROW_NUMBER() OVER (PARTITION BY date, state, issue ORDER BY record_type) row FROM {q.table} WHERE {q.conditions_clause}AND{sub_condition_asof}) SELECT {q.fields_clause} FROM {q.alias}WHERE row = 1 ORDER BY {q.order_clause}"
103
103
else:
104
104
# final query using most recent issues
105
105
subquery=f"(SELECT max(`issue`) `max_issue`, `date`, `state` FROM {q.table} WHERE {q.conditions_clause} GROUP BY `date`, `state`) x"
0 commit comments