Skip to content

Food catalog and nutrition label scanner - #4

Merged
YarinQuapi merged 2 commits into
masterfrom
food-catalog-and-label-scanner
Nov 10, 2026
Merged

YarinQuapi merged 2 commits into
masterfrom
food-catalog-and-label-scanner

Conversation

@YarinQuapi

Copy link
Copy Markdown
Owner

Summary

  • Food catalog (API + web + mobile): new GET /api/foods/catalog plus a Foods tab on web and mobile. Switch between all published foods and your own, search by name/barcode, filter by verified/unverified, page through results. Admins (or anyone with foods:verify) can verify published foods there using the existing POST /api/foods/:id/verify.
  • Nutrition label scanner (mobile): on the new-food form, scan a nutrition table with the camera instead of typing it. On-device Tesseract (Hebrew + English), auto-rotation, and a parser that reads the per-100 g/ml column. Values that don't add up (calories vs macros, sugars > carbs) are left empty instead of guessed. Bilingual labels are read in one language (app language wins ties). A Show recognized text button on the form helps debug bad scans.
  • push-iphone.sh: updates the app in place (no uninstall, so developer trust and data are kept), retries the install, and no longer launches the app.

Deploying

  • API: no schema change and no migration. The new route is read-only and uses the existing foods:read permission.
  • Web: static build, nothing special.
  • Mobile: needs a new iOS build. It adds ~6 MB of Tesseract language data and a vendored copy of flutter_tesseract_ocr under apps/mobile/packages/ (its iOS code is rewritten: the original symlinked into the read-only app bundle and crashed on device). ios/Podfile and Podfile.lock are now committed because the plugin needs CocoaPods.

Test plan

  • API: typecheck + 45 tests (new tests cover the catalog filter)
  • Web: typecheck + build
  • Mobile: flutter analyze (no errors/warnings), 16 tests (parser tests include real OCR output from a bilingual label photo), iOS device build
  • Catalog on a live server: Published / My foods, search, filters, load more
  • Admin: Verify a published food on web and mobile; confirm a second food with the same barcode becomes unverified
  • Non-admin: no Verify button
  • Hebrew/RTL layout of the Foods tab (web and mobile); six tabs fit on a narrow iPhone
  • Label scanner on real packs, English, Hebrew and bilingual, on device
  • Known open issue: a liquid (per 100 ml) label failed to scan; not fixed here, need the photo

Notes

  • The Foods tab is a sixth tab, which is over Apple's usual five for an iPhone tab bar. Easy to move into Settings if preferred.
  • Mobile has no edit screen for existing foods (web does); My foods on mobile can add new foods.
  • There is no un-verify action.
  • The scanner is iOS-only and cannot run in the iOS Simulator (the Tesseract library has no arm64-simulator slice).

🤖 Generated with Claude Code

YarinQuapi and others added 2 commits November 10, 2026 15:31
GET /api/foods/catalog lists every published food, or only the viewer's
own foods, with verification-status and name/barcode filters and offset
paging. The web app gets a Foods tab with the same filters; admins (and
anyone with foods:verify) can verify published foods there, reusing the
existing verify endpoint.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Label scanner: on the new-food form, scan a nutrition table with the
camera. Tesseract (heb+eng) runs on device; the photo is auto-rotated,
and a parser extracts the per-100 g/ml values from English and Hebrew
tables, using the serving/100 ratio to pick the right column and repair
dropped decimals, and dropping values that do not add up. Bilingual
labels are read in one language (the app language wins ties).

The flutter_tesseract_ocr plugin is vendored with a rewritten iOS side
that drives libtesseract directly: the original symlinked into the
read-only app bundle and crashed on device, and ignored page-mode
settings.

Food catalog: new Foods tab listing published foods or your own, with
search, a verification filter, a detail sheet and admin Verify.

push-iphone.sh now updates the app in place (no uninstall, so the
developer trust and app data are kept), retries the install, and no
longer launches the app.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@YarinQuapi
YarinQuapi merged commit be33f9a into master Nov 10, 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.

1 participant