diff --git a/src/alternative_interface/helper.py b/src/alternative_interface/helper.py index 38051a8..c64f44a 100644 --- a/src/alternative_interface/helper.py +++ b/src/alternative_interface/helper.py @@ -1,4 +1,4 @@ -covidcast_fluview_locations_mapping = { +COVIDCAST_FLUVIEW_LOCATIONS_MAPPING = { "nation:US": "nat", "hhs:1": "hhs1", "hhs:2": "hhs2", @@ -61,4 +61,24 @@ "state:WI": "WI", "state:WV": "WV", "state:WY": "WY", -} \ No newline at end of file +} + +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)", +} diff --git a/src/alternative_interface/utils.py b/src/alternative_interface/utils.py index c068b1f..e95b318 100644 --- a/src/alternative_interface/utils.py +++ b/src/alternative_interface/utils.py @@ -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): @@ -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}" @@ -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() @@ -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 @@ -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 diff --git a/src/assets/js/alter_dashboard.js b/src/assets/js/alter_dashboard.js index 5e3746b..e3840f1 100644 --- a/src/assets/js/alter_dashboard.js +++ b/src/assets/js/alter_dashboard.js @@ -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: { diff --git a/src/epiportal/settings.py b/src/epiportal/settings.py index 6bad4c9..eb725d9 100644 --- a/src/epiportal/settings.py +++ b/src/epiportal/settings.py @@ -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/") diff --git a/src/fixtures/census_regions.json b/src/fixtures/census_regions.json index d1999b4..ac64625 100644 --- a/src/fixtures/census_regions.json +++ b/src/fixtures/census_regions.json @@ -7,7 +7,8 @@ "display_name": "Census Region 1", "level": 3, "geo_level": 3 - } + }, + "pk": 4947 }, { "model": "base.GeographyUnit", @@ -17,7 +18,8 @@ "display_name": "Census Region 2", "level": 3, "geo_level": 3 - } + }, + "pk": 4948 }, { "model": "base.GeographyUnit", @@ -27,7 +29,8 @@ "display_name": "Census Region 3", "level": 3, "geo_level": 3 - } + }, + "pk": 4949 }, { "model": "base.GeographyUnit", @@ -37,7 +40,8 @@ "display_name": "Census Region 4", "level": 3, "geo_level": 3 - } + }, + "pk": 4950 }, { "model": "base.GeographyUnit", @@ -47,7 +51,8 @@ "display_name": "Census Region 5", "level": 3, "geo_level": 3 - } + }, + "pk": 4951 }, { "model": "base.GeographyUnit", @@ -57,7 +62,8 @@ "display_name": "Census Region 6", "level": 3, "geo_level": 3 - } + }, + "pk": 4952 }, { "model": "base.GeographyUnit", @@ -67,7 +73,8 @@ "display_name": "Census Region 7", "level": 3, "geo_level": 3 - } + }, + "pk": 4953 }, { "model": "base.GeographyUnit", @@ -77,7 +84,8 @@ "display_name": "Census Region 8", "level": 3, "geo_level": 3 - } + }, + "pk": 4954 }, { "model": "base.GeographyUnit", @@ -87,6 +95,7 @@ "display_name": "Census Region 9", "level": 3, "geo_level": 3 - } + }, + "pk": 4955 } -] \ No newline at end of file +]