Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.4.2 #1618

Closed
wants to merge 12 commits into from
13 changes: 12 additions & 1 deletion .github/workflows/build_docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- "etl/afd_ems_import/**"
- "etl/cris_import/**"
- "etl/socrata_export/**"
- "etl/moped_projects/**"
- "api/**"
workflow_dispatch:

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -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 }}
18 changes: 18 additions & 0 deletions database/metadata/databases/default/tables/public_crashes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -26,13 +32,25 @@ 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:
column: crash_pk
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:
Expand Down
19 changes: 11 additions & 8 deletions etl/moped_projects/README.md
Original file line number Diff line number Diff line change
@@ -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`.
2 changes: 1 addition & 1 deletion etl/moped_projects/env_template
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions etl/moped_projects/moped_project_components_spatial_join.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
import requests
import os
import logging
Expand Down