Skip to content

Add bad-scan reports for the nutrition label scanner - #5

Merged
YarinQuapi merged 2 commits into
masterfrom
scanner-feedback-loop
Nov 11, 2026
Merged

YarinQuapi merged 2 commits into
masterfrom
scanner-feedback-loop

Conversation

@YarinQuapi

Copy link
Copy Markdown
Owner

What changed

  • Mobile: a "Report a bad scan" button on the food form (after a scan) and on the "nothing found" screen. It asks for an optional note, then uploads a downsized JPEG (max 1600 px), the recognized text and the parsed values.
  • API: new `ScanReport` table (migration `20261110120000_scan_reports`) and `/api/scan-reports`:
    • `POST /` any signed-in user (own 7 MB JSON limit, photo capped at 4 MB)
    • `GET /`, `GET /:id/photo`, `POST /:id/resolve` admin only
  • Export script: `npm run export-scan-reports -- ` writes each open report as `.jpg`, `.txt` and `.json` so real failures can become parser tests.
  • Docs: `docs/ideas.md` backlog of improvement ideas.

Why

Liquid and some real labels still misread, and the parser can't be tuned without real examples. Reports build a test set from actual use.

For reviewers

  • Deploy needs `prisma migrate deploy` on the server before the endpoint works.
  • Photos are stored in the database (LONGBLOB), a few hundred KB each.
  • The scan-reports router is mounted before the global 1 MB JSON parser on purpose.
  • No admin UI yet; reports are read via the export script or the API.

Testing

  • API typecheck and 45 tests pass. Endpoints exercised against a local MySQL: create (201), non-admin list (403), anonymous (401), oversize photo (400), admin list/photo/resolve, export script. Test accounts removed afterwards.
  • Mobile: `flutter analyze` shows only existing infos; 17 tests pass.
  • Not tested: upload from a real iPhone, Hebrew/RTL layout of the dialog.

🤖 Generated with Claude Code

YarinQuapi and others added 2 commits November 10, 2026 17:03
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Users can report a wrong nutrition-label scan from the food form or the
scan-failed screen. The app sends a downsized JPEG, the recognized text and
the parsed values to POST /api/scan-reports. Admins can list, view photos and
resolve reports, and npm run export-scan-reports writes them to a folder so
real failures can become parser tests.

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