Skip to content

Read the OH-104 and C.R. 32 route forms - #171

Merged
jinskeep-morpc merged 1 commit into
mainfrom
fix/route-form-variants
Aug 4, 2026
Merged

Read the OH-104 and C.R. 32 route forms#171
jinskeep-morpc merged 1 commit into
mainfrom
fix/route-form-variants

Conversation

@jinskeep-morpc

Copy link
Copy Markdown
Collaborator

The two remaining defects in #168, which this closes. The postal-tail defect was fixed in #170.

ODRC writes the highway shield form OH-104 and the period-separated C.R. 32. The reference data publishes 18,949 SR <n> and 4,960 CR <n>, and neither source form, so both missed:

>>> morpc.parse_address('15802 OH-104')['streetname']      # before / after
'OH 104'  ->  'SR 104'
>>> morpc.parse_address('284 C.R. 32 South')['streetname']
'C R 32'  ->  'CR 32'

"OH": "SR" and "C R": "CR" join CONST_ROUTE_PREFIX_ABBREV — the second is what C.R. becomes once normalize_street_name has turned the periods into spaces.

Why two-character prefixes are safe here

A route prefix is read only at the start of a street name and only when a number follows it, so the short keys cannot capture ordinary names. Covered by tests:

Input streetname
15802 OH-104 SR 104
15802 OH 104 SR 104
284 C.R. 32 South CR 32, suffix S
123 Ohio Ave OHIO, type AVE
100 C Street C, type ST

Only these two forms are added. I checked all 359 facility addresses for other spellings — there is no S.R. or T.R. in the data, so mapping them would be speculation.

Index version

CONST_GEOCODE_INDEX_VERSION goes to 3. The prefix map is applied to the reference data as well as the query, so the derivation has changed. This reference happens to contain no name either mapping affects — zero OH <n> and zero C R <n> — so the rebuild is a no-op for the current data, but leaving correctness to depend on the data rather than the code is exactly the drift this module exists to prevent.

Effect

Baseline #169 #170 This
Overall 320 (89.1%) 324 (90.3%) 330 (91.9%) 334 (93.0%)
ODRC 68.5% 74.1% 85.2% 92.6%

Four new matches: 284 C.R. 32 South ×3 and 15802 OH-104. The number_name and route_number tiers are unchanged at 8 and 4, so nothing previously matched was displaced.

All 42 tests in test_geocode.py pass. The test_utils.py failures noted in #169 and #170 remain, unrelated and pre-existing on main.

What is left in the benchmark

25 unmatched of 359. Two are the geocoder correctly declining an ambiguous match, one carries no house number, and the rest are genuine coverage gaps or the two pre-existing parse quirks recorded in #170 — the Route #38 unit-designator misread and the multi-number 4410,4412,… leak. None are route forms.

🤖 Generated with Claude Code

The two remaining defects in #168. ODRC writes the highway shield form
"OH-104" and the period-separated "C.R. 32"; the reference data publishes
18,949 "SR <n>" and 4,960 "CR <n>" and neither source form, so both missed.

"OH" and "C R" join CONST_ROUTE_PREFIX_ABBREV -- the second is what "C.R."
becomes once normalize_street_name has turned the periods into spaces. Both are
short enough to look risky and are not: a route prefix is read only at the start
of a street name and only when a number follows it, so the "OH" of a postal tail
and a street named "C Street" are left alone. Both are covered by tests.

Only these two forms are added. The facility sources carry no "S.R." or "T.R."
spelling, so mapping them would be speculation.

CONST_GEOCODE_INDEX_VERSION goes to 3. The prefix map is applied to the
reference data as well as the query, so the derivation has changed even though
this reference contains no name either mapping affects -- leaving that to depend
on the data rather than on the code is the drift this module exists to prevent.

Against the 359 DODD, CMS and ODRC facility addresses used to validate
morpc/morpc-addresspoints-standardize#7, matching goes from 330/359 (91.9%) to
334/359 (93.0%), and ODRC from 85.2% to 92.6%. The number_name and route_number
tiers are unchanged, so nothing previously matched was displaced.

Closes #168
@jinskeep-morpc
jinskeep-morpc merged commit 1854905 into main Aug 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant