[Demo] Support cross-streets as an alternative location input#973
Draft
saadabdali wants to merge 3 commits into
Draft
[Demo] Support cross-streets as an alternative location input#973saadabdali wants to merge 3 commits into
saadabdali wants to merge 3 commits into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Consider this a tech exploration / tech demo for a feature supporting cross-streets as an alternative input for incident location.
Screen.Recording.2026-06-10.at.20.04.02_small.mp4
User-visible changes
16th & Mission). The autocomplete results show little icons to indicate whether a given result is an address or an intersection.Address line 2field. If you chose an intersection, you'll instead see two fields forStreet 1andStreet 2.Schema changes
It felt like the best way to store this was to create some new fields and also store an explicit flag indicating which type of location this is.
Added these fields to
Incident:locationTypeenum (ADDRESS|INTERSECTION, defaultADDRESS). This is the discriminator (tells you whether this Incident uses the existing address fields, or the new intersection fields.)street1street2intersectionId(we match to an intersection from the the DataSF CNN)Didn't remove or modify any existing fields.
Had to update the way we validate addresses.
To read older records (which won't have a locationType) can assign a default value on read, or use migration to add locationType to older entries.
Dependencies
natural(^8.1.1) — an NLP toolkitElbow grease to make the voice stuff work
It took a lot of iteration and messing around to get the voice stuff to be even moderately reliable. I remain optimistic. On the one hand, we had to make a lot of spot-fixes to solve individual error cases. On the other hand, SF's street network is of bounded size, and sometimes elbow grease is what you need to make something great.
(
build-intersection-data.js):A matching pipeline to try and reliably turn transcribed voice into a known intersection:
A benchmarking harness (
bench-intersections.js,bench-datasf-intersections.js): a curated ~30-intersection test set across categories (arterials, Spanish names, numbered streets, multi-word) used to compare AWS's geocoder vs. our local index and to regression-check tuning changes.