Skip to content

Commit 1bebfa4

Browse files
committed
Fixed epivis geo_value processing for geo levels != state, nation
1 parent e3c860a commit 1bebfa4

File tree

1 file changed

+48
-13
lines changed

1 file changed

+48
-13
lines changed

src/indicatorsets/views.py

+48-13
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,49 @@ def get_related_indicators(self, queryset, indicator_set_ids: list):
7676
related_indicators.append(
7777
{
7878
"id": indicator.id,
79-
"display_name": indicator.get_display_name if indicator.get_display_name else "",
80-
"member_name": indicator.member_name if indicator.member_name else "",
81-
"member_short_name": indicator.member_short_name if indicator.member_short_name else "",
79+
"display_name": (
80+
indicator.get_display_name if indicator.get_display_name else ""
81+
),
82+
"member_name": (
83+
indicator.member_name if indicator.member_name else ""
84+
),
85+
"member_short_name": (
86+
indicator.member_short_name
87+
if indicator.member_short_name
88+
else ""
89+
),
8290
"name": indicator.name if indicator.name else "",
83-
"indicator_set": indicator.indicator_set.id if indicator.indicator_set else "",
84-
"indicator_set_name": indicator.indicator_set.name if indicator.indicator_set else "",
85-
"indicator_set_short_name": indicator.indicator_set.short_name if indicator.indicator_set else "",
86-
"endpoint": indicator.indicator_set.epidata_endpoint if indicator.indicator_set else "",
91+
"indicator_set": (
92+
indicator.indicator_set.id if indicator.indicator_set else ""
93+
),
94+
"indicator_set_name": (
95+
indicator.indicator_set.name if indicator.indicator_set else ""
96+
),
97+
"indicator_set_short_name": (
98+
indicator.indicator_set.short_name
99+
if indicator.indicator_set
100+
else ""
101+
),
102+
"endpoint": (
103+
indicator.indicator_set.epidata_endpoint
104+
if indicator.indicator_set
105+
else ""
106+
),
87107
"source": indicator.source.name if indicator.source else "",
88108
"time_type": indicator.time_type if indicator.time_type else "",
89-
"description": indicator.description if indicator.description else "",
90-
"member_description": indicator.member_description if indicator.member_description else indicator.description,
91-
"restricted": indicator.indicator_set.dua_required if indicator.indicator_set else "",
109+
"description": (
110+
indicator.description if indicator.description else ""
111+
),
112+
"member_description": (
113+
indicator.member_description
114+
if indicator.member_description
115+
else indicator.description
116+
),
117+
"restricted": (
118+
indicator.indicator_set.dua_required
119+
if indicator.indicator_set
120+
else ""
121+
),
92122
"source_type": indicator.source_type,
93123
}
94124
)
@@ -111,7 +141,9 @@ def get_url_params(self):
111141
if self.request.GET.get("severity_pyramid_rungs")
112142
else ""
113143
),
114-
"original_data_provider": [el for el in self.request.GET.getlist("original_data_provider")],
144+
"original_data_provider": [
145+
el for el in self.request.GET.getlist("original_data_provider")
146+
],
115147
"temporal_granularity": (
116148
[el for el in self.request.GET.getlist("temporal_granularity")]
117149
if self.request.GET.get("temporal_granularity")
@@ -186,8 +218,11 @@ def epivis(request):
186218
for indicator in indicators:
187219
if indicator["_endpoint"] == "covidcast":
188220
for geo in covidcast_geos:
189-
if geo["geoType"] in ["nation", "state"]:
190-
geo_value = geo["id"].lower()
221+
geo_value = (
222+
geo["id"].lower()
223+
if geo["geoType"] in ["nation", "state"]
224+
else geo["id"]
225+
)
191226
datasets.append(
192227
{
193228
"color": generate_random_color(),

0 commit comments

Comments
 (0)