Skip to content

Scanner: Address mode + street-type/house-number checks (Android first) - #6

Merged
alisulmanpro merged 1 commit into
mainfrom
scanner-address-mode
Oct 27, 2026
Merged

alisulmanpro merged 1 commit into
mainfrom
scanner-address-mode

Conversation

@alisulmanpro

Copy link
Copy Markdown
Owner

Why

Client feedback (via Noman): with no Eircode on the label, the app ends up on the wrong street — "26 Shanecastle Grove" becomes "26 Shanecastle Park". Dr / Cl / Cre / Grove change the whole location. On a page with several addresses the rider must be able to pick the one to add.

Root cause: the scanner only ever read Eircodes. Typed or pasted addresses went straight to Google Autocomplete, which picks the most likely street when the type is missing or unknown ("Cre"), and Add saved the map's match even when it was on a different street.

What changed

1. Scanner: Eircode | Address switch

  • Address mode: take one photo → every line of text gets a box → tap the lines of the address → Use address.
  • Works for a page of addresses (tap one line) and for a 2-3 line label (tap each line; joined in reading order).
  • If the chosen lines contain exactly one Eircode, it is used (surest point).
  • The Eircode mode is unchanged; after 6 s without an Eircode it now offers "No Eircode? Scan the address".
  • The chosen mode is remembered while the app runs.

2. Address text (lib/scan/address.ts)

  • Spacing fixes: 26shanecastle → 26 shanecastle, dublin22 → dublin 22 (Eircodes, 26A, 1st untouched).
  • Clear OCR slips: C1 / CI → Cl, 5t → St.
  • One table of Irish street types and short forms (Rd, St, Ave, Dr, Cl, Cres/Cre, Gr/Grv, Pk, Ct, Tce, Pl, Sq, Ln, Gdns, Hts, Grn, Lwn, Vw, Wk, Pde, Est … plus Bóthar, Sráid, Páirc …).
  • St / Dr right after the house number = Saint / Doctor ("26 St Mary's Rd"), otherwise Street / Drive ("Main St").
  • House number parsing skips Apt/Unit numbers, Dublin districts and Eircodes.

3. Add stops

  • The field keeps exactly what the rider typed/scanned; short forms are written out only in the text sent to the map search.
  • Suggestions on a different street type or house number go to the end, in amber: "Park, not Grove" / "No. 22, not 26". They can still be picked.
  • Add no longer saves a map match on a different street type or number: it shows "The map found a different address" with the address, and the rider picks a suggestion, drops a pin, or adds it as typed.

Native / release

No new native package: vision-camera photo output, ocr-plus PhotoRecognizer and expo-image-manipulator are already in the build. This is JS-only and can go out over the air once the build that includes expo-updates is in the stores.

Checks

  • npm test: 51 pass (15 new, incl. the client's four Shanecastle streets).
  • npx tsc --noEmit: clean. npx expo lint: clean.
  • Not yet tested on a phone. Test sheet: rider-app/docs/scanner-test.md (page test + one-by-one; handwritten, printed, on a screen). Android first; iPhone later.

Not in this PR

  • iOS speed/accuracy (Apple Vision vs ML Kit) — after the Android results.
  • "Add anyway" still lets the server geocode the raw text; the server-side check should match this one (follow-up).
  • Import sheet addresses do not get the street-type check yet (follow-up).

Generated by Claude Code

…ions

- Scanner has an Eircode | Address switch. Address mode takes one photo, boxes every line of text, and the rider
  taps the lines of the address (one line from a page of addresses, or 2-3 lines of a label). An Eircode among the
  chosen lines goes the Eircode way. No new native package: vision-camera photo output, ocr-plus PhotoRecognizer
  and expo-image-manipulator are already in the build.
- lib/scan/address.ts: spacing fixes ("26shanecastle"), OCR slips in short forms ("C1" -> "Cl"), Irish street
  types and short forms in one table, St/Dr as Saint/Doctor after the house number, house number parsing.
- Add stops: short forms are written out for the map search only (the field keeps the rider's text); suggestions
  on a different street type or house number go last and say so ("Park, not Grove"); Add no longer saves a map
  match on a different street type or number without asking.
- Tests: tests/address.test.ts, tests/photoLines.test.ts (the client's four Shanecastle streets included).
- docs/scanner-test.md: the phone test sheet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FsWYamWsagMdQ7biMYdzSN
@alisulmanpro alisulmanpro self-assigned this Oct 27, 2026
@alisulmanpro
alisulmanpro merged commit 2e77305 into main Oct 27, 2026
3 checks 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.

2 participants