diff --git a/.github/workflows/create-score-version.yml b/.github/workflows/create-score-version.yml index 103da8439..464ee58a2 100644 --- a/.github/workflows/create-score-version.yml +++ b/.github/workflows/create-score-version.yml @@ -26,6 +26,7 @@ jobs: matrix: python-version: [3.9] steps: + # Pull in source and setup the build environment - name: Checkout source uses: actions/checkout@v2 - name: Print variables to help debug @@ -58,46 +59,6 @@ jobs: sudo apt-get update sudo apt-get -y install gdal-bin ogrinfo --version - - name: Generate Score - run: | - poetry run python3 data_pipeline/application.py score-full-run - - name: Generate Score Post - run: | - poetry run python3 data_pipeline/application.py generate-score-post -s aws - - name: Confirm we generated the version of the score we think we did - if: ${{ env.J40_VERSION_LABEL_STRING == '1.0' || env.J40_VERSION_LABEL_STRING == 'test' }} - run: | - grep "Identified as disadvantaged due to tribal overlap" data_pipeline/data/score/downloadable/* > /dev/null - - name: Confirm we generated the version of the score we think we did - if: ${{ env.J40_VERSION_LABEL_STRING == 'beta' }} - run: | - grep -v "Identified as disadvantaged due to tribal overlap" data_pipeline/data/score/downloadable/* > /dev/null - - name: Generate Score Geo - run: | - poetry run python3 data_pipeline/application.py geo-score - - name: Run smoketest for 1.0 - if: ${{ env.J40_VERSION_LABEL_STRING == '1.0' || env.J40_VERSION_LABEL_STRING == 'test' }} - run: | - poetry run pytest data_pipeline/ -m smoketest - - name: Deploy Score to Geoplatform AWS - run: | - poetry run s4cmd put ./data_pipeline/data/score/csv/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/csv --recursive --force --API-ACL=public-read - poetry run s4cmd put ./data_pipeline/files/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable --recursive --force --API-ACL=public-read - poetry run s4cmd put ./data_pipeline/data/score/downloadable/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable --recursive --force --API-ACL=public-read - - name: Confirm we generated the version of the score we think we did - if: ${{ env.J40_VERSION_LABEL_STRING == '1.0' || env.J40_VERSION_LABEL_STRING == 'test' }} - run: | - curl "https://static-data-screeningtool.geoplatform.gov/data-versions/1.0/data/score/downloadable/1.0-shapefile-codebook.zip" -s -f -I -o /dev/null && \ - curl "https://static-data-screeningtool.geoplatform.gov/data-versions/1.0/data/score/downloadable/1.0-communities.xlsx" -s -f -I -o /dev/null && \ - curl "https://static-data-screeningtool.geoplatform.gov/data-versions/1.0/data/score/downloadable/1.0-communities.csv" -s -f -I -o /dev/null && \ - curl "https://static-data-screeningtool.geoplatform.gov/data-versions/1.0/data/score/downloadable/1.0-shapefile-codebook.zip" -s -f -I -o /dev/null && \ - curl "https://static-data-screeningtool.geoplatform.gov/data-versions/1.0/data/score/downloadable/cejst-technical-support-document.pdf" -s -f -I -o /dev/null && \ - curl "https://static-data-screeningtool.geoplatform.gov/data-versions/1.0/data/score/downloadable/draft-communities-list.pdf" -s -f -I -o /dev/null - - name: Confirm we generated the version of the score we think we did - if: ${{ env.J40_VERSION_LABEL_STRING == 'beta' }} - run: | - curl "https://static-data-screeningtool.geoplatform.gov/data-versions/beta/data/score/downloadable/beta-data-documentation.zip" -s -f -I -o /dev/null && \ - curl "https://static-data-screeningtool.geoplatform.gov/data-versions/beta/data/score/downloadable/beta-shapefile-codebook.zip" -s -f -I -o /dev/null - name: Set timezone for tippecanoe uses: szenius/set-timezone@v1.0 with: @@ -115,11 +76,81 @@ jobs: mkdir -p /usr/local/bin cp tippecanoe /usr/local/bin/tippecanoe tippecanoe -v + + # Generate score and map tiles + - name: Generate Score + run: | + poetry run python3 data_pipeline/application.py score-full-run + - name: Generate Score Post + run: | + poetry run python3 data_pipeline/application.py generate-score-post -s aws + - name: Generate Score Geo + run: | + poetry run python3 data_pipeline/application.py geo-score - name: Generate Tiles run: | poetry run python3 data_pipeline/application.py generate-map-tiles + + # Run basic smoke tests on score and map tiles + - name: Confirm we generated the version of the score we think we did + if: ${{ env.J40_VERSION_LABEL_STRING != 'beta' }} + run: | + grep "Identified as disadvantaged due to tribal overlap" data_pipeline/data/score/downloadable/* > /dev/null + - name: Confirm we generated the version of the score we think we did + if: ${{ env.J40_VERSION_LABEL_STRING == 'beta' }} + run: | + grep -v "Identified as disadvantaged due to tribal overlap" data_pipeline/data/score/downloadable/* > /dev/null + - name: Run smoketest + if: ${{ env.J40_VERSION_LABEL_STRING != 'beta' }} + run: | + poetry run pytest data_pipeline/ -m smoketest + + # Deploy to AWS + - name: Deploy Score to Geoplatform AWS + run: | + poetry run s4cmd put ./data_pipeline/data/score/csv/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/csv --recursive --force --API-ACL=public-read + poetry run s4cmd put ./data_pipeline/files/static/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable --recursive --force --API-ACL=public-read + poetry run s4cmd put ./data_pipeline/data/score/downloadable/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable --recursive --force --API-ACL=public-read - name: Deploy Map to Geoplatform AWS run: | poetry run s4cmd put ./data_pipeline/data/score/geojson/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/geojson --recursive --force --API-ACL=public-read --num-threads=250 poetry run s4cmd put ./data_pipeline/data/score/shapefile/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/${{env.SHA_NUMBER}}/data/score/shapefile --recursive --force --API-ACL=public-read poetry run s4cmd put ./data_pipeline/data/score/tiles/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/tiles --recursive --force --API-ACL=public-read --num-threads=250 + - name: Deploy Test Files to Geoplatform AWS + if: ${{ env.J40_VERSION_LABEL_STRING == 'test' }} + run: | + poetry run s4cmd put ./data_pipeline/files/test/ s3://justice40-data/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable --recursive --force --API-ACL=public-read + + # Run more smoke tests to ensure we deployed everything correctly + - name: Confirm we deployed downloadables to AWS + if: ${{ env.J40_VERSION_LABEL_STRING != 'beta' && env.J40_VERSION_LABEL_STRING != 'test' }} + run: | + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/${{env.J40_VERSION_LABEL_STRING}}-shapefile-codebook.zip" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/${{env.J40_VERSION_LABEL_STRING}}-communities.xlsx" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/${{env.J40_VERSION_LABEL_STRING}}-communities.csv" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/${{env.J40_VERSION_LABEL_STRING}}-communities-xls.zip" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/${{env.J40_VERSION_LABEL_STRING}}-communities-csv.zip" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/${{env.J40_VERSION_LABEL_STRING}}-codebook.csv" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/${{env.J40_VERSION_LABEL_STRING}}-data-documentation.zip" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/cejst-technical-support-document.pdf" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/CEQ-CEJST-Instructions.pdf" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/climate-and-environmental-burden-tool-comparison.pdf" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/communities-list.pdf" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/readme.md" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/technical-training-slides.pptx" -s -f -I -o /dev/null + - name: Confirm we deployed downloadables to AWS (beta) + if: ${{ env.J40_VERSION_LABEL_STRING == 'beta' }} + run: | + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/beta/data/score/downloadable/beta-data-documentation.zip" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/beta/data/score/downloadable/beta-shapefile-codebook.zip" -s -f -I -o /dev/null + - name: Confirm we deployed additional downloadables – from the files directory – to AWS (test) + if: ${{ env.J40_VERSION_LABEL_STRING == 'test' }} + run: | + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/test.md" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/cejst-technical-support-document.pdf" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/CEQ-CEJST-Instructions.pdf" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/climate-and-environmental-burden-tool-comparison.pdf" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/communities-list.pdf" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/readme.md" -s -f -I -o /dev/null && \ + curl "https://static-data-screeningtool.geoplatform.gov/data-versions/${{env.J40_VERSION_LABEL_STRING}}/data/score/downloadable/technical-training-slides.pptx" -s -f -I -o /dev/null + \ No newline at end of file diff --git a/data/data-pipeline/data_pipeline/etl/score/constants.py b/data/data-pipeline/data_pipeline/etl/score/constants.py index ea63f8543..035d71a27 100644 --- a/data/data-pipeline/data_pipeline/etl/score/constants.py +++ b/data/data-pipeline/data_pipeline/etl/score/constants.py @@ -10,7 +10,7 @@ # Base Paths DATA_PATH = Path(settings.APP_ROOT) / "data" TMP_PATH = DATA_PATH / "tmp" -FILES_PATH = Path(settings.APP_ROOT) / "files" +FILES_PATH = Path(settings.APP_ROOT) / "files" / "static" # Remote Paths CENSUS_COUNTIES_ZIP_URL = "https://www2.census.gov/geo/docs/maps-data/data/gazetteer/Gaz_counties_national.zip" @@ -52,7 +52,7 @@ version_str = os.environ.get("J40_VERSION_LABEL_STRING") SCORE_DOWNLOADABLE_DIR = DATA_SCORE_DIR / "downloadable" -SCORE_DOWNLOADABLE_PDF_FILE_NAME = "draft-communities-list.pdf" +SCORE_DOWNLOADABLE_PDF_FILE_NAME = "communities-list.pdf" SCORE_DOWNLOADABLE_PDF_FILE_PATH = FILES_PATH / SCORE_DOWNLOADABLE_PDF_FILE_NAME SCORE_DOWNLOADABLE_TSD_FILE_NAME = "cejst-technical-support-document.pdf" SCORE_DOWNLOADABLE_TSD_FILE_PATH = FILES_PATH / SCORE_DOWNLOADABLE_TSD_FILE_NAME @@ -77,7 +77,7 @@ SCORE_VERSIONING_SHAPEFILE_CODEBOOK_FILE_PATH = ( SCORE_DOWNLOADABLE_DIR / f"{version_str}-shapefile-codebook.zip" ) -SCORE_VERSIONING_README_FILE_NAME = f"readme-version-{version_str}.md" +SCORE_VERSIONING_README_FILE_NAME = "readme.md" SCORE_VERSIONING_README_FILE_PATH = ( FILES_PATH / SCORE_VERSIONING_README_FILE_NAME ) diff --git a/data/data-pipeline/data_pipeline/etl/score/tests/test_score_post.py b/data/data-pipeline/data_pipeline/etl/score/tests/test_score_post.py index 9fc51a669..8823e10ab 100644 --- a/data/data-pipeline/data_pipeline/etl/score/tests/test_score_post.py +++ b/data/data-pipeline/data_pipeline/etl/score/tests/test_score_post.py @@ -125,7 +125,7 @@ def test_load_tile_csv(etl, tile_data_expected): def test_load_downloadable_zip(etl, monkeypatch, score_data_expected): reload(constants) static_files_path = ( - Path.cwd() / "data_pipeline" / "files" + Path.cwd() / "data_pipeline" / "files" / "static" ) # need to monkeypatch to real dir monkeypatch.setattr(constants, "FILES_PATH", static_files_path) monkeypatch.setattr( diff --git a/data/data-pipeline/data_pipeline/files/cejst-technical-support-document-es.pdf b/data/data-pipeline/data_pipeline/files/cejst-technical-support-document-es.pdf deleted file mode 100644 index 92ff73fbb..000000000 Binary files a/data/data-pipeline/data_pipeline/files/cejst-technical-support-document-es.pdf and /dev/null differ diff --git a/data/data-pipeline/data_pipeline/files/cejst-technical-support-document.pdf b/data/data-pipeline/data_pipeline/files/cejst-technical-support-document.pdf deleted file mode 100644 index 712949483..000000000 Binary files a/data/data-pipeline/data_pipeline/files/cejst-technical-support-document.pdf and /dev/null differ diff --git a/data/data-pipeline/data_pipeline/files/draft-communities-list.pdf b/data/data-pipeline/data_pipeline/files/draft-communities-list.pdf deleted file mode 100644 index 8989fc817..000000000 Binary files a/data/data-pipeline/data_pipeline/files/draft-communities-list.pdf and /dev/null differ diff --git a/data/data-pipeline/data_pipeline/files/readme-version-1.0.md b/data/data-pipeline/data_pipeline/files/readme-version-1.0.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/data/data-pipeline/data_pipeline/files/readme-version-beta.md b/data/data-pipeline/data_pipeline/files/readme-version-beta.md deleted file mode 100644 index d0dbec539..000000000 --- a/data/data-pipeline/data_pipeline/files/readme-version-beta.md +++ /dev/null @@ -1,3 +0,0 @@ -# README - -This is the beta version of the CEJST tool \ No newline at end of file diff --git a/data/data-pipeline/data_pipeline/files/static/CEQ-CEJST-Instructions.pdf b/data/data-pipeline/data_pipeline/files/static/CEQ-CEJST-Instructions.pdf new file mode 100644 index 000000000..d3dd3e89a Binary files /dev/null and b/data/data-pipeline/data_pipeline/files/static/CEQ-CEJST-Instructions.pdf differ diff --git a/data/data-pipeline/data_pipeline/files/static/cejst-technical-support-document.pdf b/data/data-pipeline/data_pipeline/files/static/cejst-technical-support-document.pdf new file mode 100644 index 000000000..a5eb54f26 Binary files /dev/null and b/data/data-pipeline/data_pipeline/files/static/cejst-technical-support-document.pdf differ diff --git a/data/data-pipeline/data_pipeline/files/static/climate-and-environmental-burden-tool-comparison.pdf b/data/data-pipeline/data_pipeline/files/static/climate-and-environmental-burden-tool-comparison.pdf new file mode 100644 index 000000000..08c1f3534 Binary files /dev/null and b/data/data-pipeline/data_pipeline/files/static/climate-and-environmental-burden-tool-comparison.pdf differ diff --git a/data/data-pipeline/data_pipeline/files/static/communities-list.pdf b/data/data-pipeline/data_pipeline/files/static/communities-list.pdf new file mode 100644 index 000000000..4fa20ad10 Binary files /dev/null and b/data/data-pipeline/data_pipeline/files/static/communities-list.pdf differ diff --git a/data/data-pipeline/data_pipeline/files/static/readme.md b/data/data-pipeline/data_pipeline/files/static/readme.md new file mode 100644 index 000000000..ea94e38eb --- /dev/null +++ b/data/data-pipeline/data_pipeline/files/static/readme.md @@ -0,0 +1,3 @@ +# README + +This is the 1.0 version of the CEJST tool \ No newline at end of file diff --git a/data/data-pipeline/data_pipeline/files/technical-training-slides.pptx b/data/data-pipeline/data_pipeline/files/static/technical-training-slides.pptx similarity index 100% rename from data/data-pipeline/data_pipeline/files/technical-training-slides.pptx rename to data/data-pipeline/data_pipeline/files/static/technical-training-slides.pptx diff --git a/data/data-pipeline/data_pipeline/files/test/test.md b/data/data-pipeline/data_pipeline/files/test/test.md new file mode 100644 index 000000000..03a5ef487 --- /dev/null +++ b/data/data-pipeline/data_pipeline/files/test/test.md @@ -0,0 +1,3 @@ +# Test + +This file exists as a test to ensure that the file(s) in this folder are deployed to AWS during the deployment process. \ No newline at end of file