From 1af1f7d078a6c61bfe9d4371b5d8113279eeb5e6 Mon Sep 17 00:00:00 2001 From: Ben Hammond Date: Wed, 29 May 2024 17:45:05 -0600 Subject: [PATCH 01/10] Removes SVI as distinct data source (#3346) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description and Motivation - cdc_svi really should have been removed earlier when geo_context was introduced, this PR finally does it - on the frontend, the geo context provider conditionally adds in geo_context as a cited datasetId at the county level, otherwise only adds ACS - updates tests - updates dates ## Has this been tested? How? tests updated and passing ## Types of changes (leave all that apply) - Refactor / chore ## New frontend preview link is below in the Netlify comment 😎 --- airflow/dags/svi.py | 34 ------------ config/data_sources/cdc_svi_county.tf | 4 -- .../playwright-tests/hiv_prep.nightly.spec.ts | 12 ----- frontend/src/data/config/DatasetMetadata.ts | 16 ++---- frontend/src/data/config/MetadataMap.ts | 31 +++-------- .../data/providers/GeoContextProvider.test.ts | 8 +-- .../src/data/providers/GeoContextProvider.ts | 6 +-- .../DataMethodDefinitionsLink.tsx | 2 +- .../methodologySections/SdohLink.tsx | 2 +- python/datasources/data_sources.py | 2 - .../cdc_svi_county/cdc_svi_county_test.csv | 5 -- .../test_output_cdc_svi_county_by_age.csv | 5 -- .../tests/datasources/test_cdc_svi_county.py | 52 ------------------- 13 files changed, 21 insertions(+), 158 deletions(-) delete mode 100644 airflow/dags/svi.py delete mode 100644 config/data_sources/cdc_svi_county.tf delete mode 100644 python/tests/data/cdc_svi_county/cdc_svi_county_test.csv delete mode 100644 python/tests/data/cdc_svi_county/test_output_cdc_svi_county_by_age.csv delete mode 100644 python/tests/datasources/test_cdc_svi_county.py diff --git a/airflow/dags/svi.py b/airflow/dags/svi.py deleted file mode 100644 index ffb19be545..0000000000 --- a/airflow/dags/svi.py +++ /dev/null @@ -1,34 +0,0 @@ -# Ignore the Airflow module, it is installed in both dev and prod -# TEST UPDATE HERE 123 123 -from airflow import DAG # type: ignore -from airflow.utils.dates import days_ago # type: ignore - -import util - -_SVI_WORKFLOW_ID = 'CDC_SVI_COUNTY' -_SVI_DATASET_NAME = 'cdc_svi_county' - -default_args = { - 'start_date': days_ago(0), -} - -data_ingestion_dag = DAG( - 'svi_ingestion_dag', - default_args=default_args, - schedule_interval=None, - description='Ingestion configuration for SVI') - -svi_bq_payload = util.generate_bq_payload( - _SVI_WORKFLOW_ID, _SVI_DATASET_NAME) -svi_pop_bq_operator = util.create_bq_ingest_operator( - 'svi_to_bq', svi_bq_payload, data_ingestion_dag) - -svi_exporter_payload = {'dataset_name': _SVI_DATASET_NAME} -svi_exporter_operator = util.create_exporter_operator( - 'svi_exporter', svi_exporter_payload, data_ingestion_dag) - -# Ingestion DAG -( - svi_pop_bq_operator >> - svi_exporter_operator -) diff --git a/config/data_sources/cdc_svi_county.tf b/config/data_sources/cdc_svi_county.tf deleted file mode 100644 index 3c1f153ff0..0000000000 --- a/config/data_sources/cdc_svi_county.tf +++ /dev/null @@ -1,4 +0,0 @@ -resource "google_bigquery_dataset" "cdc_svi_county" { - dataset_id = "cdc_svi_county" - location = "US" -} diff --git a/frontend/playwright-tests/hiv_prep.nightly.spec.ts b/frontend/playwright-tests/hiv_prep.nightly.spec.ts index 1db6ffb03f..8a1206bc22 100644 --- a/frontend/playwright-tests/hiv_prep.nightly.spec.ts +++ b/frontend/playwright-tests/hiv_prep.nightly.spec.ts @@ -103,18 +103,6 @@ test('HIV PrEP', async ({ page }) => { await page .getByRole('heading', { name: 'Breakdown summary for PrEP' }) .click() - await page - .getByRole('figure', { name: 'Breakdown summary for PrEP' }) - .locator('h4') - .click() - await page.getByRole('columnheader', { name: 'Sex' }).click() - await page - .getByRole('columnheader', { name: 'PrEP coverage', exact: true }) - .click() - await page.getByRole('columnheader', { name: 'Share of total PrEP' }).click() - await page - .getByRole('columnheader', { name: 'PrEP-eligible population' }) - .click() await page.getByRole('columnheader', { name: 'Sex' }).click() await page.getByRole('cell', { name: 'Female' }).click() await page.getByRole('cell', { name: 'Male', exact: true }).click() diff --git a/frontend/src/data/config/DatasetMetadata.ts b/frontend/src/data/config/DatasetMetadata.ts index 7e1dfcacba..67c63c2d37 100644 --- a/frontend/src/data/config/DatasetMetadata.ts +++ b/frontend/src/data/config/DatasetMetadata.ts @@ -89,7 +89,6 @@ export type DatasetId = | 'cdc_restricted_data-by_sex_national_processed' | 'cdc_restricted_data-by_sex_state_processed_time_series' | 'cdc_restricted_data-by_sex_state_processed' - | 'cdc_svi_county-age' | 'cdc_vaccination_county-alls_county' | 'cdc_vaccination_national-age_processed' // TODO: rm "processed" on the backend and use the actual geography "national" | 'cdc_vaccination_national-race_processed' // TODO: rm "processed" on the backend and use the actual geography "national" @@ -598,11 +597,6 @@ export const DatasetMetadataMap: Record = { original_data_sourced: 'January 2020 - April 2024', source_id: 'cdc_restricted', }, - 'cdc_svi_county-age': { - name: 'National SVI (Social Vulnerability Index) by county', - original_data_sourced: '2022', - source_id: 'cdc_svi_county', - }, 'cdc_vaccination_county-alls_county': { name: 'COVID-19 vaccinations by county', contains_nh: true, @@ -760,18 +754,18 @@ export const DatasetMetadataMap: Record = { }, 'geo_context-national': { name: 'Population from ACS nationally', - original_data_sourced: '2019', + original_data_sourced: '2022', source_id: 'acs', }, 'geo_context-state': { name: 'Population from ACS by state', - original_data_sourced: '2019', + original_data_sourced: '2022', source_id: 'acs', }, 'geo_context-county': { - name: 'Population from ACS by county; SVI from CDC', - original_data_sourced: '2019', - source_id: 'acs', + name: 'SVI from CDC, Population from ACS by county', + original_data_sourced: '2022', + source_id: 'geo_context', }, [GEOGRAPHIES_DATASET_ID]: { name: 'U.S. Geographic Data', diff --git a/frontend/src/data/config/MetadataMap.ts b/frontend/src/data/config/MetadataMap.ts index 35a4332e7b..b248b42fba 100644 --- a/frontend/src/data/config/MetadataMap.ts +++ b/frontend/src/data/config/MetadataMap.ts @@ -14,7 +14,6 @@ export type DataSourceId = | 'cawp' | 'cdc_atlas' | 'cdc_restricted' - | 'cdc_svi_county' | 'cdc_vaccination_county' | 'cdc_vaccination_national' | 'cdc_wisqars_data' @@ -170,22 +169,6 @@ export const dataSourceMetadataMap: Record = { downloadable: true, time_period_range: null, }, - cdc_svi_county: { - id: 'cdc_svi_county', - data_source_name: 'CDC SVI County Rankings', - data_source_acronym: 'CDC', - data_source_pretty_site_name: 'atsdr.cdc.gov', - data_source_link: - 'https://www.atsdr.cdc.gov/placeandhealth/svi/documentation/SVI_documentation_2022.html', - geographic_level: 'County', - demographic_granularity: 'None', - update_frequency: 'Biannual', - description: - 'Every community must prepare for and respond to hazardous events, whether a natural disaster like a tornado or a disease outbreak, or an anthropogenic event such as a harmful chemical spill. The degree to which a community exhibits certain social conditions, including high poverty, low percentage of vehicle access, or crowded households, may affect that community’s ability to prevent human suffering and financial loss in the event of disaster. These factors describe a community’s social vulnerability.', - dataset_ids: ['cdc_svi_county-age'], - downloadable: true, - time_period_range: null, - }, cdc_vaccination_county: { id: 'cdc_vaccination_county', data_source_name: 'CDC COVID-19 Vaccinations in the United States, County', @@ -403,17 +386,17 @@ export const dataSourceMetadataMap: Record = { }, geo_context: { id: 'geo_context', - data_source_name: 'Geographic Context - Composite Dataset', - data_source_acronym: 'CDC, ACS', + data_source_name: 'CDC SVI Rankings', + data_source_acronym: 'CDC', data_source_pretty_site_name: - 'github.com/SatcherInstitute/health-equity-tracker', + 'atsdr.cdc.gov', data_source_link: - 'https://github.com/SatcherInstitute/health-equity-tracker', - geographic_level: 'National, State, County', + 'https://www.atsdr.cdc.gov/placeandhealth/svi/data_documentation_download.html', + geographic_level: 'County', demographic_granularity: 'N/A', - update_frequency: 'Yearly', + update_frequency: 'Every 2 Years', description: - 'This is a composite dataset we create for faster loading; it includes population data from ACS and SVI data at the county level from the CDC.', + 'This is a composite dataset we create for faster loading; it includes population data from ACS and SVI data at the county level from the CDC. SVI: Every community must prepare for and respond to hazardous events, whether a natural disaster like a tornado or a disease outbreak, or an anthropogenic event such as a harmful chemical spill. The degree to which a community exhibits certain social conditions, including high poverty, low percentage of vehicle access, or crowded households, may affect that community’s ability to prevent human suffering and financial loss in the event of disaster. These factors describe a community’s social vulnerability.', dataset_ids: [ 'geo_context-county', 'geo_context-state', diff --git a/frontend/src/data/providers/GeoContextProvider.test.ts b/frontend/src/data/providers/GeoContextProvider.test.ts index 3d46282fb9..70913872c8 100644 --- a/frontend/src/data/providers/GeoContextProvider.test.ts +++ b/frontend/src/data/providers/GeoContextProvider.test.ts @@ -53,7 +53,7 @@ describe('GeoContextProvider', () => { new Fips('06037'), ['svi', 'population'], 'geo_context-county', - ['cdc_svi_county-age', 'acs_population-by_sex_county'] + ['geo_context-county', 'acs_population-by_sex_county'] ) }) @@ -62,7 +62,7 @@ describe('GeoContextProvider', () => { new Fips('06037'), ['svi'], 'geo_context-county', - ['cdc_svi_county-age'] + ['geo_context-county'] ) }) @@ -71,7 +71,7 @@ describe('GeoContextProvider', () => { new Fips('72123'), ['svi', 'population'], 'geo_context-county', - ['cdc_svi_county-age', 'acs_population-by_sex_county'] + ['geo_context-county', 'acs_population-by_sex_county'] ) }) @@ -81,7 +81,7 @@ describe('GeoContextProvider', () => { ['svi', 'population'], 'geo_context-county', [ - 'cdc_svi_county-age', + 'geo_context-county', 'decia_2020_territory_population-by_sex_territory_county_level', ] ) diff --git a/frontend/src/data/providers/GeoContextProvider.ts b/frontend/src/data/providers/GeoContextProvider.ts index 6b973320d6..a69c7230e3 100644 --- a/frontend/src/data/providers/GeoContextProvider.ts +++ b/frontend/src/data/providers/GeoContextProvider.ts @@ -25,6 +25,7 @@ class GeoContextProvider extends VariableProvider { const breakdowns = metricQuery.breakdowns const datasetId = this.getDatasetId(breakdowns) if (!datasetId) throw Error('DatasetId undefined') + const specificDatasetId = appendFipsIfNeeded(datasetId, breakdowns) const geoContext = await getDataManager().loadDataset(specificDatasetId) @@ -36,9 +37,8 @@ class GeoContextProvider extends VariableProvider { // handles both SVI and/or POPULATION requests, need to dynamically infer the consumed datasets for footer const consumedDatasetIds: DatasetId[] = [] - if (metricQuery.metricIds.includes(SVI)) { - // TODO: refactor SVI to not use pretend AGE demographic type, use ALL demographic type like in covid vaxx by county - consumedDatasetIds.push('cdc_svi_county-age') + if (breakdowns.geography === 'county') { + consumedDatasetIds.push('geo_context-county') } const acsDatasetMap: Record = { diff --git a/frontend/src/pages/Methodology/methodologySections/DataMethodDefinitionsLink.tsx b/frontend/src/pages/Methodology/methodologySections/DataMethodDefinitionsLink.tsx index 719d446ae4..461dad0f3f 100644 --- a/frontend/src/pages/Methodology/methodologySections/DataMethodDefinitionsLink.tsx +++ b/frontend/src/pages/Methodology/methodologySections/DataMethodDefinitionsLink.tsx @@ -4,7 +4,7 @@ import { DatasetMetadataMap } from '../../../data/config/DatasetMetadata' export default function DataMethodDefinitionsLink() { const acsYear = DatasetMetadataMap["acs_population-by_race_national"].original_data_sourced - const sviYear = DatasetMetadataMap["cdc_svi_county-age"].original_data_sourced + const sviYear = DatasetMetadataMap["geo_context-county"].original_data_sourced return (
diff --git a/frontend/src/pages/Methodology/methodologySections/SdohLink.tsx b/frontend/src/pages/Methodology/methodologySections/SdohLink.tsx index c03b24f59a..7113badea6 100644 --- a/frontend/src/pages/Methodology/methodologySections/SdohLink.tsx +++ b/frontend/src/pages/Methodology/methodologySections/SdohLink.tsx @@ -20,7 +20,7 @@ const sdohDataSources = [ dataSourceMetadataMap.acs, dataSourceMetadataMap.ahr, dataSourceMetadataMap.chr, - dataSourceMetadataMap.cdc_svi_county, + dataSourceMetadataMap.geo_context, ] // delete this, load from missingDataBlurbs instead diff --git a/python/datasources/data_sources.py b/python/datasources/data_sources.py index 96e728f951..8d863463ec 100644 --- a/python/datasources/data_sources.py +++ b/python/datasources/data_sources.py @@ -7,7 +7,6 @@ from datasources.cawp_time import CAWPTimeData from datasources.cdc_hiv import CDCHIVData from datasources.cdc_restricted import CDCRestrictedData -from datasources.cdc_svi_county import CDCSviCounty from datasources.cdc_vaccination_county import CDCVaccinationCounty from datasources.cdc_vaccination_national import CDCVaccinationNational from datasources.cdc_wisqars import CDCWisqarsData @@ -37,7 +36,6 @@ CAWPTimeData.get_id(): CAWPTimeData(), CDCHIVData.get_id(): CDCHIVData(), CDCRestrictedData.get_id(): CDCRestrictedData(), - CDCSviCounty.get_id(): CDCSviCounty(), CDCVaccinationCounty.get_id(): CDCVaccinationCounty(), CDCVaccinationNational.get_id(): CDCVaccinationNational(), CDCWisqarsData.get_id(): CDCWisqarsData(), diff --git a/python/tests/data/cdc_svi_county/cdc_svi_county_test.csv b/python/tests/data/cdc_svi_county/cdc_svi_county_test.csv deleted file mode 100644 index 3481e663a2..0000000000 --- a/python/tests/data/cdc_svi_county/cdc_svi_county_test.csv +++ /dev/null @@ -1,5 +0,0 @@ -ST,STATE,ST_ABBR,STCNTY,COUNTY,FIPS,LOCATION,AREA_SQMI,E_TOTPOP,M_TOTPOP,E_HU,M_HU,E_HH,M_HH,E_POV150,M_POV150,E_UNEMP,M_UNEMP,E_HBURD,M_HBURD,E_NOHSDP,M_NOHSDP,E_UNINSUR,M_UNINSUR,E_AGE65,M_AGE65,E_AGE17,M_AGE17,E_DISABL,M_DISABL,E_SNGPNT,M_SNGPNT,E_LIMENG,M_LIMENG,E_MINRTY,M_MINRTY,E_MUNIT,M_MUNIT,E_MOBILE,M_MOBILE,E_CROWD,M_CROWD,E_NOVEH,M_NOVEH,E_GROUPQ,M_GROUPQ,EP_POV150,MP_POV150,EP_UNEMP,MP_UNEMP,EP_HBURD,MP_HBURD,EP_NOHSDP,MP_NOHSDP,EP_UNINSUR,MP_UNINSUR,EP_AGE65,MP_AGE65,EP_AGE17,MP_AGE17,EP_DISABL,MP_DISABL,EP_SNGPNT,MP_SNGPNT,EP_LIMENG,MP_LIMENG,EP_MINRTY,MP_MINRTY,EP_MUNIT,MP_MUNIT,EP_MOBILE,MP_MOBILE,EP_CROWD,MP_CROWD,EP_NOVEH,MP_NOVEH,EP_GROUPQ,MP_GROUPQ,EPL_POV150,EPL_UNEMP,EPL_HBURD,EPL_NOHSDP,EPL_UNINSUR,SPL_THEME1,RPL_THEME1,EPL_AGE65,EPL_AGE17,EPL_DISABL,EPL_SNGPNT,EPL_LIMENG,SPL_THEME2,RPL_THEME2,EPL_MINRTY,SPL_THEME3,RPL_THEME3,EPL_MUNIT,EPL_MOBILE,EPL_CROWD,EPL_NOVEH,EPL_GROUPQ,SPL_THEME4,RPL_THEME4,SPL_THEMES,RPL_THEMES,F_POV150,F_UNEMP,F_HBURD,F_NOHSDP,F_UNINSUR,F_THEME1,F_AGE65,F_AGE17,F_DISABL,F_SNGPNT,F_LIMENG,F_THEME2,F_MINRTY,F_THEME3,F_MUNIT,F_MOBILE,F_CROWD,F_NOVEH,F_GROUPQ,F_THEME4,F_TOTAL,E_DAYPOP,E_NOINT,M_NOINT,E_AFAM,M_AFAM,E_HISP,M_HISP,E_ASIAN,M_ASIAN,E_AIAN,M_AIAN,E_NHPI,M_NHPI,E_TWOMORE,M_TWOMORE,E_OTHERRACE,M_OTHERRACE,EP_NOINT,MP_NOINT,EP_AFAM,MP_AFAM,EP_HISP,MP_HISP,EP_ASIAN,MP_ASIAN,EP_AIAN,MP_AIAN,EP_NHPI,MP_NHPI,EP_TWOMORE,MP_TWOMORE,EP_OTHERRACE,MP_OTHERRACE -01,Alabama,AL,01001,Autauga County,01001,"Autauga County, Alabama",594.454786355022,58761,0,24457,41,22308,369,11780,1363,752,215,4389,582,3857,512,4225,753,9176,98,13766,42,9425,631,1247,296,203,198,16126,224,970,374,3805,440,307,163,888,237,551,21,20.2,2.3,2.8,0.8,19.7,2.6,9.6,1.3,7.4,1.3,15.6,0.2,23.4,0.1,16.4,1.1,5.6,1.3,0.4,0.4,27.4,0.4,3.9,1.5,15.6,1.8,1.4,0.7,4.0,1.1,0.9,0.0,0.3621,0.1457,0.3388,0.4276,0.412,1.6862,0.2367,0.1718,0.6962,0.5581,0.5304,0.315,2.2715,0.3675,0.6354,0.6354,0.6354,0.5921,0.6892,0.3198,0.2491,0.1091,1.9593,0.2358,6.5524,0.2663,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42938,2425,385,11496,525,1864,0,636,213,59,71,0,30,1930,598,141,183,10.9,1.7,19.6,0.9,3.2,0.0,1.1,0.4,0.1,0.1,0.0,0.1,3.3,1.0,0.2,0.3 -24,Maryland,MD,24019,Dorchester County,24019,"Dorchester County, Maryland",540.764325250296,32557,0,16400,60,13216,446,8220,804,870,231,4161,423,2855,394,1690,378,7145,71,6852,45,5486,454,1284,217,509,191,12584,137,783,177,1164,278,84,53,1319,225,539,10,25.6,2.5,5.5,1.4,31.5,3.0,12.2,1.7,5.2,1.2,21.9,0.2,21.0,0.1,17.0,1.4,9.8,1.6,1.7,0.6,38.7,0.4,4.8,1.1,7.1,1.7,0.7,0.3,10.0,1.7,1.7,0.0,0.6163,0.6583,0.9625,0.6141,0.1798,3.031,0.6809,0.727,0.3659,0.6134,0.9395,0.7369,3.3827,0.9513,0.7655,0.7655,0.7655,0.6694,0.3621,0.0948,0.9205,0.4003,2.4471,0.4766,9.6263,0.7824,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,3,29476,1867,225,8327,337,1992,0,438,27,4,6,0,28,1658,375,165,114,14.1,1.5,25.6,1.0,6.1,0.0,1.3,0.1,0.0,0.1,0.0,0.1,5.1,1.2,0.5,0.3 -04,Arizona,AZ,04021,Pinal County,04021,"Pinal County, Arizona",5366.668332579862,433338,0,175474,161,151490,1024,82155,4274,11752,1073,34489,1586,34951,1704,39591,2493,89957,51,95425,0,66624,2363,8205,699,11376,1059,195761,590,3842,614,30426,1182,6244,626,5354,551,20772,451,20.0,1.0,6.4,0.6,22.8,1.0,11.5,0.6,9.6,0.6,20.8,0.1,22.0,0.0,16.1,0.6,5.4,0.5,2.8,0.3,45.2,0.1,2.2,0.3,17.3,0.7,4.1,0.4,3.5,0.4,4.8,0.1,0.3497,0.7919,0.6007,0.5695,0.5927,2.9045,0.6347,0.6459,0.5014,0.5301,0.4922,0.8438,3.0134,0.8374,0.833,0.833,0.833,0.3853,0.7404,0.8801,0.1833,0.8085,2.9976,0.7521,9.7485,0.797,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,286463,14138,978,18929,745,135346,0,6423,467,16638,633,1462,162,15604,1077,1359,491,9.3,0.6,4.4,0.2,31.2,0.0,1.5,0.1,3.8,0.1,0.3,0.1,3.6,0.2,0.3,0.1 -06,California,CA,06007,Butte County,06007,"Butte County, California",1636.488965591808,213605,0,93069,80,83319,903,58898,2671,7344,822,26926,1292,13468,864,13966,1165,38852,40,43011,0,34705,1497,4138,450,5128,665,66604,596,8319,748,10285,710,3146,472,5063,483,6182,91,28.2,1.3,7.1,0.8,32.3,1.5,9.7,0.6,6.6,0.6,18.2,0.1,20.1,0.0,16.4,0.7,5.0,0.5,2.5,0.3,31.2,0.3,8.9,0.8,11.1,0.8,3.8,0.5,6.1,0.6,2.9,0.0,0.7245,0.8546,0.9714,0.4375,0.3303,3.3183,0.7706,0.3793,0.2698,0.5581,0.4082,0.8244,2.4398,0.4843,0.6806,0.6806,0.6806,0.8435,0.5409,0.8587,0.6083,0.6507,3.5021,0.9437,9.9408,0.8225,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,210449,8412,667,3695,267,38361,0,10818,566,1514,256,605,97,10992,781,619,467,10.1,0.8,1.7,0.1,18.0,0.0,5.1,0.3,0.7,0.1,0.3,0.1,5.1,0.4,0.3,0.2 diff --git a/python/tests/data/cdc_svi_county/test_output_cdc_svi_county_by_age.csv b/python/tests/data/cdc_svi_county/test_output_cdc_svi_county_by_age.csv deleted file mode 100644 index 29eb06ab75..0000000000 --- a/python/tests/data/cdc_svi_county/test_output_cdc_svi_county_by_age.csv +++ /dev/null @@ -1,5 +0,0 @@ -county_fips,county_name,age,svi -01001,Autauga County,All,0.27 -24019,Dorchester County,All,0.78 -04021,Pinal County,All,0.80 -06007,Butte County,All,0.82 diff --git a/python/tests/datasources/test_cdc_svi_county.py b/python/tests/datasources/test_cdc_svi_county.py deleted file mode 100644 index e421616aa1..0000000000 --- a/python/tests/datasources/test_cdc_svi_county.py +++ /dev/null @@ -1,52 +0,0 @@ -from unittest import mock -import os - -import pandas as pd -from pandas._testing import assert_frame_equal -from datasources.cdc_svi_county import CDCSviCounty, format_svi - -# insert unit tests - - -def test_format_svi(): - assert format_svi(0.4354) == 0.44 - - -# Current working directory. -THIS_DIR = os.path.dirname(os.path.abspath(__file__)) -TEST_DIR = os.path.join(THIS_DIR, os.pardir, "data", "cdc_svi_county") -REAL_DIR = os.path.abspath('data/cdc_svi_county') - - -GOLDEN_DATA = os.path.join(TEST_DIR, 'test_output_cdc_svi_county_by_age.csv') - - -def get_svi_as_df(): - return pd.read_csv(os.path.join(TEST_DIR, 'cdc_svi_county_test.csv'), dtype={"FIPS": str}) - - -@mock.patch( - 'ingestion.gcs_to_bq_util.load_csv_as_df_from_data_dir', - return_value=get_svi_as_df(), -) -@mock.patch('ingestion.gcs_to_bq_util.add_df_to_bq', return_value=None) -def testWriteToBq(mock_bq: mock.MagicMock, mock_csv: mock.MagicMock): - cdcSviCounty = CDCSviCounty() - - kwargs = { - 'filename': 'test_file.csv', - 'metadata_table_id': 'test_metadata', - 'table_name': 'output_table', - } - - cdcSviCounty.write_to_bq('dataset', 'gcs_bucket', **kwargs) - assert mock_bq.call_count == 1 - assert mock_csv.call_count == 1 - - expected_df = pd.read_csv( - GOLDEN_DATA, - dtype={ - 'county_fips': str, - }, - ) - assert_frame_equal(mock_bq.call_args_list[0].args[0], expected_df, check_like=True) From 8c55dc4b48dc08cb484be0fb9d8c1f5fc532135c Mon Sep 17 00:00:00 2001 From: Ben Hammond Date: Thu, 30 May 2024 13:12:34 -0600 Subject: [PATCH 02/10] Ts fix playwrightconfig (#3349) --- frontend/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 8414c70e78..8b0778a817 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -29,6 +29,7 @@ }, "include": [ "src", + "playwright.config.ts" ], "exclude": [ "src/assets", From 922f2a19ad52c4600edb19a9c56d8487a9a140c9 Mon Sep 17 00:00:00 2001 From: Ben Hammond Date: Thu, 30 May 2024 13:29:33 -0600 Subject: [PATCH 03/10] Fixes missing multimap bug (#3348) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description and Motivation - Fixes #3071 - the `fieldRange` prop was getting passed through, and that function was only filtering out `NaN` values but not `null` values. This was causing the weirdness (i think) - adds unit test coverage for this edge case - memoizes the fieldRange call rather than invoking it on every render ## Has this been tested? How? - adds unit test - tests pass - manually confirmed on various reports, including one that includes a real zero value which gets properly colored ## Screenshots (if appropriate) Screenshot 2024-05-30 at 11 39 02 AM Screenshot 2024-05-30 at 11 39 15 AM ## Types of changes (leave all that apply) - Bug fix - Refactor / chore ## New frontend preview link is below in the Netlify comment 😎 --- frontend/package-lock.json | 8 ++++---- frontend/package.json | 4 ++-- frontend/playwright.config.ts | 2 +- frontend/src/cards/MapCard.tsx | 7 +++++-- frontend/src/cards/ui/MultiMapDialog.tsx | 2 +- frontend/src/data/query/MetricQuery.test.ts | 10 +++++++++- frontend/src/data/query/MetricQuery.ts | 5 +++-- 7 files changed, 25 insertions(+), 13 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index c22468c555..d1787a0cbc 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -57,7 +57,7 @@ "@testing-library/react": "^15.0.7", "@types/d3": "^7.4.0", "@types/lodash": "^4.17.4", - "@types/node": "^20.12.12", + "@types/node": "^20.12.13", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@types/react-lazyload": "^3.2.0", @@ -3253,9 +3253,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.12.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz", - "integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==", + "version": "20.12.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.13.tgz", + "integrity": "sha512-gBGeanV41c1L171rR7wjbMiEpEI/l5XFQdLLfhr/REwpgDy/4U8y89+i8kRiLzDyZdOkXh+cRaTetUnCYutoXA==", "devOptional": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/frontend/package.json b/frontend/package.json index 6a69a53bec..0f99c263b9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -60,7 +60,7 @@ "@testing-library/react": "^15.0.7", "@types/d3": "^7.4.0", "@types/lodash": "^4.17.4", - "@types/node": "^20.12.12", + "@types/node": "^20.12.13", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@types/react-lazyload": "^3.2.0", @@ -119,4 +119,4 @@ "last 1 safari version" ] } -} \ No newline at end of file +} diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index a8252ccdec..4ec9d21608 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -12,7 +12,7 @@ const config: PlaywrightTestConfig = { }, testDir: './playwright-tests', /* Maximum time one test can run for, default was 30s. */ - timeout: process.env.CI ? 120 * 1000 : 60 * 1000, + timeout: process.env.CI ? 120 * 1000 : 90 * 1000, /* Maximum time one "expect" can run for, default was 5 seconds and was too quick */ expect: { timeout: 90 * 1000 diff --git a/frontend/src/cards/MapCard.tsx b/frontend/src/cards/MapCard.tsx index 279d6a9cc2..2d1677793b 100644 --- a/frontend/src/cards/MapCard.tsx +++ b/frontend/src/cards/MapCard.tsx @@ -42,7 +42,7 @@ import { useGuessPreloadHeight } from '../utils/hooks/useGuessPreloadHeight' import { generateChartTitle, generateSubtitle } from '../charts/utils' import { useLocation } from 'react-router-dom' import { type ScrollableHashId } from '../utils/hooks/useStepObserver' -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import { getHighestLowestGroupsByFips } from '../charts/mapHelperFunctions' import { Legend } from '../charts/Legend' import GeoContext, { @@ -441,6 +441,9 @@ function MapCardWithKey(props: MapCardProps) { const percentRateTooHigh = metricConfig.type === 'pct_rate' && mapQueryResponse.data.some((row) => row[metricConfig.metricId] > 100) + const fieldRange = useMemo(() => { + return mapQueryResponse.getFieldRange(metricConfig.metricId) + }, [mapQueryResponse.data, metricConfig.metricId]) return ( <> @@ -451,7 +454,7 @@ function MapCardWithKey(props: MapCardProps) { demographicGroupsNoData={fieldValues.noData} countColsMap={countColsMap} data={mapQueryResponse.data} - fieldRange={mapQueryResponse.getFieldRange(metricConfig.metricId)} + fieldRange={fieldRange} fips={props.fips} geoData={geoData} handleClose={() => { diff --git a/frontend/src/cards/ui/MultiMapDialog.tsx b/frontend/src/cards/ui/MultiMapDialog.tsx index e4006bc0c9..f726eb063b 100644 --- a/frontend/src/cards/ui/MultiMapDialog.tsx +++ b/frontend/src/cards/ui/MultiMapDialog.tsx @@ -188,7 +188,7 @@ export default function MultiMapDialog(props: MultiMapDialogProps) { {mapLabel}
- {props.metricConfig && dataForValue.length > 0 && ( + {props.metricConfig && dataForValue?.length > 0 && ( { fips: '01', race_and_ethnicity: 'Asian (NH)', covid_cases: undefined, + covid_hosp: null, // null should also be ignored as invalid invalid: undefined, }, { fips: '01', race_and_ethnicity: 'Native Hawaiian and Pacific Islander (NH)', - covid_cases: 0, + covid_cases: 0, // 0 should be the min + covid_hosp: 1, // 1 should be the min invalid: undefined, }, { fips: '02', race_and_ethnicity: 'White', covid_cases: 12, + covid_hosp: 12, invalid: undefined, }, { @@ -61,6 +64,10 @@ describe('MetricQueryResponse', () => { min: 0, max: 12, }) + expect(metricQueryResponse.getFieldRange('covid_hosp')).toEqual({ + min: 1, + max: 12, + }) expect(metricQueryResponse.getFieldRange(RACE as MetricId)).toEqual( undefined ) @@ -83,6 +90,7 @@ describe('MetricQueryResponse', () => { test('fieldHasMissingValues()', async () => { expect(metricQueryResponse.invalidValues).toEqual({ covid_cases: 1, + covid_hosp: 1, invalid: 7, }) expect(metricQueryResponse.isFieldMissing('covid_cases')).toEqual(false) diff --git a/frontend/src/data/query/MetricQuery.ts b/frontend/src/data/query/MetricQuery.ts index dce6aba852..bfe129c555 100644 --- a/frontend/src/data/query/MetricQuery.ts +++ b/frontend/src/data/query/MetricQuery.ts @@ -56,7 +56,7 @@ function getInvalidValues(rows: Row[]) { export function createMissingDataResponse(missingDataMessage: string) { return new MetricQueryResponse( [], - /* consumedDatasetIds= */ [], + /* consumedDatasetIds= */[], missingDataMessage ) } @@ -92,11 +92,12 @@ export class MetricQueryResponse { // Calculate numerical range for a field or return undefined if not applicable getFieldRange(fieldName: MetricId): FieldRange | undefined { const fieldValues = this.data - .filter((row) => !isNaN(row[fieldName])) + .filter((row) => !isNaN(row[fieldName]) && row[fieldName] != null) .map((row) => row[fieldName]) if (fieldValues.length === 0) { return undefined } + return { min: Math.min(...fieldValues), max: Math.max(...fieldValues), From 11abfa604ed2b109e7653d6c20c4021abffd1186 Mon Sep 17 00:00:00 2001 From: Ben Hammond Date: Fri, 31 May 2024 13:12:59 -0600 Subject: [PATCH 04/10] Updates Sitemap and Internal Routes (#3350) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description and Motivation - closes #2820 - removes/renames some deprecated routes ## Has this been tested? How? Tests passing ## Types of changes (leave all that apply) - Refactor / chore ## New frontend preview link is below in the Netlify comment 😎 --- frontend/public/sitemap.txt | 38 +++++++++++++------ frontend/src/App.tsx | 8 ++-- .../src/pages/WhatIsHealthEquity/FaqTab.tsx | 4 +- frontend/src/pages/ui/SignupSection.tsx | 4 +- frontend/src/reports/WhatDataAreMissing.tsx | 4 +- .../src/styles/HetComponents/HetFooterNav.tsx | 8 ++-- frontend/src/utils/internalRoutes.ts | 11 +++--- 7 files changed, 46 insertions(+), 31 deletions(-) diff --git a/frontend/public/sitemap.txt b/frontend/public/sitemap.txt index 7e9f290c88..bd4cba8942 100644 --- a/frontend/public/sitemap.txt +++ b/frontend/public/sitemap.txt @@ -1,20 +1,36 @@ https://healthequitytracker.org -https://healthequitytracker.org/whatishealthequity -https://healthequitytracker.org/faqs -https://healthequitytracker.org/resources +https://healthequitytracker.org/aboutus +https://healthequitytracker.org/datacatalog https://healthequitytracker.org/exploredata +https://healthequitytracker.org/exploredata?mls=1.copd-3.diabetes-5.00&mlp=comparevars https://healthequitytracker.org/exploredata?mls=1.covid-3.00-5.13&mlp=comparegeos -https://healthequitytracker.org/exploredata?mls=1.covid-3.covid_vaccinations-5.00&mlp=comparevars https://healthequitytracker.org/exploredata?mls=1.covid-3.06037-5.36061&mlp=comparegeos +https://healthequitytracker.org/exploredata?mls=1.covid-3.covid_vaccinations-5.00&mlp=comparevars https://healthequitytracker.org/exploredata?mls=1.depression-3.06075&mlp=disparity https://healthequitytracker.org/exploredata?mls=1.excessive_drinking-3.26&mlp=disparity https://healthequitytracker.org/exploredata?mls=1.frequent_mental_distress-3.48&mlp=disparity -https://healthequitytracker.org/exploredata?mls=1.substance-3.17&mlp=disparity https://healthequitytracker.org/exploredata?mls=1.health_insurance-3.poverty-5.11&mlp=comparevars -https://healthequitytracker.org/exploredata?mls=1.copd-3.diabetes-5.00&mlp=comparevars -https://healthequitytracker.org/datacatalog +https://healthequitytracker.org/exploredata?mls=1.substance-3.17&mlp=disparity +https://healthequitytracker.org/faqs https://healthequitytracker.org/methodology -https://healthequitytracker.org/aboutus -https://healthequitytracker.org/ourteam -https://healthequitytracker.org/contact -https://healthequitytracker.org/termsofuse \ No newline at end of file +https://healthequitytracker.org/methodology/data-sources +https://healthequitytracker.org/methodology/topic-categories +https://healthequitytracker.org/methodology/topic-categories/behavioral-health +https://healthequitytracker.org/methodology/topic-categories/chronic-disease +https://healthequitytracker.org/methodology/topic-categories/covid +https://healthequitytracker.org/methodology/topic-categories/hiv +https://healthequitytracker.org/methodology/topic-categories/pdoh +https://healthequitytracker.org/methodology/topic-categories/sdoh +https://healthequitytracker.org/methodology/topic-categories/medication-utilization +https://healthequitytracker.org/methodology/definitions +https://healthequitytracker.org/methodology/limitations +https://healthequitytracker.org/methodology/definitions/metrics +https://healthequitytracker.org/methodology/definitions/topic-definitions +https://healthequitytracker.org/methodology/definitions/races-and-ethnicities +https://healthequitytracker.org/methodology/age-adjustment +https://healthequitytracker.org/methodology/recommended-citation +https://healthequitytracker.org/methodology/glossary +https://healthequitytracker.org/news +https://healthequitytracker.org/shareyourstory +https://healthequitytracker.org/termsofuse +https://healthequitytracker.org/whatishealthequity \ No newline at end of file diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 511a902c0a..6083870a1f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -24,11 +24,11 @@ import { import { autoInitGlobals } from './utils/globals' import { ABOUT_US_PAGE_LINK, - CONTACT_TAB_LINK, + OLD_CONTACT_LINK, DATA_CATALOG_PAGE_LINK, EXPLORE_DATA_PAGE_LINK, FAQ_TAB_LINK, - OURTEAM_TAB_LINK, + OLD_OURTEAM_LINK, TERMS_OF_USE_PAGE_LINK, WHAT_IS_HEALTH_EQUITY_PAGE_LINK, NEWS_PAGE_LINK, @@ -109,11 +109,11 @@ export default function App() { - + - + diff --git a/frontend/src/pages/WhatIsHealthEquity/FaqTab.tsx b/frontend/src/pages/WhatIsHealthEquity/FaqTab.tsx index 63a67e1429..5d80145737 100644 --- a/frontend/src/pages/WhatIsHealthEquity/FaqTab.tsx +++ b/frontend/src/pages/WhatIsHealthEquity/FaqTab.tsx @@ -1,4 +1,4 @@ -import { CONTACT_TAB_LINK } from '../../utils/internalRoutes' +import { ABOUT_US_PAGE_LINK } from '../../utils/internalRoutes' import { Helmet } from 'react-helmet-async' import MoreHorizIcon from '@mui/icons-material/MoreHoriz' import { CITATION_APA } from '../../cards/ui/SourcesHelpers' @@ -229,7 +229,7 @@ function FaqTab() { media
  • - + Share your health equity story
  • diff --git a/frontend/src/pages/ui/SignupSection.tsx b/frontend/src/pages/ui/SignupSection.tsx index fe9fbbcf54..37d706978d 100644 --- a/frontend/src/pages/ui/SignupSection.tsx +++ b/frontend/src/pages/ui/SignupSection.tsx @@ -1,5 +1,5 @@ import { - CONTACT_TAB_LINK, + ABOUT_US_PAGE_LINK, SHARE_YOUR_STORY_TAB_LINK, } from '../../utils/internalRoutes' import { LinkWithStickyParams } from '../../utils/urlutils' @@ -11,7 +11,7 @@ export default function SignupSection() {

    Please{' '} - + contact us {' '} with any questions or concerns, and{' '} diff --git a/frontend/src/reports/WhatDataAreMissing.tsx b/frontend/src/reports/WhatDataAreMissing.tsx index d4481a66ae..b39c5e3ec7 100644 --- a/frontend/src/reports/WhatDataAreMissing.tsx +++ b/frontend/src/reports/WhatDataAreMissing.tsx @@ -1,4 +1,4 @@ -import { CONTACT_TAB_LINK } from '../utils/internalRoutes' +import { ABOUT_US_PAGE_LINK } from '../utils/internalRoutes' import { LinkWithStickyParams } from '../utils/urlutils' import { MissingCovidData, @@ -73,7 +73,7 @@ export default function WhatDataAreMissing(props: WhatDataAreMissingProps) {

    Do you have information that belongs on the Health Equity Tracker?{' '} - + We would love to hear from you!

    diff --git a/frontend/src/styles/HetComponents/HetFooterNav.tsx b/frontend/src/styles/HetComponents/HetFooterNav.tsx index b450af5990..293bfce60e 100644 --- a/frontend/src/styles/HetComponents/HetFooterNav.tsx +++ b/frontend/src/styles/HetComponents/HetFooterNav.tsx @@ -2,7 +2,7 @@ import { EXPLORE_DATA_PAGE_LINK, TERMS_OF_USE_PAGE_LINK, FAQ_TAB_LINK, - CONTACT_TAB_LINK, + ABOUT_US_PAGE_LINK, METHODOLOGY_PAGE_LINK, } from '../../utils/internalRoutes' import HetCopyright from './HetCopywright' @@ -17,9 +17,9 @@ export default function HetFooterLinks() { {[ ['Explore Data', EXPLORE_DATA_PAGE_LINK], ['Methods', METHODOLOGY_PAGE_LINK], - ['FAQs', `${FAQ_TAB_LINK}`, 'Frequently Asked Questions'], - ['Contact Us', `${CONTACT_TAB_LINK}`], - ['Terms of Use', `${TERMS_OF_USE_PAGE_LINK}`], + ['FAQs', FAQ_TAB_LINK, 'Frequently Asked Questions'], + ['Contact Us', ABOUT_US_PAGE_LINK], + ['Terms of Use', TERMS_OF_USE_PAGE_LINK], ].map(([label, url, ariaLabel]) => (
  • Date: Mon, 3 Jun 2024 11:44:23 -0600 Subject: [PATCH 05/10] Bump the minor-frontend group in /frontend with 5 updates (#3352) --- frontend/package-lock.json | 48 +++++++++++++++++++------------------- frontend/package.json | 10 ++++---- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d1787a0cbc..a347f8cc2b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -16,8 +16,8 @@ "@fontsource/roboto": "^5.0.13", "@fontsource/roboto-condensed": "^5.0.16", "@fontsource/taviraj": "^5.0.20", - "@mui/icons-material": "^5.15.18", - "@mui/material": "^5.15.18", + "@mui/icons-material": "^5.15.19", + "@mui/material": "^5.15.19", "@vitejs/plugin-react": "^4.3.0", "axios": "^1.7.2", "d3": "^7.8.5", @@ -25,7 +25,7 @@ "env-cmd": "^10.1.0", "history": "^5.3.0", "html2canvas": "^1.4.1", - "jotai": "^2.8.2", + "jotai": "^2.8.3", "jotai-location": "^0.5.5", "lodash": "^4.17.21", "lru-cache": "^10.2.2", @@ -46,7 +46,7 @@ "use-react-screenshot": "^4.0.0", "vega": "^5.29.0", "vega-lite": "^5.18.1", - "vite": "^5.2.11", + "vite": "^5.2.12", "vite-plugin-svgr": "^4.2.0", "vite-tsconfig-paths": "^4.2.1" }, @@ -57,7 +57,7 @@ "@testing-library/react": "^15.0.7", "@types/d3": "^7.4.0", "@types/lodash": "^4.17.4", - "@types/node": "^20.12.13", + "@types/node": "^20.14.0", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@types/react-lazyload": "^3.2.0", @@ -1901,18 +1901,18 @@ } }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.15.18", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.18.tgz", - "integrity": "sha512-/9pVk+Al8qxAjwFUADv4BRZgMpZM4m5E+2Q/20qhVPuIJWqKp4Ie4tGExac6zu93rgPTYVQGgu+1vjiT0E+cEw==", + "version": "5.15.19", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.19.tgz", + "integrity": "sha512-tCHSi/Tomez9ERynFhZRvFO6n9ATyrPs+2N80DMDzp6xDVirbBjEwhPcE+x7Lj+nwYw0SqFkOxyvMP0irnm55w==", "funding": { "type": "opencollective", "url": "https://opencollective.com/mui-org" } }, "node_modules/@mui/icons-material": { - "version": "5.15.18", - "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.15.18.tgz", - "integrity": "sha512-jGhyw02TSLM0NgW+MDQRLLRUD/K4eN9rlK2pTBTL1OtzyZmQ8nB060zK1wA0b7cVrIiG+zyrRmNAvGWXwm2N9Q==", + "version": "5.15.19", + "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.15.19.tgz", + "integrity": "sha512-RsEiRxA5azN9b8gI7JRqekkgvxQUlitoBOtZglflb8cUDyP12/cP4gRwhb44Ea1/zwwGGjAj66ZJpGHhKfibNA==", "dependencies": { "@babel/runtime": "^7.23.9" }, @@ -1935,13 +1935,13 @@ } }, "node_modules/@mui/material": { - "version": "5.15.18", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.15.18.tgz", - "integrity": "sha512-n+/dsiqux74fFfcRUJjok+ieNQ7+BEk6/OwX9cLcLvriZrZb+/7Y8+Fd2HlUUbn5N0CDurgAHm0VH1DqyJ9HAw==", + "version": "5.15.19", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.15.19.tgz", + "integrity": "sha512-lp5xQBbcRuxNtjpWU0BWZgIrv2XLUz4RJ0RqFXBdESIsKoGCQZ6P3wwU5ZPuj5TjssNiKv9AlM+vHopRxZhvVQ==", "dependencies": { "@babel/runtime": "^7.23.9", "@mui/base": "5.0.0-beta.40", - "@mui/core-downloads-tracker": "^5.15.18", + "@mui/core-downloads-tracker": "^5.15.19", "@mui/system": "^5.15.15", "@mui/types": "^7.2.14", "@mui/utils": "^5.15.14", @@ -3253,9 +3253,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.12.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.13.tgz", - "integrity": "sha512-gBGeanV41c1L171rR7wjbMiEpEI/l5XFQdLLfhr/REwpgDy/4U8y89+i8kRiLzDyZdOkXh+cRaTetUnCYutoXA==", + "version": "20.14.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.0.tgz", + "integrity": "sha512-5cHBxFGJx6L4s56Bubp4fglrEpmyJypsqI6RgzMfBHWUJQGWAAi8cWcgetEbZXHYXo9C2Fa4EEds/uSyS4cxmA==", "devOptional": true, "dependencies": { "undici-types": "~5.26.4" @@ -6463,9 +6463,9 @@ } }, "node_modules/jotai": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/jotai/-/jotai-2.8.2.tgz", - "integrity": "sha512-AU+EU82YqP94izfbGYQQL3oa/06gmn+Ijf/CKx0QybAURtbqh2e4N6zA2fxeIh0JEUgASF6z5IhagJ8NicR95A==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/jotai/-/jotai-2.8.3.tgz", + "integrity": "sha512-pR4plVvdbzB6zyt7VLLHPMAkcRSKhRIvZKd+qkifQLa3CEziEo1uwZjePj4acTmQrboiISBlYSdCz3gWcr1Nkg==", "engines": { "node": ">=12.20.0" }, @@ -9355,9 +9355,9 @@ } }, "node_modules/vite": { - "version": "5.2.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", - "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", + "version": "5.2.12", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.12.tgz", + "integrity": "sha512-/gC8GxzxMK5ntBwb48pR32GGhENnjtY30G4A0jemunsBkiEZFw60s8InGpN8gkhHEkjnRK1aSAxeQgwvFhUHAA==", "dependencies": { "esbuild": "^0.20.1", "postcss": "^8.4.38", diff --git a/frontend/package.json b/frontend/package.json index 0f99c263b9..4c2e470446 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -19,8 +19,8 @@ "@fontsource/roboto": "^5.0.13", "@fontsource/roboto-condensed": "^5.0.16", "@fontsource/taviraj": "^5.0.20", - "@mui/icons-material": "^5.15.18", - "@mui/material": "^5.15.18", + "@mui/icons-material": "^5.15.19", + "@mui/material": "^5.15.19", "@vitejs/plugin-react": "^4.3.0", "axios": "^1.7.2", "d3": "^7.8.5", @@ -28,7 +28,7 @@ "env-cmd": "^10.1.0", "history": "^5.3.0", "html2canvas": "^1.4.1", - "jotai": "^2.8.2", + "jotai": "^2.8.3", "jotai-location": "^0.5.5", "lodash": "^4.17.21", "lru-cache": "^10.2.2", @@ -49,7 +49,7 @@ "use-react-screenshot": "^4.0.0", "vega": "^5.29.0", "vega-lite": "^5.18.1", - "vite": "^5.2.11", + "vite": "^5.2.12", "vite-plugin-svgr": "^4.2.0", "vite-tsconfig-paths": "^4.2.1" }, @@ -60,7 +60,7 @@ "@testing-library/react": "^15.0.7", "@types/d3": "^7.4.0", "@types/lodash": "^4.17.4", - "@types/node": "^20.12.13", + "@types/node": "^20.14.0", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@types/react-lazyload": "^3.2.0", From 65c91a4bce53120c8319dc1510c7ca11833aa98b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 14:36:14 -0600 Subject: [PATCH 06/10] Bump @testing-library/react from 15.0.7 to 16.0.0 in /frontend (#3353) --- frontend/package-lock.json | 35 +++++++++++++++++++++++++---------- frontend/package.json | 2 +- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index a347f8cc2b..a420b687f8 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -54,7 +54,7 @@ "@biomejs/biome": "1.7.3", "@playwright/test": "^1.44.1", "@testing-library/jest-dom": "^5.17.0", - "@testing-library/react": "^15.0.7", + "@testing-library/react": "^16.0.0", "@types/d3": "^7.4.0", "@types/lodash": "^4.17.4", "@types/node": "^20.14.0", @@ -2633,6 +2633,7 @@ "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.1.0.tgz", "integrity": "sha512-wdsYKy5zupPyLCW2Je5DLHSxSfbIp6h80WoHOQc+RPtmPGA52O9x5MJEkv92Sjonpq+poOAtUKhh1kBGAXBrNA==", "dev": true, + "peer": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", @@ -2652,6 +2653,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "peer": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -2667,6 +2669,7 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "peer": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -2683,6 +2686,7 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "peer": true, "dependencies": { "color-name": "~1.1.4" }, @@ -2694,13 +2698,15 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "peer": true }, "node_modules/@testing-library/dom/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "peer": true, "engines": { "node": ">=8" } @@ -2710,6 +2716,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "peer": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -2807,26 +2814,29 @@ } }, "node_modules/@testing-library/react": { - "version": "15.0.7", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-15.0.7.tgz", - "integrity": "sha512-cg0RvEdD1TIhhkm1IeYMQxrzy0MtUNfa3minv4MjbgcYzJAZ7yD0i0lwoPOTPr+INtiXFezt2o8xMSnyHhEn2Q==", + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.0.0.tgz", + "integrity": "sha512-guuxUKRWQ+FgNX0h0NS0FIq3Q3uLtWVpBzcLOggmfMoUpgBnzBzvLLd4fbm6yS8ydJd94cIfY4yP9qUQjM2KwQ==", "dev": true, "dependencies": { - "@babel/runtime": "^7.12.5", - "@testing-library/dom": "^10.0.0", - "@types/react-dom": "^18.0.0" + "@babel/runtime": "^7.12.5" }, "engines": { "node": ">=18" }, "peerDependencies": { + "@testing-library/dom": "^10.0.0", "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.0", "react": "^18.0.0", "react-dom": "^18.0.0" }, "peerDependenciesMeta": { "@types/react": { "optional": true + }, + "@types/react-dom": { + "optional": true } } }, @@ -2877,7 +2887,8 @@ "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", - "dev": true + "dev": true, + "peer": true }, "node_modules/@types/babel__core": { "version": "7.20.5", @@ -6707,6 +6718,7 @@ "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", "dev": true, + "peer": true, "bin": { "lz-string": "bin/bin.js" } @@ -7390,6 +7402,7 @@ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, + "peer": true, "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", @@ -7404,6 +7417,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, + "peer": true, "engines": { "node": ">=10" }, @@ -7415,7 +7429,8 @@ "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", - "dev": true + "dev": true, + "peer": true }, "node_modules/prop-types": { "version": "15.8.1", diff --git a/frontend/package.json b/frontend/package.json index 4c2e470446..c0ee6b1636 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -57,7 +57,7 @@ "@biomejs/biome": "1.7.3", "@playwright/test": "^1.44.1", "@testing-library/jest-dom": "^5.17.0", - "@testing-library/react": "^15.0.7", + "@testing-library/react": "^16.0.0", "@types/d3": "^7.4.0", "@types/lodash": "^4.17.4", "@types/node": "^20.14.0", From 4cd2e148448778b5f973e6a8acf6a3e03c22e201 Mon Sep 17 00:00:00 2001 From: Ben Hammond Date: Tue, 4 Jun 2024 13:27:44 -0600 Subject: [PATCH 07/10] Extremes mode (#3356) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description and Motivation - renames `highest-lowest` to `extremes` for brevity and to avoid confusion with the highest-lowest groups per FIPS feature - fixes #2599 - fixes #2481 - adds reusable `` to our HET component library ## Has this been tested? How? - adds e2e tests to ensure incoming params work as expected ## Screenshots (if appropriate) Screenshot 2024-06-04 at 12 45 04 PM ## Types of changes (leave all that apply) - Bug fix - New content or feature - Refactor / chore ## New frontend preview link is below in the Netlify comment 😎 --- .../playwright-tests/drinking.nightly.spec.ts | 2 +- .../playwright-tests/navigation.ci.spec.ts | 30 +++++++++++ frontend/src/cards/ChartTitle.tsx | 2 + frontend/src/cards/MapCard.tsx | 52 +++++++++---------- frontend/src/cards/UnknownsMapCard.tsx | 4 +- ...LowestGeosList.tsx => ExtremesListBox.tsx} | 4 +- frontend/src/cards/ui/MultiMapDialog.tsx | 5 +- frontend/src/cards/ui/TerritoryCircles.tsx | 6 +-- frontend/src/charts/ChoroplethMap.tsx | 16 +++--- .../pages/DataCatalog/DataSourceListing.tsx | 14 +---- .../src/pages/ExploreData/ExploreDataPage.tsx | 2 +- .../src/pages/ExploreData/TopicInfoModal.tsx | 18 ++----- .../styles/HetComponents/HetCloseButton.tsx | 19 +++++++ .../styles/HetComponents/HetLinkButton.tsx | 2 + .../hooks/useDeprecatedParamRedirects.tsx | 7 +-- .../src/utils/hooks/useDownloadCardImage.tsx | 14 ++--- frontend/src/utils/urlutils.tsx | 4 +- 17 files changed, 116 insertions(+), 85 deletions(-) rename frontend/src/cards/ui/{HighestLowestGeosList.tsx => ExtremesListBox.tsx} (97%) create mode 100644 frontend/src/styles/HetComponents/HetCloseButton.tsx diff --git a/frontend/playwright-tests/drinking.nightly.spec.ts b/frontend/playwright-tests/drinking.nightly.spec.ts index 1f8e095c2c..0487f89042 100644 --- a/frontend/playwright-tests/drinking.nightly.spec.ts +++ b/frontend/playwright-tests/drinking.nightly.spec.ts @@ -12,7 +12,7 @@ test('Excessive Drinking Flow', async ({ page }) => { await page.getByRole('heading', { name: 'Lowest:' }).click() await page.getByRole('heading', { name: 'National overall:' }).click() await page - .locator('#highest-lowest-geos') + .locator('#extremes') .getByText('Excessive drinking cases') .click() await page.getByText('Consider the possible impact').click() diff --git a/frontend/playwright-tests/navigation.ci.spec.ts b/frontend/playwright-tests/navigation.ci.spec.ts index db215d5c88..0477d7c45a 100644 --- a/frontend/playwright-tests/navigation.ci.spec.ts +++ b/frontend/playwright-tests/navigation.ci.spec.ts @@ -83,4 +83,34 @@ test('Use Table of Contents to Scroll Unknown Map Into View and Be Focused', asy await expect(unknownMapCard).toBeFocused(); await expect(unknownMapCard).toBeVisible(); +}); + + + + +test('Including the Extremes Mode Param in URL should load report with Extremes Mode Enabled', async ({ page }) => { + + await page.goto('/exploredata?mls=1.incarceration-3.00&mlp=disparity&dt1=hiv_prevalence&extremes=true', { waitUntil: "commit" }); + await page.getByRole('heading', { name: '(only states/territories with' }).click(); + await page.getByRole('heading', { name: 'Highest:' }).click(); + await page.getByRole('heading', { name: 'Lowest:' }).click(); + await page.getByRole('button', { name: 'Reset to show all states/territories' }).click(); + await page.getByRole('button', { name: 'Expand state/territory rate' }).click(); +}); + + + + +test('Extremes Mode Param in URL should work for both sides of Compare mode report', async ({ page }) => { + + await page.goto('exploredata?mls=1.hiv-3.00-5.13&mlp=comparegeos&dt1=hiv_prevalence&extremes2=true', { waitUntil: "commit" }); + + // map 1 in normal mode to start + await page.locator('#rate-map').getByRole('heading', { name: 'Ages 13+' }).click(); + await page.locator('#rate-map').getByRole('button', { name: 'Expand state/territory rate' }).click(); + + // map 2 in extremes mode to start + await page.locator('#rate-map2').getByRole('heading', { name: 'Ages 13+ (only counties with' }).click(); + await page.locator('#rate-map2').getByRole('button', { name: 'Reset to show all counties' }).click(); + await page.locator('#rate-map2').getByRole('heading', { name: 'Ages 13+' }).click(); }); \ No newline at end of file diff --git a/frontend/src/cards/ChartTitle.tsx b/frontend/src/cards/ChartTitle.tsx index 342c2ef28e..a8aaf0760e 100644 --- a/frontend/src/cards/ChartTitle.tsx +++ b/frontend/src/cards/ChartTitle.tsx @@ -1,6 +1,7 @@ interface ChartTitleProps { title: string subtitle?: string + filterButton?: React.ReactNode } export default function ChartTitle(props: ChartTitleProps) { @@ -12,6 +13,7 @@ export default function ChartTitle(props: ChartTitleProps) { {props.subtitle} )} + {props.filterButton}
  • ) } diff --git a/frontend/src/cards/MapCard.tsx b/frontend/src/cards/MapCard.tsx index 2d1677793b..e028c9038e 100644 --- a/frontend/src/cards/MapCard.tsx +++ b/frontend/src/cards/MapCard.tsx @@ -34,7 +34,7 @@ import { import { CAWP_METRICS } from '../data/providers/CawpProvider' import CardWrapper from './CardWrapper' import DropDownMenu from './ui/DropDownMenu' -import { HighestLowestGeosList } from './ui/HighestLowestGeosList' +import { ExtremesListBox } from './ui/ExtremesListBox' import MissingDataAlert from './ui/MissingDataAlert' import MultiMapDialog from './ui/MultiMapDialog' import { findVerboseRating } from './ui/SviAlert' @@ -52,8 +52,8 @@ import GeoContext, { import TerritoryCircles from './ui/TerritoryCircles' import { GridView } from '@mui/icons-material' import { - HIGHEST_LOWEST_GEOS_1_PARAM_KEY, - HIGHEST_LOWEST_GEOS_2_PARAM_KEY, + EXTREMES_1_PARAM_KEY, + EXTREMES_2_PARAM_KEY, MAP1_GROUP_PARAM, MAP2_GROUP_PARAM, MULTIPLE_MAPS_1_PARAM_KEY, @@ -77,6 +77,7 @@ import { dataSourceMetadataMap } from '../data/config/MetadataMap' import { DatasetId } from '../data/config/DatasetMetadata' import HetNotice from '../styles/HetComponents/HetNotice' import HetTerm from '../styles/HetComponents/HetTerm' +import HetCloseButton from '../styles/HetComponents/HetCloseButton' const SIZE_OF_HIGHEST_LOWEST_GEOS_RATES_LIST = 5 const HASH_ID: ScrollableHashId = 'rate-map' @@ -116,15 +117,12 @@ function MapCardWithKey(props: MapCardProps) { // HOOKS MUST NOT BE CALLED CONDITIONALLY. const preloadHeight = useGuessPreloadHeight([750, 1050]) const location = useLocation() - const highestLowestGeosParamKey = props.isCompareCard - ? HIGHEST_LOWEST_GEOS_2_PARAM_KEY - : HIGHEST_LOWEST_GEOS_1_PARAM_KEY - - const [highestLowestGeosMode, setHighestLowestGeosMode] = - useParamState(highestLowestGeosParamKey, false) - useEffect(() => { - setHighestLowestGeosMode(false) - }, [props.reportTitle, props.trackerMode]) + const extremesParamsKey = props.isCompareCard + ? EXTREMES_2_PARAM_KEY + : EXTREMES_1_PARAM_KEY + + const [extremesMode, setExtremesMode] = + useParamState(extremesParamsKey, false) const MULTIMAP_PARAM_KEY = props.isCompareCard ? MULTIPLE_MAPS_2_PARAM_KEY : MULTIPLE_MAPS_1_PARAM_KEY @@ -258,9 +256,9 @@ function MapCardWithKey(props: MapCardProps) { demographicType, props.dataTypeConfig ) - if (highestLowestGeosMode) - subtitle += ` (only ${props.fips.getPluralChildFipsTypeDisplayName() ?? 'places' - } with highest/lowest rates)` + const pluralChildFips = props.fips.getPluralChildFipsTypeDisplayName() ?? 'places' + if (extremesMode) + subtitle += ` (only ${pluralChildFips} with rate extremes)` const filename = `${title} ${subtitle ? `for ${subtitle}` : ''}` function handleScaleChange(domain: number[], range: number[]) { @@ -277,7 +275,7 @@ function MapCardWithKey(props: MapCardProps) { scrollToHash={HASH_ID} reportTitle={props.reportTitle} elementsToHide={elementsToHide} - expanded={highestLowestGeosMode} + expanded={extremesMode} isCompareCard={props.isCompareCard} > {(queryResponses, metadata, geoData) => { @@ -396,7 +394,7 @@ function MapCardWithKey(props: MapCardProps) { setParameter(MAP_GROUP_PARAM, groupCode) } - const displayData = highestLowestGeosMode + const displayData = extremesMode ? highestValues.concat(lowestValues) : dataForActiveDemographicGroup @@ -407,7 +405,7 @@ function MapCardWithKey(props: MapCardProps) { if (isSummaryLegend) mapConfig.min = mapConfig.mid if (dataForActiveDemographicGroup?.length <= 1) - setHighestLowestGeosMode(false) + setExtremesMode(false) if (!dataForActiveDemographicGroup?.length || !metricConfig) return ( @@ -512,7 +510,7 @@ function MapCardWithKey(props: MapCardProps) {
    - + setExtremesMode(false)} >Reset to show all {pluralChildFips} : null} />
    @@ -530,10 +528,10 @@ function MapCardWithKey(props: MapCardProps) { fips={props.fips} geoData={geoData} hideLegend={true} - hideMissingDataTooltip={highestLowestGeosMode} + hideMissingDataTooltip={extremesMode} legendData={dataForActiveDemographicGroup} legendTitle={metricConfig.shortLabel.toLowerCase()} - highestLowestGeosMode={highestLowestGeosMode} + extremesMode={extremesMode} metric={metricConfig} showCounties={ !props.fips.isUsa() && !hasSelfButNotChildGeoData @@ -554,7 +552,7 @@ function MapCardWithKey(props: MapCardProps) { data={displayData} fullData={mapQueryResponse.data} geoData={geoData} - highestLowestGeosMode={highestLowestGeosMode} + extremesMode={extremesMode} highestLowestGroupsByFips={highestLowestGroupsByFips} mapIsWide={mapIsWide} metricConfig={metricConfig} @@ -602,18 +600,18 @@ function MapCardWithKey(props: MapCardProps) {
    {!mapQueryResponse.dataIsMissing() && dataForActiveDemographicGroup.length > 1 && ( - {props.fips.isUsa() && unknowns.length > 0 && ( )}
    diff --git a/frontend/src/cards/ui/HighestLowestGeosList.tsx b/frontend/src/cards/ui/ExtremesListBox.tsx similarity index 97% rename from frontend/src/cards/ui/HighestLowestGeosList.tsx rename to frontend/src/cards/ui/ExtremesListBox.tsx index d818af2260..0dc1eb7265 100644 --- a/frontend/src/cards/ui/HighestLowestGeosList.tsx +++ b/frontend/src/cards/ui/ExtremesListBox.tsx @@ -16,7 +16,7 @@ import HetUnitLabel from '../../styles/HetComponents/HetUnitLabel' import HetTerm from '../../styles/HetComponents/HetTerm' import HetExpandableBoxButton from '../../styles/HetComponents/HetExpandableBoxButton' -interface HighestLowestGeosListProps { +interface ExtremesListBoxProps { // MetricConfig for data metricConfig: MetricConfig // DataTypeConfig for data @@ -42,7 +42,7 @@ interface HighestLowestGeosListProps { /* Collapsible box showing lists of geographies with the highest and lowest rates */ -export function HighestLowestGeosList(props: HighestLowestGeosListProps) { +export function ExtremesListBox(props: ExtremesListBoxProps) { const placesType = props.fips.getChildFipsTypeDisplayName() const { type: metricType } = props.metricConfig diff --git a/frontend/src/cards/ui/MultiMapDialog.tsx b/frontend/src/cards/ui/MultiMapDialog.tsx index f726eb063b..bb77b63804 100644 --- a/frontend/src/cards/ui/MultiMapDialog.tsx +++ b/frontend/src/cards/ui/MultiMapDialog.tsx @@ -36,7 +36,6 @@ import { type CountColsMap, RATE_MAP_SCALE } from '../../charts/mapGlobals' import CardOptionsMenu from './CardOptionsMenu' import { type ScrollableHashId } from '../../utils/hooks/useStepObserver' import { Sources } from './Sources' -import CloseIcon from '@mui/icons-material/Close' import DataTypeDefinitionsList from '../../pages/ui/DataTypeDefinitionsList' import HetNotice from '../../styles/HetComponents/HetNotice' import HetTerm from '../../styles/HetComponents/HetTerm' @@ -210,7 +209,7 @@ export default function MultiMapDialog(props: MultiMapDialogProps) { mapConfig={mapConfig} isMulti={true} scaleConfig={scale} - highestLowestGeosMode={false} + extremesMode={false} /> )}
    @@ -231,7 +230,7 @@ export default function MultiMapDialog(props: MultiMapDialogProps) { scaleConfig={scale} isMulti={true} activeDemographicGroup={demographicGroup} - highestLowestGeosMode={false} + extremesMode={false} /> )} diff --git a/frontend/src/cards/ui/TerritoryCircles.tsx b/frontend/src/cards/ui/TerritoryCircles.tsx index c5603e4ce2..9e47a1cc64 100644 --- a/frontend/src/cards/ui/TerritoryCircles.tsx +++ b/frontend/src/cards/ui/TerritoryCircles.tsx @@ -20,7 +20,7 @@ interface TerritoryCirclesProps { signalListeners: any metricConfig: MetricConfig dataTypeConfig: DataTypeConfig - highestLowestGeosMode: boolean + extremesMode: boolean highestLowestGroupsByFips?: Record legendData?: Array> geoData?: Record @@ -53,7 +53,7 @@ export default function TerritoryCircles(props: TerritoryCirclesProps) { signalListeners={props.signalListeners} metric={props.metricConfig} data={props.data} - hideMissingDataTooltip={props.highestLowestGeosMode} + hideMissingDataTooltip={props.extremesMode} legendData={props.legendData} hideLegend={true} showCounties={false} @@ -65,7 +65,7 @@ export default function TerritoryCircles(props: TerritoryCirclesProps) { mapConfig={mapConfig} scaleConfig={props.scaleConfig} isMulti={props.isMulti} - highestLowestGeosMode={props.highestLowestGeosMode} + extremesMode={props.extremesMode} isPhrmaAdherence={props.isPhrmaAdherence} />
    diff --git a/frontend/src/charts/ChoroplethMap.tsx b/frontend/src/charts/ChoroplethMap.tsx index b085b33a9e..5f3bc65b87 100644 --- a/frontend/src/charts/ChoroplethMap.tsx +++ b/frontend/src/charts/ChoroplethMap.tsx @@ -103,7 +103,7 @@ interface ChoroplethMapProps { titles?: { subtitle?: string } - highestLowestGeosMode: boolean + extremesMode: boolean countColsMap: CountColsMap mapConfig: MapConfig isSummaryLegend?: boolean @@ -197,7 +197,7 @@ export default function ChoroplethMap(props: ChoroplethMapProps) { }, ] // Null SVI was showing - if (!props.highestLowestGeosMode) { + if (!props.extremesMode) { geoTransformers[0].values.push('rating') } @@ -314,7 +314,7 @@ export default function ChoroplethMap(props: ChoroplethMapProps) { /* reverse? */ !props.mapConfig.higherIsBetter && !props.isUnknownsMap ) - if (props.highestLowestGeosMode) { + if (props.extremesMode) { colorScale.domain = props.scaleConfig?.domain colorScale.range = props.scaleConfig?.range colorScale.reverse = false @@ -343,7 +343,7 @@ export default function ChoroplethMap(props: ChoroplethMapProps) { /* tooltipExpression= */ zeroTooltipValue, /* overrideShapeWithCircle */ props.overrideShapeWithCircle, /* hideMissingDataTooltip */ props.hideMissingDataTooltip, - /* outlineGeos */ props.highestLowestGeosMode, + /* outlineGeos */ props.extremesMode, /* is multimap */ props.isMulti, /* is mobile device */ isMobile ), @@ -351,13 +351,13 @@ export default function ChoroplethMap(props: ChoroplethMapProps) { createShapeMarks( /* datasetName= */ MISSING_DATASET, /* fillColor= */ { - value: props.highestLowestGeosMode ? het.white : UNKNOWN_GREY, + value: props.extremesMode ? het.white : UNKNOWN_GREY, }, - /* hoverColor= */ props.highestLowestGeosMode ? het.white : RED_ORANGE, + /* hoverColor= */ props.extremesMode ? het.white : RED_ORANGE, /* tooltipExpression= */ missingDataTooltipValue, /* overrideShapeWithCircle */ props.overrideShapeWithCircle, /* hideMissingDataTooltip */ props.hideMissingDataTooltip, - /* outlineGeos */ props.highestLowestGeosMode, + /* outlineGeos */ props.extremesMode, props.isMulti, /* is mobile device */ isMobile ), @@ -369,7 +369,7 @@ export default function ChoroplethMap(props: ChoroplethMapProps) { /* tooltipExpression= */ tooltipValue, /* overrideShapeWithCircle */ props.overrideShapeWithCircle, /* hideMissingDataTooltip */ props.hideMissingDataTooltip, - /* outlineGeos */ props.highestLowestGeosMode, + /* outlineGeos */ props.extremesMode, props.isMulti, /* is mobile device */ isMobile ), diff --git a/frontend/src/pages/DataCatalog/DataSourceListing.tsx b/frontend/src/pages/DataCatalog/DataSourceListing.tsx index cee953a624..d86bcd2899 100644 --- a/frontend/src/pages/DataCatalog/DataSourceListing.tsx +++ b/frontend/src/pages/DataCatalog/DataSourceListing.tsx @@ -13,8 +13,6 @@ import ListItem from '@mui/material/ListItem' import ListItemIcon from '@mui/material/ListItemIcon' import CircularProgress from '@mui/material/CircularProgress' import ListItemText from '@mui/material/ListItemText' -import { IconButton } from '@mui/material' -import CloseIcon from '@mui/icons-material/Close' import GetAppIcon from '@mui/icons-material/GetApp' import CheckCircleIcon from '@mui/icons-material/CheckCircle' @@ -24,6 +22,7 @@ import { } from '../../data/config/DatasetMetadata' import HetNotice from '../../styles/HetComponents/HetNotice' import HetLinkButton from '../../styles/HetComponents/HetLinkButton' +import HetCloseButton from '../../styles/HetComponents/HetCloseButton' export type LoadStatus = 'loading' | 'unloaded' | 'error' | 'loaded' @@ -203,16 +202,7 @@ export function DataSourceListing(props: DataSourceListingProps) { {props.source_metadata.data_source_name} - - { - setDialogIsOpen(false) - }} - size='large' - > - - + setDialogIsOpen(false)} ariaLabel='close dialogue' /> {props.source_metadata.dataset_ids.map((datasetId) => ( diff --git a/frontend/src/pages/ExploreData/ExploreDataPage.tsx b/frontend/src/pages/ExploreData/ExploreDataPage.tsx index cef8f2bfa3..dca802d2ea 100644 --- a/frontend/src/pages/ExploreData/ExploreDataPage.tsx +++ b/frontend/src/pages/ExploreData/ExploreDataPage.tsx @@ -272,7 +272,7 @@ function ExploreDataPage(props: ExploreDataPageProps) { { name: MADLIB_PHRASE_PARAM, value: MADLIB_LIST[modeIndex].id, - }, + } ]) location.hash = '' window.scrollTo({ top: 0, behavior: 'smooth' }) diff --git a/frontend/src/pages/ExploreData/TopicInfoModal.tsx b/frontend/src/pages/ExploreData/TopicInfoModal.tsx index ef67c00c70..e3ffdcfa19 100644 --- a/frontend/src/pages/ExploreData/TopicInfoModal.tsx +++ b/frontend/src/pages/ExploreData/TopicInfoModal.tsx @@ -1,5 +1,4 @@ -import { Button, Dialog, DialogContent } from '@mui/material' -import CloseIcon from '@mui/icons-material/Close' +import { Dialog, DialogContent } from '@mui/material' import { HashLink } from 'react-router-hash-link' import { DATA_CATALOG_PAGE_LINK, @@ -10,8 +9,8 @@ import { TOPIC_INFO_PARAM_KEY } from '../../utils/urlutils' import DataTypeDefinitionsList from '../ui/DataTypeDefinitionsList' import { useAtomValue } from 'jotai' import { selectedDataTypeConfig1Atom } from '../../utils/sharedSettingsState' -import { type DropdownVarId } from '../../data/config/MetricConfig' -import { CategoryTypeId, getParentDropdownFromDataTypeId } from '../../utils/MadLibs' +import { CategoryTypeId } from '../../utils/MadLibs' +import HetCloseButton from '../../styles/HetComponents/HetCloseButton' export default function TopicInfoModal() { const [topicInfoModalIsOpen, setTopicInfoModalIsOpen] = @@ -40,16 +39,7 @@ export default function TopicInfoModal() { scroll='paper' > - + setTopicInfoModalIsOpen(false)} ariaLabel='close topic info modal' /> diff --git a/frontend/src/styles/HetComponents/HetCloseButton.tsx b/frontend/src/styles/HetComponents/HetCloseButton.tsx new file mode 100644 index 0000000000..7be1a1e80f --- /dev/null +++ b/frontend/src/styles/HetComponents/HetCloseButton.tsx @@ -0,0 +1,19 @@ +import { Button } from "@mui/material" +import CloseIcon from '@mui/icons-material/Close' + +interface HetCloseButtonProps { + onClick: () => void, + ariaLabel: string +} + +export default function HetCloseButton(props: HetCloseButtonProps) { + return ( + ) +} diff --git a/frontend/src/styles/HetComponents/HetLinkButton.tsx b/frontend/src/styles/HetComponents/HetLinkButton.tsx index f3a4ade9d8..125bb7ca40 100644 --- a/frontend/src/styles/HetComponents/HetLinkButton.tsx +++ b/frontend/src/styles/HetComponents/HetLinkButton.tsx @@ -7,6 +7,7 @@ interface HetLinkButtonProps { onClick?: () => void id?: string className?: string + buttonClassName?: string ariaLabel?: string underline?: boolean } @@ -18,6 +19,7 @@ export default function HetLinkButton(props: HetLinkButtonProps) { href={props.href} onClick={props.onClick} aria-label={props.ariaLabel} + className={props.buttonClassName} > {props.children} diff --git a/frontend/src/utils/hooks/useDeprecatedParamRedirects.tsx b/frontend/src/utils/hooks/useDeprecatedParamRedirects.tsx index 0f9e0553ca..d83c7f9754 100644 --- a/frontend/src/utils/hooks/useDeprecatedParamRedirects.tsx +++ b/frontend/src/utils/hooks/useDeprecatedParamRedirects.tsx @@ -1,7 +1,7 @@ import { useHistory } from 'react-router-dom' import { METRIC_CONFIG, type DataTypeId } from '../../data/config/MetricConfig' import { EXPLORE_DATA_PAGE_LINK } from '../internalRoutes' -import { MADLIB_SELECTIONS_PARAM, useSearchParams } from '../urlutils' +import { EXTREMES_1_PARAM_KEY, MADLIB_SELECTIONS_PARAM, useSearchParams } from '../urlutils' // Ensures backwards compatibility for external links to old DataTypeIds // NOTE: these redirects will lose any incoming demographic, data type, and card hash settings @@ -25,6 +25,7 @@ export default function useDeprecatedParamRedirects() { const history = useHistory() const params = useSearchParams() const mlsParam = params[MADLIB_SELECTIONS_PARAM] + const extremesParam = params[EXTREMES_1_PARAM_KEY] if (mlsParam) { // isolate the id from the param string @@ -37,13 +38,13 @@ export default function useDeprecatedParamRedirects() { dropdownIdSwaps[dropdownVarId1] ) history.push( - `${EXPLORE_DATA_PAGE_LINK}?${MADLIB_SELECTIONS_PARAM}=${newMlsParam}` + `${EXPLORE_DATA_PAGE_LINK}?${MADLIB_SELECTIONS_PARAM}=${newMlsParam}${extremesParam ? `&${extremesParam}` : ''}` ) } else if ( // otherwise handle other malformed ids in param and redirect to helper box !Object.keys(METRIC_CONFIG).includes(dropdownVarId1) ) { - history.push(EXPLORE_DATA_PAGE_LINK) + history.push(`${EXPLORE_DATA_PAGE_LINK}`) } } diff --git a/frontend/src/utils/hooks/useDownloadCardImage.tsx b/frontend/src/utils/hooks/useDownloadCardImage.tsx index c76ccd0644..68752ece1d 100644 --- a/frontend/src/utils/hooks/useDownloadCardImage.tsx +++ b/frontend/src/utils/hooks/useDownloadCardImage.tsx @@ -5,16 +5,16 @@ import { type ScrollableHashId } from './useStepObserver' import { ALT_TABLE_VIEW_1_PARAM_KEY, ALT_TABLE_VIEW_2_PARAM_KEY, - HIGHEST_LOWEST_GEOS_1_PARAM_KEY, - HIGHEST_LOWEST_GEOS_2_PARAM_KEY, + EXTREMES_1_PARAM_KEY, + EXTREMES_2_PARAM_KEY, } from '../urlutils' import { het } from '../../styles/DesignTokens' const DROPDOWN_ELEMENT_IDS = [ ALT_TABLE_VIEW_1_PARAM_KEY, ALT_TABLE_VIEW_2_PARAM_KEY, - HIGHEST_LOWEST_GEOS_1_PARAM_KEY, - HIGHEST_LOWEST_GEOS_2_PARAM_KEY, + EXTREMES_1_PARAM_KEY, + EXTREMES_2_PARAM_KEY, ] const LOGO_FONT_COLOR = het.altGreen @@ -175,9 +175,9 @@ export function useDownloadCardImage( const footerCanvas = footerContentRef ? await html2canvas(footerContentRef.current as HTMLElement, { - logging: true, - useCORS: true, - }) + logging: true, + useCORS: true, + }) : null const combinedCanvasHeight = diff --git a/frontend/src/utils/urlutils.tsx b/frontend/src/utils/urlutils.tsx index 21c0b1aac4..8d86befbb8 100644 --- a/frontend/src/utils/urlutils.tsx +++ b/frontend/src/utils/urlutils.tsx @@ -42,8 +42,8 @@ export const DEMOGRAPHIC_PARAM = 'demo' export const TOPIC_INFO_PARAM_KEY = 'topic-info' export const MULTIPLE_MAPS_1_PARAM_KEY = 'multiple-maps' export const MULTIPLE_MAPS_2_PARAM_KEY = 'multiple-maps2' -export const HIGHEST_LOWEST_GEOS_1_PARAM_KEY = 'highest-lowest-geos' -export const HIGHEST_LOWEST_GEOS_2_PARAM_KEY = 'highest-lowest-geos2' +export const EXTREMES_1_PARAM_KEY = 'extremes' +export const EXTREMES_2_PARAM_KEY = 'extremes2' export const ALT_TABLE_VIEW_1_PARAM_KEY = 'alt-table-view1' export const ALT_TABLE_VIEW_2_PARAM_KEY = 'alt-table-view2' From 4fb20ac120066f746f31ae4f68adaf3afd884308 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:23:19 -0500 Subject: [PATCH 08/10] Bump the minor-python group in /run_ingestion with 2 updates (#3351) Bump the minor-python group in /run_ingestion with 2 updates (#3351) --- run_ingestion/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_ingestion/requirements.txt b/run_ingestion/requirements.txt index 2a2e71695f..3a3991d64f 100644 --- a/run_ingestion/requirements.txt +++ b/run_ingestion/requirements.txt @@ -83,7 +83,7 @@ mypy-extensions==0.4.3 # via typing-inspect numpy==1.26.4 # via pandas -openpyxl==3.1.2 +openpyxl==3.1.3 # via # -r ../python/ingestion/requirements.in # -r requirements.in @@ -118,7 +118,7 @@ pytz==2020.1 # pandas pyyaml==5.4 # via libcst -requests==2.32.2 +requests==2.32.3 # via # -r ../python/ingestion/requirements.in # google-api-core From 4b2ae9b6c96d39d3bbec3ff1be14d7d23b300c7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:41:30 -0500 Subject: [PATCH 09/10] Bump the minor-python group in /exporter with 3 updates (#3354) Bump the minor-python group in /exporter with 3 updates (#3354) --- exporter/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exporter/requirements.txt b/exporter/requirements.txt index 3c8a79dbbc..f07b4b7ce7 100644 --- a/exporter/requirements.txt +++ b/exporter/requirements.txt @@ -40,7 +40,7 @@ google-cloud-core==2.4.1 # -r requirements.in # google-cloud-bigquery # google-cloud-storage -google-cloud-pubsub==2.21.1 +google-cloud-pubsub==2.21.2 # via -r requirements.in google-cloud-storage==2.16.0 # via -r requirements.in @@ -94,7 +94,7 @@ packaging==21.3 # db-dtypes # google-cloud-bigquery # gunicorn -pandas==2.2.2 +pandas==2.0.3 # via # -r requirements.in # db-dtypes @@ -123,7 +123,7 @@ python-dateutil==2.9.0.post0 # pandas pytz==2022.2.1 # via pandas -requests==2.32.2 +requests==2.32.3 # via # -r requirements.in # google-api-core From c66e881d9be682abe38167b318bf143c52e1c6ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 17:01:22 -0500 Subject: [PATCH 10/10] Bump the minor-python group in /requirements with 2 updates (#3355) Bump the minor-python group in /requirements with 2 updates (#3355) --- requirements/tests.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index 196227264e..8503babc42 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -22,6 +22,8 @@ click==8.1.7 # via flask dill==0.3.8 # via pylint +et-xmlfile==1.1.0 + # via openpyxl flask==3.0.3 # via # -r ../data_server/requirements.in @@ -96,7 +98,10 @@ mypy-extensions==0.4.3 # via typing-inspect numpy==1.26.4 # via pandas -openpyxl==3.1.2 +openpyxl==3.1.3 + # via + # -r ../python/tests/../ingestion/requirements.in + # -r tests.in packaging==20.4 # via # gunicorn @@ -143,7 +148,7 @@ pytz==2020.1 # pandas pyyaml==5.4 # via libcst -requests==2.32.2 +requests==2.32.3 # via # -r ../python/tests/../ingestion/requirements.in # google-api-core