Skip to content

fix: attribute shoreline addresses, and name the rows that cannot be placed - #11

Merged
keonik merged 1 commit into
mainfrom
fix/attribute-stragglers
Sep 14, 2026
Merged

fix: attribute shoreline addresses, and name the rows that cannot be placed#11
keonik merged 1 commit into
mainfrom
fix/attribute-stragglers

Conversation

@keonik

@keonik keonik commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Migration 23 got 985,631 of 985,634 in production, then stopped:

3 row(s) still have no region after attribution: their coordinates fall outside
every US state boundary

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:

on-land    (-83.0, 40.0)      -> OH   well inside
shoreline  (-82.7, 41.7020)   -> OH   ~220m offshore, still Ohio
at-sea     (-40.0, 35.0)      -> ''   mid-Atlantic, a real error

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:

1 row(s) still have no region: ... Offending rows:
  id=3 county=Unknown at (-40.0000, 35.0000)

That error is surfaced on /health, so whoever has to decide what to do with
them 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, /health will say exactly
where they are and we can delete or correct them deliberately.

🤖 Generated with Claude Code

…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>
@keonik
keonik merged commit 57e332b into main Sep 14, 2026
3 checks passed
@keonik
keonik deleted the fix/attribute-stragglers branch September 14, 2026 04:15
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