Skip to content

Commit

Permalink
Allow location_id = None for PrevalenceAllLineagesByLocationHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
remoteeng00 committed Feb 22, 2023
1 parent cd0a27a commit f653193
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@


class PrevalenceAllLineagesByLocationHandler(BaseHandler):
# size = 100 # If size=1000 it will raise too_many_buckets_exception in case missing location_id in query.
name = "prevalence-by-location-all-lineages"
kwargs = dict(BaseHandler.kwargs)
kwargs["GET"] = {
"location_id": {"type": str, "required": True},
"location_id": {"type": str, "default": None},
"window": {"type": int, "default": None, "min": 1},
"other_threshold": {"type": float, "default": 0.05, "min": 0, "max": 1},
"nday_threshold": {"type": int, "default": 10, "min": 1},
Expand All @@ -42,7 +43,6 @@ async def _get(self):
query_cumulative = self.args.cumulative
query = {
"size": 0,
"query": {},
"aggs": {
"count": {
"terms": {"field": "date_collected", "size": self.size},
Expand All @@ -56,7 +56,9 @@ async def _get(self):
date_range_filter = create_date_range_filter(
"date_collected", self.args.min_date, self.args.max_date
)
query["query"] = parse_time_window_to_query(date_range_filter, query_obj=query_obj)
query_obj = parse_time_window_to_query(date_range_filter, query_obj=query_obj)
if query_obj:
query["query"] = query_obj
# import json
# print(json.dumps(query))
resp = await self.asynchronous_fetch(query)
Expand Down

0 comments on commit f653193

Please sign in to comment.