From d831a808d221e3f1759f69467e27d32be16a9d32 Mon Sep 17 00:00:00 2001 From: Vim <86254807+vim-usds@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:03:22 -0800 Subject: [PATCH 1/8] fix: typos (#2148) - closes #2134 - closes #2135 - closes #2141 - closes #2118 --- .../__snapshots__/Categories.test.tsx.snap | 2 +- .../__snapshots__/datasetCard.test.tsx.snap | 2 +- .../datasetContainer.test.tsx.snap | 68 +++++++++--------- .../__snapshots__/Indicator.test.tsx.snap | 2 +- .../ReleaseUpdate/ReleaseUpdate.tsx | 2 +- .../__snapshots__/ReleaseUpdate.test.tsx.snap | 6 +- client/src/data/copy/explore.tsx | 2 +- client/src/data/copy/methodology.tsx | 4 +- client/src/intl/en.json | 6 +- .../__snapshots__/downloads.test.tsx.snap | 6 +- .../__snapshots__/methodology.test.tsx.snap | 70 +++++++++---------- 11 files changed, 85 insertions(+), 85 deletions(-) diff --git a/client/src/components/Categories/__snapshots__/Categories.test.tsx.snap b/client/src/components/Categories/__snapshots__/Categories.test.tsx.snap index 85bac8f4..3e05a31d 100644 --- a/client/src/components/Categories/__snapshots__/Categories.test.tsx.snap +++ b/client/src/components/Categories/__snapshots__/Categories.test.tsx.snap @@ -254,7 +254,7 @@ exports[`rendering of the Categories checks if component renders 1`] = ` > historic underinvestment - OR are at or above the 90th percentile for the + OR are at or above the 90th percentile for
  • - Responsible Party: + Responsible party: Census
  • diff --git a/client/src/components/DatasetContainer/tests/__snapshots__/datasetContainer.test.tsx.snap b/client/src/components/DatasetContainer/tests/__snapshots__/datasetContainer.test.tsx.snap index adc62515..aa7bc368 100644 --- a/client/src/components/DatasetContainer/tests/__snapshots__/datasetContainer.test.tsx.snap +++ b/client/src/components/DatasetContainer/tests/__snapshots__/datasetContainer.test.tsx.snap @@ -114,7 +114,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Census
  • @@ -166,7 +166,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: U.S. Census
  • @@ -217,7 +217,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Federal Emergency Management Agency (FEMA)
  • @@ -268,7 +268,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Federal Emergency Management Agency (FEMA)
  • @@ -331,7 +331,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Federal Emergency Management Agency (FEMA)
  • @@ -388,7 +388,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: First Street Foundation
  • @@ -445,7 +445,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: First Street Foundation
  • @@ -496,7 +496,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Department of Energy (DOE)
  • @@ -547,7 +547,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Environmental Protection Agency (EPA) Office of Air and Radiation (OAR)
  • @@ -599,7 +599,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Centers for Disease Control and Prevention (CDC)
  • @@ -650,7 +650,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Centers for Disease Control and Prevention (CDC)
  • @@ -701,7 +701,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Centers for Disease Control and Prevention (CDC)
  • @@ -763,7 +763,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Centers for Disease Control and Prevention (CDC)
  • @@ -845,7 +845,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: National Community Reinvestment Coalition (NCRC)
  • @@ -896,7 +896,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Department of Housing and Urban Development (HUD)
  • @@ -954,7 +954,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Data from @@ -1043,7 +1043,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Department of Housing and Urban Development (HUD)
  • @@ -1094,7 +1094,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: U.S. Census
  • @@ -1151,7 +1151,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Department of the Interior (DOI)
  • @@ -1208,7 +1208,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: U.S. Army Corps of Engineers
  • @@ -1259,7 +1259,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Environmental Protection Agency (EPA)
  • @@ -1314,7 +1314,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Environmental Protection Agency (EPA)
  • @@ -1365,7 +1365,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Environmental Protection Agency (EPA)
  • @@ -1416,7 +1416,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Environmental Protection Agency (EPA)
  • @@ -1484,7 +1484,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Department of Transportation (DOT)
  • @@ -1535,7 +1535,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Department of Transportation (DOT)
  • @@ -1592,7 +1592,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Environmental Protection Agency (EPA)
  • @@ -1646,7 +1646,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Environmental Protection Agency (EPA)
  • @@ -1697,7 +1697,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: U.S. Census
  • @@ -1770,7 +1770,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: U.S. Census
  • @@ -1843,7 +1843,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: U.S. Census
  • @@ -1916,7 +1916,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: U.S. Census
  • @@ -1989,7 +1989,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: U.S. Census
  • @@ -2081,7 +2081,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
  • - Responsible Party: + Responsible party: Bureau of Indian Affairs (BIA)
  • diff --git a/client/src/components/Indicator/__snapshots__/Indicator.test.tsx.snap b/client/src/components/Indicator/__snapshots__/Indicator.test.tsx.snap index 3028fdaf..c38bd495 100644 --- a/client/src/components/Indicator/__snapshots__/Indicator.test.tsx.snap +++ b/client/src/components/Indicator/__snapshots__/Indicator.test.tsx.snap @@ -343,7 +343,7 @@ exports[`test rendering of Indicator value sub-text renders the "above 90 percen exports[`test rendering of Indicator value sub-text renders the "below 90 percentile" 1`] = `
    - below 90 + not above 90 diff --git a/client/src/components/ReleaseUpdate/ReleaseUpdate.tsx b/client/src/components/ReleaseUpdate/ReleaseUpdate.tsx index 5c465bf6..57b4f3e4 100644 --- a/client/src/components/ReleaseUpdate/ReleaseUpdate.tsx +++ b/client/src/components/ReleaseUpdate/ReleaseUpdate.tsx @@ -87,9 +87,9 @@ const ReleaseUpdate = ({}: IReleaseUpdateProps) => {
    {intl.formatMessage(EXPLORE_COPY.COMMUNITY.SEND_FEEDBACK.IMG_ICON.ALT_TAG)}
    diff --git a/client/src/components/DatasetCard/tests/__snapshots__/datasetCard.test.tsx.snap b/client/src/components/DatasetCard/tests/__snapshots__/datasetCard.test.tsx.snap index b4c915f4..fb738d35 100644 --- a/client/src/components/DatasetCard/tests/__snapshots__/datasetCard.test.tsx.snap +++ b/client/src/components/DatasetCard/tests/__snapshots__/datasetCard.test.tsx.snap @@ -45,7 +45,7 @@ exports[`rendering of indicator dataset card checks if component renders 1`] = ` Responsible party: - Census + U.S. Census
  • diff --git a/client/src/components/DatasetContainer/dsContainer.module.scss b/client/src/components/DatasetContainer/dsContainer.module.scss index 003a4f90..4633d8bd 100644 --- a/client/src/components/DatasetContainer/dsContainer.module.scss +++ b/client/src/components/DatasetContainer/dsContainer.module.scss @@ -11,4 +11,8 @@ display: flex; justify-content: flex-end; @include u-margin-bottom(4); +} + +.alignItemsCenter { + align-items: center; } \ No newline at end of file diff --git a/client/src/components/DatasetContainer/dsContainer.module.scss.d.ts b/client/src/components/DatasetContainer/dsContainer.module.scss.d.ts index 37156d1a..b1cacda7 100644 --- a/client/src/components/DatasetContainer/dsContainer.module.scss.d.ts +++ b/client/src/components/DatasetContainer/dsContainer.module.scss.d.ts @@ -2,6 +2,7 @@ declare namespace DatasetContainerScssNamespace { export interface IDatasetContainerScss { datasetCardsContainer: string; returnToTop: string; + alignItemsCenter: string; } } diff --git a/client/src/components/DatasetContainer/index.tsx b/client/src/components/DatasetContainer/index.tsx index dcab0794..f4c4bd78 100644 --- a/client/src/components/DatasetContainer/index.tsx +++ b/client/src/components/DatasetContainer/index.tsx @@ -27,14 +27,15 @@ const DatasetContainer = () => { - +

    {intl.formatMessage(METHODOLOGY_COPY.DATASETS.INFO)}

    +

    {intl.formatMessage(METHODOLOGY_COPY.DATASETS.CENSUS_DISCLAIMER)}

    - +
    diff --git a/client/src/components/DatasetContainer/tests/__snapshots__/datasetContainer.test.tsx.snap b/client/src/components/DatasetContainer/tests/__snapshots__/datasetContainer.test.tsx.snap index aa7bc368..1d8b7c39 100644 --- a/client/src/components/DatasetContainer/tests/__snapshots__/datasetContainer.test.tsx.snap +++ b/client/src/components/DatasetContainer/tests/__snapshots__/datasetContainer.test.tsx.snap @@ -35,6 +35,11 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis The tool's datasets are public and consistent nationwide. They come from different sources and are high quality. The Council on Environmental Quality (CEQ) chose them based on relevance, availability, and quality. They identify climate, environmental, and other burdens on communities. +

    +

    + + This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau. +

    Responsible party: - Census + U.S. Census
  • diff --git a/client/src/components/DatasetsButton/DatasetsButton.module.scss b/client/src/components/DatasetsButton/DatasetsButton.module.scss index b2cdf9ab..26e1c8a1 100644 --- a/client/src/components/DatasetsButton/DatasetsButton.module.scss +++ b/client/src/components/DatasetsButton/DatasetsButton.module.scss @@ -1,7 +1,6 @@ @use '../../styles/design-system.scss' as *; .datasetsButtonContainer{ - @include u-margin-top(3); @include u-height(6); z-index: 2; diff --git a/client/src/data/copy/methodology.tsx b/client/src/data/copy/methodology.tsx index d01112a4..7053b84d 100644 --- a/client/src/data/copy/methodology.tsx +++ b/client/src/data/copy/methodology.tsx @@ -403,6 +403,13 @@ export const DATASETS = defineMessages({ `, description: 'Navigate to the Methodology page. This is the description of the dataset section', }, + CENSUS_DISCLAIMER: { + id: 'methodology.page.datasetContainer.census.disclaimer', + defaultMessage: ` + This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau. + `, + description: 'Navigate to the Methodology page. This is the disclaimer when using census data', + }, ADDITIONAL_HEADING: { id: 'methodology.page.datasetContainer.additional.heading', defaultMessage: 'Additional Indicators', @@ -857,7 +864,7 @@ export const INDICATORS = [ }} />, usedIn: CATEGORIES.ALL, - responsibleParty: RESPONSIBLE_PARTIES.CEN, + responsibleParty: RESPONSIBLE_PARTIES.CENSUS, sources: [ { source: SOURCE_LINKS.CENSUS_ACS_15_19, diff --git a/client/src/intl/en.json b/client/src/intl/en.json index 926bafa1..9d921cbf 100644 --- a/client/src/intl/en.json +++ b/client/src/intl/en.json @@ -2395,6 +2395,10 @@ "defaultMessage": "Share data sources with CEQ", "description": "Navigate to the Methodology page. This is the section heading of which datasets are used in cumulative score with a button labeled: Share data sources with CEQ" }, + "methodology.page.datasetContainer.census.disclaimer": { + "defaultMessage": "This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau.", + "description": "Navigate to the Methodology page. This is the disclaimer when using census data" + }, "methodology.page.datasetContainer.heading": { "defaultMessage": "Datasets used in beta methodology", "description": "Navigate to the Methodology page. This is the section heading of which datasets are used in cumulative score" diff --git a/client/src/pages/about.tsx b/client/src/pages/about.tsx index 7978e0bf..57651f4e 100644 --- a/client/src/pages/about.tsx +++ b/client/src/pages/about.tsx @@ -8,7 +8,7 @@ import {Grid} from '@trussworks/react-uswds'; import HowYouCanHelp from '../components/HowYouCanHelp'; import J40MainGridContainer from '../components/J40MainGridContainer'; import Layout from '../components/layout'; -import PublicEngageButton from '../components/PublicEngageButton'; +import DatasetsButton from '../components/DatasetsButton'; import SubPageNav from '../components/SubPageNav'; import * as ABOUT_COPY from '../data/copy/about'; @@ -43,7 +43,7 @@ const AboutPage = ({location}: IAboutPageProps) => {

    {intl.formatMessage(ABOUT_COPY.PAGE.TITLE)}

    - +
    diff --git a/client/src/pages/contact.tsx b/client/src/pages/contact.tsx index f4221d51..657cf189 100644 --- a/client/src/pages/contact.tsx +++ b/client/src/pages/contact.tsx @@ -5,7 +5,7 @@ import {useIntl, FormattedMessage} from 'gatsby-plugin-intl'; import J40MainGridContainer from '../components/J40MainGridContainer'; import Layout from '../components/layout'; import LinkTypeWrapper from '../components/LinkTypeWrapper'; -import PublicEngageButton from '../components/PublicEngageButton'; +import DatasetsButton from '../components/DatasetsButton'; import * as CONTACT_COPY from '../data/copy/contact'; import {FEEDBACK_EMAIL} from '../data/copy/common'; @@ -24,7 +24,7 @@ const ContactPage = ({location}: IContactPageProps) => {

    {intl.formatMessage(CONTACT_COPY.PAGE_INTRO.PAGE_HEADING)}

    - +
    diff --git a/client/src/pages/downloads.tsx b/client/src/pages/downloads.tsx index 4db85fa6..df90fa53 100644 --- a/client/src/pages/downloads.tsx +++ b/client/src/pages/downloads.tsx @@ -5,7 +5,7 @@ import {useWindowSize} from 'react-use'; import J40MainGridContainer from '../components/J40MainGridContainer'; import Layout from '../components/layout'; -import PublicEngageButton from '../components/PublicEngageButton'; +import DatasetsButton from '../components/DatasetsButton'; import ReleaseUpdate from '../components/ReleaseUpdate'; import SubPageNav from '../components/SubPageNav'; @@ -26,7 +26,7 @@ const DownloadsPage = ({location}: IDownloadsPageProps) => {

    {intl.formatMessage(DOWNLOADS_COPY.PAGE_INTRO.PAGE_HEADING1)}

    - +
    diff --git a/client/src/pages/frequently-asked-questions.tsx b/client/src/pages/frequently-asked-questions.tsx index 91b2e40e..6e64550f 100644 --- a/client/src/pages/frequently-asked-questions.tsx +++ b/client/src/pages/frequently-asked-questions.tsx @@ -6,7 +6,7 @@ import {useWindowSize} from 'react-use'; import J40MainGridContainer from '../components/J40MainGridContainer'; import Layout from '../components/layout'; -import PublicEngageButton from '../components/PublicEngageButton'; +import DatasetsButton from '../components/DatasetsButton'; import SubPageNav from '../components/SubPageNav'; import {USWDS_BREAKPOINTS} from '../data/constants'; @@ -237,7 +237,7 @@ const FAQPage = ({location}: IFAQPageProps) => {

    {intl.formatMessage(FAQS_COPY.PAGE_INTRO.PAGE_TILE)}

    - +
    diff --git a/client/src/pages/index.tsx b/client/src/pages/index.tsx index b8d034e7..c97e87ee 100644 --- a/client/src/pages/index.tsx +++ b/client/src/pages/index.tsx @@ -6,7 +6,7 @@ import ExploreDataBox from '../components/ExploreDataBox'; import J40Map from '../components/J40Map'; import J40MainGridContainer from '../components/J40MainGridContainer'; import Layout from '../components/layout'; -import PublicEngageButton from '../components/PublicEngageButton'; +import DatasetsButton from '../components/DatasetsButton'; import * as EXPLORE_COPY from '../data/copy/explore'; @@ -26,7 +26,7 @@ const ExporeToolPage = ({location}: IMapPageProps) => {

    {intl.formatMessage(EXPLORE_COPY.PAGE_INTRO.PAGE_HEADING)}

    - +
    diff --git a/client/src/pages/methodology.tsx b/client/src/pages/methodology.tsx index 8b8ea32a..e1d37f38 100644 --- a/client/src/pages/methodology.tsx +++ b/client/src/pages/methodology.tsx @@ -8,7 +8,7 @@ import DatasetContainer from '../components/DatasetContainer'; import J40MainGridContainer from '../components/J40MainGridContainer'; import Layout from '../components/layout'; import SubPageNav from '../components/SubPageNav'; -import PublicEngageButton from '../components/PublicEngageButton'; +import DatasetsButton from '../components/DatasetsButton'; import {USWDS_BREAKPOINTS} from '../data/constants'; import * as METHODOLOGY_COPY from '../data/copy/methodology'; @@ -29,7 +29,7 @@ const IndexPage = ({location}: MethodPageProps) => {

    {intl.formatMessage(METHODOLOGY_COPY.PAGE.HEADING)}

    - +
    diff --git a/client/src/pages/previous-versions.tsx b/client/src/pages/previous-versions.tsx index 10bae9b7..89d7144e 100644 --- a/client/src/pages/previous-versions.tsx +++ b/client/src/pages/previous-versions.tsx @@ -6,7 +6,7 @@ import {Card, CardBody, CardFooter, CardHeader, Grid} from '@trussworks/react-us import DownloadButton from '../components/DownloadButton'; import J40MainGridContainer from '../components/J40MainGridContainer'; import Layout from '../components/layout'; -import PublicEngageButton from '../components/PublicEngageButton'; +import DatasetsButton from '../components/DatasetsButton'; import SubPageNav from '../components/SubPageNav'; import * as PREV_VER_COPY from '../data/copy/previousVer'; @@ -33,7 +33,7 @@ const PreviousVersions = ({location}: IPreviousVersionsProps) => {

    {intl.formatMessage(PREV_VER_COPY.PAGE.TITLE)}

    - +
    diff --git a/client/src/pages/tests/__snapshots__/about.test.tsx.snap b/client/src/pages/tests/__snapshots__/about.test.tsx.snap index 28c9da7f..8813dfec 100644 --- a/client/src/pages/tests/__snapshots__/about.test.tsx.snap +++ b/client/src/pages/tests/__snapshots__/about.test.tsx.snap @@ -392,27 +392,23 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis > About - + Share data sources with CEQ + launch icon + +
    Contact - + Share data sources with CEQ + launch icon + +
    Downloads - + Share data sources with CEQ + launch icon + +
    Frequently asked questions - + Share data sources with CEQ + launch icon + +
    Methodology - + Share data sources with CEQ + launch icon + +
    +

    + + This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau. +

    Responsible party: - Census + U.S. Census
  • diff --git a/client/src/styles/global.scss b/client/src/styles/global.scss index 4d942b8b..335ac24c 100644 --- a/client/src/styles/global.scss +++ b/client/src/styles/global.scss @@ -166,6 +166,7 @@ li.usa-nav__primary-item a:hover::after{ .page-heading { display: flex; justify-content: space-between; + align-items: flex-end; @include at-media-max("tablet"){ flex-direction: column; From bc511756a9295b7dc68120a5d517bc65702e26e1 Mon Sep 17 00:00:00 2001 From: Vim <86254807+vim-usds@users.noreply.github.com> Date: Tue, 14 Feb 2023 11:06:24 -0800 Subject: [PATCH 6/8] add instructions to download page (#2165) - closes #2163 --- client/.env.development | 2 +- client/.env.production | 2 +- client/src/data/copy/downloads.tsx | 16 +++++++++++++++- client/src/intl/en.json | 4 ++++ client/src/pages/downloads.tsx | 3 +++ .../tests/__snapshots__/downloads.test.tsx.snap | 12 ++++++++++++ 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/client/.env.development b/client/.env.development index ee88299b..6cd14e07 100644 --- a/client/.env.development +++ b/client/.env.development @@ -23,7 +23,7 @@ GATSBY_FILE_DL_PATH_1_0_COMMUNITIES_LIST_XLS=downloadable/1.0-communities.xlsx GATSBY_FILE_DL_PATH_1_0_COMMUNITIES_LIST_CSV=downloadable/1.0-communities.csv GATSBY_FILE_DL_PATH_1_0_COMMUNITIES_LIST_PDF=downloadable/1.0-communities-list.pdf GATSBY_FILE_DL_PATH_1_0_SHAPE_FILE_ZIP=downloadable/1.0-shapefile-codebook.zip -GATSBY_FILE_DL_PATH_1_0_INSTRUCT_PDF=downloadable/cejst-instructions-for-federal-agencies.pdf +GATSBY_FILE_DL_PATH_1_0_INSTRUCT_PDF=downloadable/CEQ-CEJST-Instructions.pdf GATSBY_FILE_DL_PATH_1_0_COMP_CHART_PDF=downloadable/total-comparison-chart.pdf GATSBY_FILE_DL_PATH_1_0_TSD_PDF=downloadable/1.0-cejst-technical-support-document.pdf GATSBY_FILE_DL_PATH_1_0_TOOL_COMP_PDF=downloadable/1.0-climate-and-environmental-burden-tool-comparison.pdf diff --git a/client/.env.production b/client/.env.production index 8afbe015..f89ababa 100644 --- a/client/.env.production +++ b/client/.env.production @@ -20,7 +20,7 @@ GATSBY_FILE_DL_PATH_1_0_COMMUNITIES_LIST_XLS=downloadable/1.0-communities.xlsx GATSBY_FILE_DL_PATH_1_0_COMMUNITIES_LIST_CSV=downloadable/1.0-communities.csv GATSBY_FILE_DL_PATH_1_0_COMMUNITIES_LIST_PDF=downloadable/1.0-communities-list.pdf GATSBY_FILE_DL_PATH_1_0_SHAPE_FILE_ZIP=downloadable/1.0-shapefile-codebook.zip -GATSBY_FILE_DL_PATH_1_0_INSTRUCT_PDF=downloadable/cejst-instructions-for-federal-agencies.pdf +GATSBY_FILE_DL_PATH_1_0_INSTRUCT_PDF=downloadable/CEQ-CEJST-Instructions.pdf GATSBY_FILE_DL_PATH_1_0_COMP_CHART_PDF=downloadable/total-comparison-chart.pdf GATSBY_FILE_DL_PATH_1_0_TSD_PDF=downloadable/1.0-cejst-technical-support-document.pdf GATSBY_FILE_DL_PATH_1_0_TOOL_COMP_PDF=downloadable/1.0-climate-and-environmental-burden-tool-comparison.pdf diff --git a/client/src/data/copy/downloads.tsx b/client/src/data/copy/downloads.tsx index 4b53ce2f..cf9987d5 100644 --- a/client/src/data/copy/downloads.tsx +++ b/client/src/data/copy/downloads.tsx @@ -70,7 +70,7 @@ export const DOWNLOAD_FILES = { LAST_UPDATED: COMMON_COPY.METH_1_0_RELEASE_DATE, }, INSTRUCTIONS: { - SIZE: .8, // KB // Todo: Update when actual file is uploaded + SIZE: 228.4, // KB // Todo: Update when actual file is uploaded URL: getDownloadFileUrl(process.env.GATSBY_FILE_DL_PATH_1_0_INSTRUCT_PDF, false), LAST_UPDATED: COMMON_COPY.METH_1_0_RELEASE_DATE, }, @@ -598,5 +598,19 @@ export const DOWNLOAD_LINKS = { />, }} />, + LINK6: Instructions to Federal agencies on using the CEJST (.pdf {instructions})`} + description={'Navigate to the download page. This is sixth download file link'} + values={{ + link6: COMMON_COPY.linkFn(DOWNLOAD_FILES.NARWAL.INSTRUCTIONS.URL, false, true), + instructions: , + }} + />, // }; }; diff --git a/client/src/intl/en.json b/client/src/intl/en.json index 9d921cbf..803294dc 100644 --- a/client/src/intl/en.json +++ b/client/src/intl/en.json @@ -307,6 +307,10 @@ "defaultMessage": "How to use the list of communities (.pdf {howToCommFileSize})", "description": "Navigate to the download page. This is fifth download file link" }, + "download.page.download.file.6": { + "defaultMessage": "Instructions to Federal agencies on using the CEJST (.pdf {instructions})", + "description": "Navigate to the download page. This is sixth download file link" + }, "download.page.files.section.title": { "defaultMessage": "Version {version} file formats", "description": "Navigate to the download page. This is first download file link" diff --git a/client/src/pages/downloads.tsx b/client/src/pages/downloads.tsx index df90fa53..87bac5f7 100644 --- a/client/src/pages/downloads.tsx +++ b/client/src/pages/downloads.tsx @@ -54,6 +54,9 @@ const DownloadsPage = ({location}: IDownloadsPageProps) => {

    {DOWNLOADS_COPY.DOWNLOAD_LINKS.LINK4}

    +

    + {DOWNLOADS_COPY.DOWNLOAD_LINKS.LINK6} +

    {DOWNLOADS_COPY.DOWNLOAD_LINKS.LINK5}

    diff --git a/client/src/pages/tests/__snapshots__/downloads.test.tsx.snap b/client/src/pages/tests/__snapshots__/downloads.test.tsx.snap index 8f6f5b25..58d8bf09 100644 --- a/client/src/pages/tests/__snapshots__/downloads.test.tsx.snap +++ b/client/src/pages/tests/__snapshots__/downloads.test.tsx.snap @@ -723,6 +723,18 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis (.pdf 4.4MB)

    +

    + + Instructions to Federal agencies on using the CEJST + + (.pdf 228.4kB) +

    Date: Tue, 21 Feb 2023 14:49:49 -0800 Subject: [PATCH 7/8] update EO date (#2173) - closes #2170 --- client/src/data/copy/about.tsx | 2 +- client/src/intl/en.json | 2 +- client/src/pages/tests/__snapshots__/about.test.tsx.snap | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/data/copy/about.tsx b/client/src/data/copy/about.tsx index fc2d855a..cb1b7405 100644 --- a/client/src/data/copy/about.tsx +++ b/client/src/data/copy/about.tsx @@ -27,7 +27,7 @@ export const CONTENT = { Executive Order 14008. The order directed the Council on Environmental Quality (CEQ) to develop a new tool. This tool is called the Climate and Economic Justice Screening Tool. The tool has an interactive map and uses datasets that are indicators of burdens in eight categories: climate change, energy, health, housing, legacy pollution, transportation, water and wastewater, and workforce development. The tool uses this information to identify communities that are experiencing these burdens. These are the communities that are disadvantaged because they are overburdened and underserved. + In January of 2021, President Biden issued Executive Order 14008. The order directed the Council on Environmental Quality (CEQ) to develop a new tool. This tool is called the Climate and Economic Justice Screening Tool. The tool has an interactive map and uses datasets that are indicators of burdens in eight categories: climate change, energy, health, housing, legacy pollution, transportation, water and wastewater, and workforce development. The tool uses this information to identify communities that are experiencing these burdens. These are the communities that are disadvantaged because they are overburdened and underserved. `} description={'Navigate to the About page. This is the paragraph 1'} diff --git a/client/src/intl/en.json b/client/src/intl/en.json index 803294dc..3acc4353 100644 --- a/client/src/intl/en.json +++ b/client/src/intl/en.json @@ -64,7 +64,7 @@ "description": "Navigate to the About page. This is the list item 2" }, "about.page.paragraph.1": { - "defaultMessage": "In January of 2020, President Biden issued Executive Order 14008. The order directed the Council on Environmental Quality (CEQ) to develop a new tool. This tool is called the Climate and Economic Justice Screening Tool. The tool has an interactive map and uses datasets that are indicators of burdens in eight categories: climate change, energy, health, housing, legacy pollution, transportation, water and wastewater, and workforce development. The tool uses this information to identify communities that are experiencing these burdens. These are the communities that are disadvantaged because they are overburdened and underserved.", + "defaultMessage": "In January of 2021, President Biden issued Executive Order 14008. The order directed the Council on Environmental Quality (CEQ) to develop a new tool. This tool is called the Climate and Economic Justice Screening Tool. The tool has an interactive map and uses datasets that are indicators of burdens in eight categories: climate change, energy, health, housing, legacy pollution, transportation, water and wastewater, and workforce development. The tool uses this information to identify communities that are experiencing these burdens. These are the communities that are disadvantaged because they are overburdened and underserved.", "description": "Navigate to the About page. This is the paragraph 1" }, "about.page.paragraph.2": { diff --git a/client/src/pages/tests/__snapshots__/about.test.tsx.snap b/client/src/pages/tests/__snapshots__/about.test.tsx.snap index 8813dfec..0dcda83f 100644 --- a/client/src/pages/tests/__snapshots__/about.test.tsx.snap +++ b/client/src/pages/tests/__snapshots__/about.test.tsx.snap @@ -421,7 +421,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis

    - In January of 2020, President Biden issued + In January of 2021, President Biden issued Date: Tue, 21 Feb 2023 16:50:31 -0600 Subject: [PATCH 8/8] Add ability to compare scores (#2172) * Add ability to perform score comparisons, and include that ability in github action * Update version of add-pr-comment * Update code with black * Update comparator.py * Fix message-path and remove extra parameter * Update the text to be a bit more friendly and easy to read --- .github/workflows/deploy_be_staging.yml | 10 +- .../data-pipeline/data_pipeline/comparator.py | 174 ++++++++++++++++++ 2 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 data/data-pipeline/data_pipeline/comparator.py diff --git a/.github/workflows/deploy_be_staging.yml b/.github/workflows/deploy_be_staging.yml index f2ed1d97..912d6596 100644 --- a/.github/workflows/deploy_be_staging.yml +++ b/.github/workflows/deploy_be_staging.yml @@ -72,7 +72,6 @@ jobs: run: | poetry run s4cmd put ./data_pipeline/data/score/csv/ s3://justice40-data/data-pipeline-staging/${{env.PR_NUMBER}}/${{env.SHA_NUMBER}}/data/score/csv --recursive --force --API-ACL=public-read poetry run s4cmd put ./data_pipeline/files/ s3://justice40-data/data-pipeline-staging/${{env.PR_NUMBER}}/${{env.SHA_NUMBER}}/data/score/downloadable --recursive --force --API-ACL=public-read - - name: Update PR with deployed Score URLs uses: mshick/add-pr-comment@v1 with: @@ -85,6 +84,15 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token-user-login: "github-actions[bot]" allow-repeats: false + - name: Perform Score Comparisons + run: | + poetry run python3 data_pipeline/comparator.py compare-score + - name: Update PR with Score Comparisons + uses: mshick/add-pr-comment@v2 + with: + message-path: ./data/data-pipeline/data_pipeline/data/tmp/Comparator/Score/comparison-summary.md + repo-token: ${{ secrets.GITHUB_TOKEN }} + allow-repeats: false - name: Set timezone for tippecanoe uses: szenius/set-timezone@v1.0 with: diff --git a/data/data-pipeline/data_pipeline/comparator.py b/data/data-pipeline/data_pipeline/comparator.py new file mode 100644 index 00000000..b170a7b5 --- /dev/null +++ b/data/data-pipeline/data_pipeline/comparator.py @@ -0,0 +1,174 @@ +import sys +import click +import difflib +import pandas as pd + +from data_pipeline.etl.score import constants +from data_pipeline.utils import get_module_logger, download_file_from_url +from data_pipeline.application import log_title, log_info, log_goodbye + +logger = get_module_logger(__name__) + +pd.set_option("display.max_columns", None) +pd.set_option("display.max_colwidth", None) +pd.set_option("display.max_rows", None) +pd.set_option("display.width", 10000) +pd.set_option("display.colheader_justify", "left") + + +@click.group() +def cli(): + """ + A helper tool to run comparisons between files in production and those + in the local file system. + """ + + +@cli.command( + help="Compare score stored in the AWS production environment to the production score. Defaults to checking against version 1.0.", +) +@click.option( + "-v", + "--compare-to-version", + default="1.0", + required=False, + type=str, +) +def compare_score(compare_to_version: str): + """Compares the score in the production environment to the locally generated score. The + algorithm is pretty simple: + + 1. Fetch and load both scores into dataframes. + 2. Round floats to a number of decimal places to account for differences in the machine + and python versions used to generate the scores. If we skip this step, there are usually + thousands of extremely minor differences. + 3. Compare the columns. Print out the deltas. + 4. Compare the values. Print out the deltas. Save the deltas to deltas.csv. + 5. Save a nice summary to comparison-summary.md. End. + """ + + FLOAT_ROUNDING_PLACES = 2 + WORKING_PATH = constants.TMP_PATH / "Comparator" / "Score" + + summary = "# Score Comparison Summary\n" + summary += f"Hi! I'm the Score Comparator. I compared the score in production (version {compare_to_version}) to the" + summary += " freshly calculated score. Here are the results.\n" + + log_title("Compare Score", "Compare production score to local score") + + locally_generated_score_path = constants.DATA_SCORE_CSV_FULL_FILE_PATH + if not locally_generated_score_path.is_file(): + logger.error( + f"- No score file exists at {locally_generated_score_path}. Please generate the score and try again." + ) + sys.exit(1) + + # TODO: transition to downloader code when it's available + production_score_url = f"https://justice40-data.s3.amazonaws.com/data-versions/{compare_to_version}/data/score/csv/full/usa.csv" + production_score_path = WORKING_PATH / "usa.csv" + + log_info(f"Fetching score version {compare_to_version} from AWS") + production_score_path.parent.mkdir(parents=True, exist_ok=True) + download_file_from_url( + file_url=production_score_url, download_file_name=production_score_path + ) + + log_info("Loading files into pandas for comparisons") + + local_score_df = pd.read_csv( + locally_generated_score_path, + index_col="GEOID10_TRACT", + dtype={"GEOID10_TRACT": str}, + low_memory=False, + ).sort_index() + production_score_df = pd.read_csv( + production_score_path, + index_col="GEOID10_TRACT", + dtype={"GEOID10_TRACT": str}, + low_memory=False, + ).sort_index() + + # Because of variations in Python versions and machine-level calculations, some of + # our numbers can be really close but not the same. That throws off our comparisons. + # So we're going to round to a reasonable amount of digits before doing anything else. + + production_score_df = production_score_df.round(FLOAT_ROUNDING_PLACES) + local_score_df = local_score_df.round(FLOAT_ROUNDING_PLACES) + + local_score_df_columns = sorted(local_score_df.columns.array.tolist()) + production_score_df_columns = sorted( + production_score_df.columns.array.tolist() + ) + + log_info("Comparing columns (production vs local). Differences are: ") + summary += "\n## Columns\n" + summary += "I compared the columns. Here's what I found.\n" + + col_diff = difflib.unified_diff( + production_score_df_columns, local_score_df_columns + ) + col_diff_res = "" + for d in col_diff: + col_diff_res += str(d) + "\n" + + if len(col_diff_res) == 0: + log_info("None. Columns are the same") + summary += "* There are no differences in the column names.\n" + else: + log_info("There are differences. The diff is:") + log_info(col_diff_res) + summary += f"* There are differences in the column names. Here's a diff:\n{col_diff_res}\n" + + log_info("Comparing dataframe contents (production vs local)") + summary += "\n## Scores\n" + summary += "I compared the scores, too. Here's what I found.\n" + + production_row_count = len(production_score_df.index) + local_row_count = len(local_score_df.index) + + summary += f"* The production score has {production_row_count:,} census tracts, and the freshly calculated score has {local_row_count:,}." + summary += ( + " They match!\n" + if production_row_count == local_row_count + else " They don't match.\n" + ) + + try: + + comparison_results_df = production_score_df.compare( + local_score_df, align_axis=1, keep_shape=False, keep_equal=False + ).rename({"self": "Production", "other": "Local"}, axis=1, level=1) + + summary += f"* I compared all of the census tracts. There are {len(comparison_results_df.index):,} tracts with at least one score difference." + summary += " Please examine the logs or run the score comparison locally to view them all.\n" + log_info( + f"There are {len(comparison_results_df.index)} rows with differences" + ) + + log_info("Those differences are:") + log_info("\n" + str(comparison_results_df)) + + comparison_path = WORKING_PATH / "deltas.csv" + comparison_results_df.to_csv(path_or_buf=comparison_path) + + log_info(f"Wrote comparison results to {comparison_path}") + + except ValueError as e: + summary += "* I could not run a full comparison. This is likely because there are column or index (census tract) differences." + summary += " Please examine the logs or run the score comparison locally to find out more.\n" + log_info( + f"Encountered an exception while performing the comparison: {repr(e)}" + ) + + summary_path = WORKING_PATH / "comparison-summary.md" + + with open(summary_path, "w", encoding="utf-8") as f: + f.write(summary) + log_info(f"Wrote comparison summary to {summary_path}") + + log_goodbye() + sys.exit() + + +if __name__ == "__main__": + cli()