Skip to content

Commit f6883f3

Browse files
authored
Merge pull request #227 from cmu-delphi/development
Development
2 parents c50dcbf + ba7d6ce commit f6883f3

File tree

5 files changed

+50
-20
lines changed

5 files changed

+50
-20
lines changed

src/alternative_interface/helper.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
covidcast_fluview_locations_mapping = {
1+
COVIDCAST_FLUVIEW_LOCATIONS_MAPPING = {
22
"nation:US": "nat",
33
"hhs:1": "hhs1",
44
"hhs:2": "hhs2",
@@ -61,4 +61,24 @@
6161
"state:WI": "WI",
6262
"state:WV": "WV",
6363
"state:WY": "WY",
64-
}
64+
}
65+
66+
EXPRESS_VIEW_LABELS_MAPPING = {
67+
"smoothed_pct_ed_visits_influenza": "Influenza emergency department visits (NSSP)",
68+
"confirmed_admissions_flu_ew": "Influenza hospital admissions (NHSN)",
69+
"percent_positive": "Test positivity for influenza (ILINet)",
70+
"percent_a": "Test positivity for influenza A (ILINet)",
71+
"percent_b": "Test positivity for influenza B (ILINet)",
72+
"smoothed_flu_from_claims": "Influenza hospital admissions (from claims)",
73+
"deaths_flu_incidence_num": "Influenza deaths (NCHS)",
74+
"smoothed_cli": "Covid related doctor visits (from claims)",
75+
"smoothed_pct_ed_visits_covid": "Covid emergency department visits (NSSP)",
76+
"confirmed_admissions_covid_ew": "Covid hospital admissions (NHNS)",
77+
"smoothed_covid19_from_claims": "Covid hospital admissions (from claims)",
78+
"deaths_covid_incidence_num": "Covid deaths (NCHS)",
79+
"pct_ed_visits_rsv": "RSV emergency department visits (NSSP)",
80+
"confirmed_admissions_rsv_ew": "RSV hospital admissions (NHSN)",
81+
"pct_ed_visits_combined": "Combined emergency department visits (NSSP)",
82+
"wili": "ILI related doctor visits (ILINet)",
83+
"deaths_pneumonia_or_flu_or_covid_incidence_num": "Deaths from flu, Covid or pneumonia (NCHS)",
84+
}

src/alternative_interface/utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
get_epiweek,
1313
group_by_property,
1414
)
15-
from alternative_interface.helper import covidcast_fluview_locations_mapping
15+
from alternative_interface.helper import COVIDCAST_FLUVIEW_LOCATIONS_MAPPING, EXPRESS_VIEW_LABELS_MAPPING
1616

1717

1818
def epiweeks_in_date_range(start_date_str: str, end_date_str: str):
@@ -161,7 +161,7 @@ def get_covidcast_data(indicator, start_date, end_date, geo, api_key):
161161
def get_fluview_data(indicator, geo, start_date, end_date, api_key):
162162
region = None
163163
try:
164-
region = covidcast_fluview_locations_mapping[geo]
164+
region = COVIDCAST_FLUVIEW_LOCATIONS_MAPPING[geo]
165165
except KeyError:
166166
region = geo.split(":")[1]
167167
time_values = f"{start_date}--{end_date}"
@@ -173,7 +173,6 @@ def get_fluview_data(indicator, geo, start_date, end_date, api_key):
173173
"epiweeks": time_values,
174174
"api_key": api_key if api_key else settings.EPIDATA_API_KEY,
175175
}
176-
print(indicator)
177176
response = requests.get(f"{settings.EPIDATA_URL}{indicator['data_source']}", params=params)
178177
if response.status_code == 200:
179178
data = response.json()
@@ -437,7 +436,7 @@ def get_chart_data(indicators, geography):
437436
data_end_date = today.strftime("%Y-%m-%d")
438437

