From fbf38b84c570b80ae9173ca79f5c021a1afec85b Mon Sep 17 00:00:00 2001 From: Ben Hammond Date: Wed, 1 May 2024 15:41:26 -0600 Subject: [PATCH] Adds Counts to frontend (#3218) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description and Motivation - closes #2991 presenting counts where possible by specifying the sub-pop, rate numerator, and rate denominator fields in the metric confgis. This automatically populates data in the hover tooltip on the map, the geo context breadcrumbs population (and specifying the ACS pop. more clearly), and in the data table - updates to a newer GH action for the netlify preview testing (old one was looking for ".com" instead of ".app" preview link ## Has this been tested? How? - manually confirmed - frontend tests passing ## Screenshots (if appropriate) Screenshot 2024-05-01 at 2 57 41 PM Screenshot 2024-05-01 at 2 58 48 PM Screenshot 2024-05-01 at 2 58 58 PM Screenshot 2024-05-01 at 2 59 24 PM Screenshot 2024-05-01 at 2 59 53 PM Screenshot 2024-05-01 at 3 00 05 PM ## Types of changes (leave all that apply) - New content or feature ## New frontend preview link is below in the Netlify comment 😎 --- .github/workflows/runFrontendTests.yml | 14 ++++++++++---- frontend/src/cards/ui/GeoContext.test.ts | 3 ++- frontend/src/cards/ui/GeoContext.tsx | 2 +- .../src/data/config/MetricConfigCovidCategory.ts | 7 +++++++ frontend/src/data/config/MetricConfigPDOH.ts | 8 ++++---- frontend/src/data/providers/VaccineProvider.ts | 1 + 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/runFrontendTests.yml b/.github/workflows/runFrontendTests.yml index 7fda8d8b4e..7ce5cd1a86 100644 --- a/.github/workflows/runFrontendTests.yml +++ b/.github/workflows/runFrontendTests.yml @@ -59,9 +59,15 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'pull_request' steps: - - name: Waiting for Netlify Preview - uses: josephduffy/wait-for-netlify-action@v1 - id: wait-for-netlify-preview + # - name: Waiting for Netlify Preview + # uses: josephduffy/wait-for-netlify-action@v1 + # id: wait-for-netlify-preview + # with: + # site_name: ${{env.NETLIFY_SITE_NAME}} + # max_timeout: 90 + - name: Waiting for "Success" from Netlify Preview + uses: jakepartusch/wait-for-netlify-action@v1.4 + id: waitFor200 with: site_name: ${{env.NETLIFY_SITE_NAME}} max_timeout: 90 @@ -85,7 +91,7 @@ jobs: run: npx playwright install --with-deps chromium - name: run E2E on DEPLOY_PREVIEW run: npx playwright test --project=E2E_NIGHTLY --workers 4 - # base url based on the GITHUB_PR_NUMBER + NETLIFY_SITE_NAME + # base url based on the GITHUB_PR_NUMBER + NETLIFY_SITE_NAME env: E2E_BASE_URL: 'https://deploy-preview-${{env.GITHUB_PR_NUMBER}}--${{env.NETLIFY_SITE_NAME}}.netlify.app' # store test run reports if they fail diff --git a/frontend/src/cards/ui/GeoContext.test.ts b/frontend/src/cards/ui/GeoContext.test.ts index f27b2428cf..facc27f1ea 100644 --- a/frontend/src/cards/ui/GeoContext.test.ts +++ b/frontend/src/cards/ui/GeoContext.test.ts @@ -4,6 +4,7 @@ import { getSubPopulationPhrase, getTotalACSPopulationPhrase, } from './GeoContext' +import { describe, test, expect } from 'vitest' describe('test getTotalACSPopulationPhrase()', () => { const nationalACSPopData: Row[] = [ @@ -18,7 +19,7 @@ describe('test getTotalACSPopulationPhrase()', () => { const normalPopPhrase = getTotalACSPopulationPhrase( /* data */ nationalACSPopData ) - expect(normalPopPhrase).toEqual('Total Population: 328,016,242') + expect(normalPopPhrase).toEqual('Total Population (from 2022 ACS): 328,016,242') }) }) diff --git a/frontend/src/cards/ui/GeoContext.tsx b/frontend/src/cards/ui/GeoContext.tsx index 2615744e3e..6e5421022b 100644 --- a/frontend/src/cards/ui/GeoContext.tsx +++ b/frontend/src/cards/ui/GeoContext.tsx @@ -49,7 +49,7 @@ const POP_MISSING_VALUE = 'unavailable' export function getTotalACSPopulationPhrase(populationData: Row[]): string { const popAllCount: string = populationData[0].population.toLocaleString() - return `Total Population: ${popAllCount ?? POP_MISSING_VALUE}` + return `Total Population (from 2022 ACS): ${popAllCount ?? POP_MISSING_VALUE}` } export function getSubPopulationPhrase( diff --git a/frontend/src/data/config/MetricConfigCovidCategory.ts b/frontend/src/data/config/MetricConfigCovidCategory.ts index 24784c7215..4df362819f 100644 --- a/frontend/src/data/config/MetricConfigCovidCategory.ts +++ b/frontend/src/data/config/MetricConfigCovidCategory.ts @@ -49,6 +49,7 @@ export type CovidCategoryMetricId = | 'vaccinated_per_100k' | 'vaccinated_pop_pct' | 'vaccinated_share_of_known' + | 'vaccinated_estimated_total' export const COVID_DISEASE_METRICS: DataTypeConfig[] = [ { @@ -234,6 +235,12 @@ export const COVID_VACCINATION_METRICS: DataTypeConfig[] = [ columnTitleHeader: 'COVID-19 vaccinations per 100k people', shortLabel: 'COVID-19 vaccinations per 100k', type: 'per100k', + rateNumeratorMetric: { + metricId: 'vaccinated_estimated_total', + shortLabel: 'vaccinated', + chartTitle: '', + type: 'count', + } }, pct_share: { chartTitle: 'Share of total COVID-19 vaccinations', diff --git a/frontend/src/data/config/MetricConfigPDOH.ts b/frontend/src/data/config/MetricConfigPDOH.ts index bbaad7425d..db07aa04e9 100644 --- a/frontend/src/data/config/MetricConfigPDOH.ts +++ b/frontend/src/data/config/MetricConfigPDOH.ts @@ -240,7 +240,7 @@ export const INCARCERATION_METRICS: DataTypeConfig[] = [ sub_population_count: { chartTitle: '', metricId: 'incarceration_population_estimated_total', - shortLabel: 'Total Population (Ages 15-64)', + shortLabel: 'Total Population (from rate data)', type: 'count', }, per100k: { @@ -258,7 +258,7 @@ export const INCARCERATION_METRICS: DataTypeConfig[] = [ }, rateDenominatorMetric: { metricId: 'incarceration_population_estimated_total', - shortLabel: 'Total population (Ages 15-64)', + shortLabel: 'Total population', chartTitle: '', type: 'count', }, @@ -314,7 +314,7 @@ export const INCARCERATION_METRICS: DataTypeConfig[] = [ sub_population_count: { chartTitle: '', metricId: 'incarceration_population_estimated_total', - shortLabel: 'Total Population (Ages 15-64)', + shortLabel: 'Total Population (from rate data)', type: 'count', }, per100k: { @@ -332,7 +332,7 @@ export const INCARCERATION_METRICS: DataTypeConfig[] = [ }, rateDenominatorMetric: { metricId: 'incarceration_population_estimated_total', - shortLabel: 'Total population (Ages 15-64)', + shortLabel: 'Total population', chartTitle: '', type: 'count', }, diff --git a/frontend/src/data/providers/VaccineProvider.ts b/frontend/src/data/providers/VaccineProvider.ts index 5fcb69f0ef..eec58474bb 100644 --- a/frontend/src/data/providers/VaccineProvider.ts +++ b/frontend/src/data/providers/VaccineProvider.ts @@ -23,6 +23,7 @@ class VaccineProvider extends VariableProvider { 'vaccinated_pct_share', 'vaccinated_per_100k', 'vaccinated_pop_pct', + 'vaccinated_estimated_total' ]) this.acsProvider = acsProvider }