-
Notifications
You must be signed in to change notification settings - Fork 4
Create Vision Zero incidents list page #2074
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
Open
johnclary
wants to merge
60
commits into
main
Choose a base branch
from
john/28753-vz-incident-list
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 58 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
28a25af
basic working cad list view page
johnclary 0f9e3b7
add agency to popup
johnclary 8a6e163
add aggregation permissions
johnclary 44136d4
Merge branch 'john/27761-cad-incident-links' into john/incident-view
johnclary f82bbb7
adds vz_incidents list view with significant todos wip
johnclary fb9aa65
add agency_type_short
johnclary 6704ae9
more iterating on incident view, map, etc
johnclary b7a9023
rename to incidents
johnclary 138e844
add agency filters
johnclary e282c0b
add missing semicolon;
johnclary c55876a
🤖 Export database views for john/28753-incident-list
cc72bfb
remove cad page
johnclary 1a9ff05
add hasura rels to vz_incidents_view
johnclary e7613d9
vz -> incidents
johnclary 71ef723
update routes with incidents
johnclary f4d0869
add type gaurd for points
johnclary 11239e8
order unprocessed incidents asc
johnclary dc9a77c
basic incidents page
johnclary 5a10ab6
replace deprecated type
johnclary dac3be3
merge upstream
johnclary ee54c8c
migrations wip
johnclary 78aa578
Merge branch 'main' into john/28753-vz-incident-list
johnclary 568ab53
update views
johnclary 057b88d
update list view with latest changes
johnclary 66ffd93
🤖 Export database views for john/28753-vz-incident-list
c7aceda
filter points with no geom for map
johnclary c358d8d
update map popup
johnclary fb66417
update search config
johnclary bd929ed
add latitude and longitude to view
johnclary a6e4325
update still-broken incident page
johnclary 1cbbd6b
🤖 Export database views for john/28753-vz-incident-list
8654b9f
prune incident details page
johnclary dc70daf
rollback changes that have moved to incident details branch
johnclary 1121d2b
remove cad stuff
johnclary 1dff47e
update export name
johnclary ac2dfd8
add latitude and longitude to type
johnclary 2ccfaa4
lint
johnclary 74ed9f1
bring cad etl changes even with main
johnclary 1bec979
remove unused icon
johnclary 0202acb
require editor and admin permissions for vz incidents
johnclary c268cee
add beta flag to incident list page
johnclary 21e7e1f
remove beta flags from ems
johnclary ff3d618
add timecutoff to records view and refactor incident view a bit
johnclary 237d8d7
🤖 Export database views for john/28753-vz-incident-list
1366f35
lint
johnclary 689931d
use materialized view
johnclary 3b81fac
remove commented code
johnclary 43e4de9
remove dupe op name
johnclary a09f025
remove todos
johnclary 60e6c3d
filter nulls from cols
johnclary ef29ce8
fix drop statement in migra
johnclary 8384dd0
put materalized in statements
johnclary 0b90760
🤖 Export database views for john/28753-vz-incident-list
eaf953f
remove unused imports
johnclary fc6ca6e
fix text wrapping on beta info text
johnclary 96ee8bd
add incident_numbers_str and enable incident number search
johnclary b394a1f
updated record tables col label
johnclary 4cfd1da
add indexes
johnclary a452c95
🤖 Export database views for john/28753-vz-incident-list
257243b
add incident_numbers_str
johnclary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
database/metadata/databases/default/tables/public_vz_incidents_view.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| table: | ||
| name: vz_incidents_view | ||
| schema: public | ||
| select_permissions: | ||
| - role: editor | ||
| permission: | ||
| columns: | ||
| - incident_numbers | ||
| - location_ids | ||
| - record_tables | ||
| - record_tables_str | ||
| - responding_agencies | ||
| - responding_agencies_str | ||
| - id | ||
| - record_count | ||
| - in_austin_full_purpose | ||
| - address | ||
| - record_timestamp | ||
| - point_feature | ||
| filter: {} | ||
| allow_aggregations: true | ||
| comment: "" | ||
| - role: readonly | ||
| permission: | ||
| columns: | ||
| - incident_numbers | ||
| - location_ids | ||
| - record_tables | ||
| - record_tables_str | ||
| - responding_agencies | ||
| - responding_agencies_str | ||
| - id | ||
| - record_count | ||
| - in_austin_full_purpose | ||
| - address | ||
| - record_timestamp | ||
| - point_feature | ||
| filter: {} | ||
| allow_aggregations: true | ||
| comment: "" | ||
| - role: vz-admin | ||
| permission: | ||
| columns: | ||
| - incident_numbers | ||
| - location_ids | ||
| - record_tables | ||
| - record_tables_str | ||
| - responding_agencies | ||
| - responding_agencies_str | ||
| - id | ||
| - record_count | ||
| - in_austin_full_purpose | ||
| - address | ||
| - record_timestamp | ||
| - point_feature | ||
| filter: {} | ||
| allow_aggregations: true | ||
| comment: "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
database/migrations/default/1783347751354_vz_incidents_view/down.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| DROP MATERIALIZED VIEW IF EXISTS vz_incidents_view; | ||
|
|
||
| DROP VIEW IF EXISTS public.vz_incident_records_view; | ||
|
|
||
| CREATE OR REPLACE VIEW public.vz_incident_records_view AS | ||
| SELECT | ||
|
|
||
| 'crashes'::text AS record_table_name, | ||
| case when | ||
| -- 'AUSTIN POLICE DEPARTMENT' -> 'apd' | ||
| c.investigat_agency_id = 74 | ||
| then 'apd' | ||
| else agency.label | ||
| end AS record_responding_agency, | ||
| c.id AS record_id, | ||
| c.case_id AS record_incident_number, | ||
| c.crash_timestamp AS record_timestamp, | ||
| c.address_display AS record_address, | ||
| c.position AS geom, | ||
| c.vz_incident_id AS vz_incident_id, | ||
| c.vz_incident_match_status AS vz_incident_match_status | ||
| FROM crashes c | ||
| LEFT JOIN lookups.agency agency on agency.id = c.investigat_agency_id | ||
| WHERE c.is_deleted is false | ||
| UNION ALL | ||
| SELECT | ||
| 'cad_incidents'::text AS record_table_name, | ||
| ci.agency_type_short AS record_responding_agency, | ||
| ci.id AS record_id, | ||
| ci.master_incident_number AS record_incident_number, | ||
| ci.response_date AS record_timestamp, | ||
| ci.address AS record_address, | ||
| ci.geom AS geom, | ||
| ci.vz_incident_id AS vz_incident_id, | ||
| ci.vz_incident_match_status AS vz_incident_match_status | ||
| FROM cad_incidents ci | ||
| UNION ALL | ||
| SELECT | ||
| 'ems__incidents'::text AS record_table_name, | ||
| 'ems' AS record_responding_agency, | ||
| ems.id AS record_id, | ||
| ems.incident_number AS record_incident_number, | ||
| ems.incident_received_datetime AS record_timestamp, | ||
| ems.incident_location_address AS record_address, | ||
| ems.geometry AS geom, | ||
| ems.vz_incident_id AS vz_incident_id, | ||
| ems.vz_incident_match_status AS vz_incident_match_status | ||
| FROM ems__incidents ems | ||
| WHERE ems.is_deleted is FALSE | ||
| UNION ALL | ||
| SELECT | ||
| 'afd__incidents'::text AS record_table_name, | ||
| 'afd' AS record_responding_agency, | ||
| afd.id AS record_id, | ||
| afd.incident_number::text AS record_incident_number, | ||
| afd.call_datetime AS record_timestamp, | ||
| afd.address AS record_address, | ||
| afd.geometry AS geom, | ||
| afd.vz_incident_id AS vz_incident_id, | ||
| afd.vz_incident_match_status AS vz_incident_match_status | ||
| FROM afd__incidents afd; | ||
|
|
||
| COMMENT ON VIEW public.vz_incident_records_view IS 'Unified view of crash-related records (crashes, cad_incidents, ems__incidents, afd__incidents) exposed under a common schema for cross-type queries and geo-temporal matching.'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that we should name this
vz_incidents_list_viewto be consistent with our other record views. i'm going to fix this in later because I already have a branch going.