Match a numbered route published without its class - #169
Merged
Conversation
The counties disagree about whether a route street name carries the class that qualifies it. Most of the region publishes "US 42" and "SR 104", but 4,328 points across Delaware (2,646), Union (1,502), Fayette (128), Franklin (51) and Logan (1) name the route by number alone. Delaware holds the point for "844 US 42 N" under the street name "42", so a query normalized to the regional form finds nothing. The index now carries the route number as a separate key beside the full name, and a route_number tier matches on it after the full name has found nothing. Deliberately a separate key rather than a normalization of the name. Folding the class away would merge roads that are genuinely different: Logan publishes both CR 32 and TR 32, and fifteen other county-and-number pairs are likewise two roads sharing a number. Running last means the looser key is consulted only where the exact name failed, so those pairs still resolve by name, and where the tier does find several roads the existing distance guard reports the ambiguity rather than averaging across them. CONST_GEOCODE_INDEX_VERSION goes to 2 so that existing indexes rebuild. Against the 359 DODD, CMS and ODRC facility addresses used to validate morpc/morpc-addresspoints-standardize#7, this takes matching from 320/359 (89.1%) to 324/359 (90.3%). The exact, components and number_name tiers are unchanged at 277, 35 and 8, so nothing previously matched was displaced. Refs morpc/morpc-addresspoints-standardize#7
This was referenced Aug 4, 2026
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.
The counties disagree about whether a numbered route street name carries the class that qualifies it. Most of the region publishes
US 42andSR 104, but 4,328 points name the route by number alone — Delaware 2,646, Union 1,502, Fayette 128, Franklin 51, Logan 1. Delaware holds the point for844 US 42 Nunder the street name42, so a query normalized to the regional form finds nothing.Found while running the geocoder benchmark that morpc/morpc-addresspoints-standardize#7 uses as its acceptance test.
Approach
The index carries the route number as a separate key beside the full name, and a new
route_numbertier matches on it after the full name has found nothing.Deliberately a separate key rather than a normalization of the street name. Folding the class away would merge roads that are genuinely different — Logan publishes both
CR 32andTR 32, and 15 other county-and-number pairs are likewise two roads sharing a number:Running the tier last means the looser key is consulted only where the exact name failed, so those pairs still resolve by name. Where the tier itself finds several roads, the existing distance guard reports the ambiguity rather than averaging across them — covered by a test.
CONST_GEOCODE_INDEX_VERSIONgoes to 2 so existing indexes rebuild.Effect
Against the 359 DODD, CMS and ODRC facility addresses used to validate morpc/morpc-addresspoints-standardize#7, rebuilding the index from the real 1.25 M-row reference data:
Four addresses reached the new tier and all four matched correctly:
844 US 42 N(Delaware, ×3) and14442 STATE ROUTE 33 WEST(Logan).No regressions — the
exact,componentsandnumber_nametiers are unchanged at 277, 35 and 8, so nothing previously matched was displaced.Tests
Four added, covering the helper, a match through the new tier, the full name winning ahead of it, and ambiguity being reported rather than averaged. The fixture gains the
routenumcolumn and two route rows.All 39 tests in
test_geocode.pypass. Note that 4 tests intest_utils.pyfail on this branch — they fail identically onmainwith these changes stashed, are datetime parsing rather than geocoding, and are untouched here.Related
844 US 42 Nwas the one case there that turned out to be reference-side rather than parser-side.b5df818.🤖 Generated with Claude Code