diff --git a/.github/workflows/build_docker_images.yml b/.github/workflows/build_docker_images.yml index 1d81d11fb..f68fa3230 100644 --- a/.github/workflows/build_docker_images.yml +++ b/.github/workflows/build_docker_images.yml @@ -10,6 +10,7 @@ on: - "etl/afd_ems_import/**" - "etl/cris_import/**" - "etl/socrata_export/**" + - "etl/moped_projects/**" - "api/**" workflow_dispatch: @@ -41,6 +42,8 @@ jobs: - 'etl/socrata_export/**' user_cr3_api: - 'api/**' + moped_projects: + - 'etl/moped_projects/**' - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -72,6 +75,15 @@ jobs: push: true tags: atddocker/vz-socrata-export:${{ github.ref == 'refs/heads/production' && 'production' || 'development' }} + - name: Build and push VZ-Moped projects ETL image + if: steps.changes.outputs.moped_projects == 'true' + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64 + context: etl/moped_projects + push: true + tags: atddocker/vz-moped-join:${{ github.ref == 'refs/heads/production' && 'production' || 'development' }} + - name: Build and push VZ User & CR3 API image if: steps.changes.outputs.user_cr3_api == 'true' uses: docker/build-push-action@v4 @@ -81,7 +93,6 @@ jobs: push: true tags: atddocker/vz-user-cr3-api:${{ github.ref == 'refs/heads/production' && 'production' || 'latest' }} - - name: Set environment for ECS update if: steps.changes.outputs.user_cr3_api == 'true' run: | diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..596d17a9c --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,25 @@ +name: Release Drafter + +on: + push: + branches: + - main + + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: read + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "main" + - uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/database/metadata/databases/default/tables/public_crashes.yaml b/database/metadata/databases/default/tables/public_crashes.yaml index e62efac12..40fd57465 100644 --- a/database/metadata/databases/default/tables/public_crashes.yaml +++ b/database/metadata/databases/default/tables/public_crashes.yaml @@ -5,6 +5,12 @@ object_relationships: - name: atd_txdot_location using: foreign_key_constraint_on: location_id + - name: city + using: + foreign_key_constraint_on: rpt_city_id + - name: collsn + using: + foreign_key_constraint_on: fhe_collsn_id - name: crash_injury_metrics_view using: manual_configuration: @@ -26,6 +32,12 @@ object_relationships: remote_table: name: crashes_list_view schema: public + - name: light_cond + using: + foreign_key_constraint_on: light_cond_id + - name: obj_struck + using: + foreign_key_constraint_on: obj_struck_id - name: recommendation using: foreign_key_constraint_on: @@ -33,6 +45,12 @@ object_relationships: table: name: recommendations schema: public + - name: traffic_cntl + using: + foreign_key_constraint_on: traffic_cntl_id + - name: wthr_cond + using: + foreign_key_constraint_on: wthr_cond_id array_relationships: - name: change_logs using: diff --git a/etl/moped_projects/README.md b/etl/moped_projects/README.md index a37be82c2..0d97bb9a7 100644 --- a/etl/moped_projects/README.md +++ b/etl/moped_projects/README.md @@ -1,23 +1,26 @@ -# Moped Project Components Spatial Join +# Moped Project Components Spatial Join -This ETL generates a lookup table of [Moped](https://github.com/cityofaustin/atd-moped/) mobility project components -(such as bike lanes, traffic signals, sidewalks) and crashes. This is used to evaluate the impact of Austin's -mobility projects and crashes. +This ETL generates a lookup table of [Moped](https://github.com/cityofaustin/atd-moped/) mobility project components (such as bike lanes, traffic signals, sidewalks) and crashes. This is used to evaluate the impact of Austin's mobility projects and crashes. `moped_project_components_spatial_join.py` buffers the project geometry (points and lines) to a distance of 40 feet then spatially joins the crashes that are inside of that polygon. -## Docker +## Quick start It is recommended to run this script using the docker container. You can build it using: Note, if you are on Apple Silicon you may need to add `--platform linux/amd64` to get GDAL to install correctly. ``` -docker build . -t atddocker/vz-moped-join +docker build . -t atddocker/vz-moped-join:development ``` +Copy the `env_template` template into your own `env_file` and fill in values. Now you can run the script + ``` -docker run -it --rm --network host --env-file env_file atddocker/vz-moped-join /bin/bash -python moped_project_components_spatial_join.py +docker run -it --rm --env-file env_file atddocker/vz-moped-join python moped_project_components_spatial_join.py ``` + +## Docker Image CI + +The docker image will be rebuilt and pushed to Docker Hub whenever a file in this directory is updated and merged to `main` or `prod`. diff --git a/etl/moped_projects/env_template b/etl/moped_projects/env_template index 150c55520..4528882b9 100644 --- a/etl/moped_projects/env_template +++ b/etl/moped_projects/env_template @@ -4,4 +4,4 @@ MOPED_HASURA_ENDPOINT= # Vision Zero Hasura VZ_HASURA_ADMIN_SECRET=hasurapassword -VZ_HASURA_ENDPOINT=http://localhost:8084/v1/graphql +VZ_HASURA_ENDPOINT=http://host.docker.internal:8084/v1/graphql diff --git a/etl/moped_projects/moped_project_components_spatial_join.py b/etl/moped_projects/moped_project_components_spatial_join.py old mode 100644 new mode 100755 index 7a2345679..e26dce2b8 --- a/etl/moped_projects/moped_project_components_spatial_join.py +++ b/etl/moped_projects/moped_project_components_spatial_join.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python import requests import os import logging