Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/alternative_interface/helper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
covidcast_fluview_locations_mapping = {
COVIDCAST_FLUVIEW_LOCATIONS_MAPPING = {
"nation:US": "nat",
"hhs:1": "hhs1",
"hhs:2": "hhs2",
Expand Down Expand Up @@ -61,4 +61,24 @@
"state:WI": "WI",
"state:WV": "WV",
"state:WY": "WY",
}
}

EXPRESS_VIEW_LABELS_MAPPING = {
"smoothed_pct_ed_visits_influenza": "Influenza emergency department visits (NSSP)",
"confirmed_admissions_flu_ew": "Influenza hospital admissions (NHSN)",
"percent_positive": "Test positivity for influenza (ILINet)",
"percent_a": "Test positivity for influenza A (ILINet)",
"percent_b": "Test positivity for influenza B (ILINet)",
"smoothed_flu_from_claims": "Influenza hospital admissions (from claims)",
"deaths_flu_incidence_num": "Influenza deaths (NCHS)",
"smoothed_cli": "Covid related doctor visits (from claims)",
"smoothed_pct_ed_visits_covid": "Covid emergency department visits (NSSP)",
"confirmed_admissions_covid_ew": "Covid hospital admissions (NHNS)",
"smoothed_covid19_from_claims": "Covid hospital admissions (from claims)",
"deaths_covid_incidence_num": "Covid deaths (NCHS)",
"pct_ed_visits_rsv": "RSV emergency department visits (NSSP)",
"confirmed_admissions_rsv_ew": "RSV hospital admissions (NHSN)",
"pct_ed_visits_combined": "Combined emergency department visits (NSSP)",
"wili": "ILI related doctor visits (ILINet)",
"deaths_pneumonia_or_flu_or_covid_incidence_num": "Deaths from flu, Covid or pneumonia (NCHS)",
}
9 changes: 4 additions & 5 deletions src/alternative_interface/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
get_epiweek,
group_by_property,
)
from alternative_interface.helper import covidcast_fluview_locations_mapping
from alternative_interface.helper import COVIDCAST_FLUVIEW_LOCATIONS_MAPPING, EXPRESS_VIEW_LABELS_MAPPING


def epiweeks_in_date_range(start_date_str: str, end_date_str: str):
Expand Down Expand Up @@ -161,7 +161,7 @@ def get_covidcast_data(indicator, start_date, end_date, geo, api_key):
def get_fluview_data(indicator, geo, start_date, end_date, api_key):
region = None
try:
region = covidcast_fluview_locations_mapping[geo]
region = COVIDCAST_FLUVIEW_LOCATIONS_MAPPING[geo]
except KeyError:
region = geo.split(":")[1]
time_values = f"{start_date}--{end_date}"
Expand All @@ -173,7 +173,6 @@ def get_fluview_data(indicator, geo, start_date, end_date, api_key):
"epiweeks": time_values,
"api_key": api_key if api_key else settings.EPIDATA_API_KEY,
}
print(indicator)
response = requests.get(f"{settings.EPIDATA_URL}{indicator['data_source']}", params=params)
if response.status_code == 200:
data = response.json()
Expand Down Expand Up @@ -437,7 +436,7 @@ def get_chart_data(indicators, geography):
data_end_date = today.strftime("%Y-%m-%d")

for indicator in indicators:
title = generate_epivis_custom_title(indicator, geo_display_name)
title = EXPRESS_VIEW_LABELS_MAPPING.get(indicator["name"], generate_epivis_custom_title(indicator, geo_display_name))
color = generate_random_color()
indicator_time_type = indicator.get("time_type", "week")
data = None
Expand Down Expand Up @@ -468,7 +467,7 @@ def get_chart_data(indicators, geography):
)
# Apply readable label, color, and normalize data for each dataset
for ds in series["datasets"]:
ds["label"] = f"{title} - {ds['label']}"
ds["label"] = title
ds["borderColor"] = color
ds["backgroundColor"] = f"{color}33"
# Normalize data to 0-100% range
Expand Down
6 changes: 4 additions & 2 deletions src/assets/js/alter_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,10 @@ class AlterDashboard {
x: {
display: true,
grid: {
display: false,
drawBorder: false
display: true,
color: 'rgba(226, 232, 240, 0.5)',
drawBorder: false,
lineWidth: 1
},
ticks: {
font: {
Expand Down
2 changes: 1 addition & 1 deletion src/epiportal/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from sentry_sdk.integrations.redis import RedisIntegration

APP_VERSION = "1.0.14"
ALTERNATIVE_INTERFACE_VERSION = "1.0.0"
ALTERNATIVE_INTERFACE_VERSION = "1.0.1"


EPIVIS_URL = os.environ.get("EPIVIS_URL", "https://delphi.cmu.edu/epivis/")
Expand Down
29 changes: 19 additions & 10 deletions src/fixtures/census_regions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"display_name": "Census Region 1",
"level": 3,
"geo_level": 3
}
},
"pk": 4947
},
{
"model": "base.GeographyUnit",
Expand All @@ -17,7 +18,8 @@
"display_name": "Census Region 2",
"level": 3,
"geo_level": 3
}
},
"pk": 4948
},
{
"model": "base.GeographyUnit",
Expand All @@ -27,7 +29,8 @@
"display_name": "Census Region 3",
"level": 3,
"geo_level": 3
}
},
"pk": 4949
},
{
"model": "base.GeographyUnit",
Expand All @@ -37,7 +40,8 @@
"display_name": "Census Region 4",
"level": 3,
"geo_level": 3
}
},
"pk": 4950
},
{
"model": "base.GeographyUnit",
Expand All @@ -47,7 +51,8 @@
"display_name": "Census Region 5",
"level": 3,
"geo_level": 3
}
},
"pk": 4951
},
{
"model": "base.GeographyUnit",
Expand All @@ -57,7 +62,8 @@
"display_name": "Census Region 6",
"level": 3,
"geo_level": 3
}
},
"pk": 4952
},
{
"model": "base.GeographyUnit",
Expand All @@ -67,7 +73,8 @@
"display_name": "Census Region 7",
"level": 3,
"geo_level": 3
}
},
"pk": 4953
},
{
"model": "base.GeographyUnit",
Expand All @@ -77,7 +84,8 @@
"display_name": "Census Region 8",
"level": 3,
"geo_level": 3
}
},
"pk": 4954
},
{
"model": "base.GeographyUnit",
Expand All @@ -87,6 +95,7 @@
"display_name": "Census Region 9",
"level": 3,
"geo_level": 3
}
},
"pk": 4955
}
]
]
Loading