fix: attribute shoreline addresses, and name the rows that cannot be placed - #11
Merged
Conversation
…placed Migration 23 attributed 985,631 of 985,634 blank regions in production and then stopped on three it could not place. TIGER state polygons stop at the waterline, so a lakefront or island address is legitimately outside every one of them by a few metres while being unambiguously in that state. A second pass attributes those from the nearest boundary within 500m -- comfortably wider than the waterline margin and far narrower than the distance to another state, so it cannot move an address across a border. Verified: a point 220m off Ohio's northern edge attributes to OH, one in the mid-Atlantic does not. Anything still unplaced is a coordinate error rather than a missing state, and the migration now names those rows -- id, county and coordinates -- in the error itself rather than only the log. That error surfaces on /health, so whoever decides what to do with them can see what they are without shell access. Three rows out of 5.8M should not be diagnosed by asking someone to go and find them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Migration 23 got 985,631 of 985,634 in production, then stopped:
Why three rows fail a containment test
TIGER state polygons stop at the waterline. A lakefront address, an island, a
pier — all sit outside every state polygon by a few metres while being
unambiguously in that state. Ohio has a Lake Erie shoreline, so this is the
expected shape of the remainder.
A second pass attributes from the nearest boundary within 500m. That is
comfortably wider than the waterline margin and far narrower than the distance
to another state, so it cannot silently move an address across a border.
Verified:
Rows that still cannot be placed now identify themselves
Anything left is a coordinate error, not a missing state. The migration names
those rows in the error, not just the log:
That error is surfaced on
/health, so whoever has to decide what to do withthem can see what they are without shell or database access. Diagnosing three
rows out of 5.8M should not require going to look for them.
If production's three turn out to be shoreline cases, this lands and migration
23 completes. If they are genuinely bad coordinates,
/healthwill say exactlywhere they are and we can delete or correct them deliberately.
🤖 Generated with Claude Code