cityofaustin / atd-vz-data

The technology that powers the City of Austin's Vision Zero program
https://visionzero.austin.gov/viewer/
11 stars 2 forks source link

Use simplified engineering areas geometries #1444

Closed johnclary closed 3 months ago

johnclary commented 3 months ago

Associated issues

Testing

URL to test: Local

It's worth noting that in the new data model we are going to add a trigger to persist the engineering area ID on the crash record, the same as we do location, council district, and jurisdiction. So this change will add a noticeable performance boost for the current fatalities view, and in the data model this change will provide a performance boost to the location-based trigger.

Steps to test:

  1. Spin up a prod snapshot.

  2. Benchmark the view_fatalities query speed. It runs in ~350ms on my machine:

select * from view_fatalities;
  1. Take note of the current engineering area fatality counts. These should be the same before and after this change:
select engineering_area, count(engineering_area) from view_fatalities group by engineering_area;
  1. Delete the existing engineering areas from the db:
delete from engineering_areas where true;
  1. Save a copy of secrets_template.js as secrets.js and run the script to insert the new engineering areas:
# ./atd-toolbox/engineering_areas_load
$ node insert_areas.js local
  1. Test the improved query speed and check the engineer area fatality counts. They should match the results from earlier.
select engineering_area, count(engineering_area) from view_fatalities group by engineering_area;

Ship list

johnclary commented 3 months ago

thanks for the quick reviews! i'm going to go ahead and run this on staging and prod. it will be nice to have this lil' boost deployed ahead of the tomorrow's sprint review.