439438
for indicator in indicators:
440-
title = generate_epivis_custom_title(indicator, geo_display_name)
439+
title = EXPRESS_VIEW_LABELS_MAPPING.get(indicator["name"], generate_epivis_custom_title(indicator, geo_display_name))
441440
color = generate_random_color()
442441
indicator_time_type = indicator.get("time_type", "week")
443442
data = None
@@ -468,7 +467,7 @@ def get_chart_data(indicators, geography):
468467
)
469468
# Apply readable label, color, and normalize data for each dataset
470469
for ds in series["datasets"]:
471-
ds["label"] = f"{title} - {ds['label']}"
470+
ds["label"] = title
472471
ds["borderColor"] = color
473472
ds["backgroundColor"] = f"{color}33"
474473
# Normalize data to 0-100% range

src/assets/js/alter_dashboard.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,10 @@ class AlterDashboard {
398398
x: {
399399
display: true,
400400
grid: {
401-
display: false,
402-
drawBorder: false
401+
display: true,
402+
color: 'rgba(226, 232, 240, 0.5)',
403+
drawBorder: false,
404+
lineWidth: 1
403405
},
404406
ticks: {
405407
font: {

src/epiportal/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from sentry_sdk.integrations.redis import RedisIntegration
2626

2727
APP_VERSION = "1.0.14"
28-
ALTERNATIVE_INTERFACE_VERSION = "1.0.0"
28+
ALTERNATIVE_INTERFACE_VERSION = "1.0.1"
2929

3030

3131
EPIVIS_URL = os.environ.get("EPIVIS_URL", "https://delphi.cmu.edu/epivis/")

src/fixtures/census_regions.json

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"display_name": "Census Region 1",
88
"level": 3,
99
"geo_level": 3
10-
}
10+
},
11+
"pk": 4947
1112
},
1213
{
1314
"model": "base.GeographyUnit",
@@ -17,7 +18,8 @@
1718
"display_name": "Census Region 2",
1819
"level": 3,
1920
"geo_level": 3
20-
}
21+
},
22+
"pk": 4948
2123
},
2224
{
2325
"model": "base.GeographyUnit",
@@ -27,7 +29,8 @@
2729
"display_name": "Census Region 3",
2830
"level": 3,
2931
"geo_level": 3
30-
}
32+
},
33+
"pk": 4949
3134
},
3235
{
3336
"model": "base.GeographyUnit",
@@ -37,7 +40,8 @@
3740
"display_name": "Census Region 4",
3841
"level": 3,
3942
"geo_level": 3
40-
}
43+
},
44+
"pk": 4950
4145
},
4246
{
4347
"model": "base.GeographyUnit",
@@ -47,7 +51,8 @@
4751
"display_name": "Census Region 5",
4852
"level": 3,
4953
"geo_level": 3
50-
}
54+
},
55+
"pk": 4951
5156
},
5257
{
5358
"model": "base.GeographyUnit",
@@ -57,7 +62,8 @@
5762
"display_name": "Census Region 6",
5863
"level": 3,
5964
"geo_level": 3
60-
}
65+
},
66+
"pk": 4952
6167
},
6268
{
6369
"model": "base.GeographyUnit",
@@ -67,7 +73,8 @@
6773
"display_name": "Census Region 7",
6874
"level": 3,
6975
"geo_level": 3
70-
}
76+
},
77+
"pk": 4953
7178
},
7279
{
7380
"model": "base.GeographyUnit",
@@ -77,7 +84,8 @@
7784
"display_name": "Census Region 8",
7885
"level": 3,
7986
"geo_level": 3
80-
}
87+
},
88+
"pk": 4954
8189
},
8290
{
8391
"model": "base.GeographyUnit",
@@ -87,6 +95,7 @@
8795
"display_name": "Census Region 9",
8896
"level": 3,
8997
"geo_level": 3
90-
}
98+
},
99+
"pk": 4955
91100
}
92-
]
101+
]

0 commit comments

Comments
 (0)