Seed-packet scan UI (camera/upload → proposal → confirm) #102

Closed
opened 2026-07-22 04:37:13 +00:00 by steve · 0 comments
Owner

Part of #96. Carries the #81 scan UI (backend shipped in #94).

Problem. The seed-packet capture backend is live — POST /seed-lots/scan (multipart image → a PacketProposal with ranked catalog candidates) and POST /seed-lots/from-packet (confirm → plant + lot) — but there is no UI, so the feature Steve specifically asked for ("take a picture of a seed packet and it auto-creates") is unreachable. /capabilities already reports vision on/off.

Do (mobile-first).

  • A capture entry point where vision is enabled (capabilities.vision): from the Plants catalog ("Scan a packet") and/or Plants mode. Use a file input with accept="image/*" capture="environment" so a phone opens the camera directly; also allow choosing an existing photo (HEIC included — imagenorm handles it server-side).
  • Proposal review screen: show the extracted fields (species, variety, category, vendor, SKU, days-to-maturity, spacing, seed count) in an editable form — the model can misread, so nothing is committed blind. Show the ranked candidate existing plants (candidates) with the match reason; let the user pick "this is " or "create new variety" (prefilled from suggestedName/suggestedCategory). This is the whole point of the backend's never-auto-create design — the human confirms.
  • ConfirmPOST /seed-lots/from-packet with plantId XOR newPlant, plus the lot fields. On success, surface the created plant + lot.
  • Handle the backend's status codes: 503 VISION_DISABLED (shouldn't happen if gated on capabilities, but message it), 413 too-large, 400 unreadable, and the loading state during the (potentially many-second) vision call.

Acceptance.

  • On a phone with a vision model configured, "scan a packet" opens the camera, and a photo produces an editable proposal.
  • Confirming creates the plant (new or matched existing) + the seed lot, matching what CreateFromPacket does.
  • With no vision model, the entry point isn't offered.

Frontend only; no backend change (EXIF is its own issue).

Part of #96. Carries the **#81 scan UI** (backend shipped in #94). **Problem.** The seed-packet capture backend is live — `POST /seed-lots/scan` (multipart image → a `PacketProposal` with ranked catalog candidates) and `POST /seed-lots/from-packet` (confirm → plant + lot) — but there is no UI, so the feature Steve specifically asked for ("take a picture of a seed packet and it auto-creates") is unreachable. `/capabilities` already reports `vision` on/off. **Do (mobile-first).** - A **capture entry point** where vision is enabled (`capabilities.vision`): from the Plants catalog ("Scan a packet") and/or Plants mode. Use a file input with `accept="image/*" capture="environment"` so a phone opens the camera directly; also allow choosing an existing photo (HEIC included — imagenorm handles it server-side). - **Proposal review screen**: show the extracted fields (species, variety, category, vendor, SKU, days-to-maturity, spacing, seed count) in an **editable** form — the model can misread, so nothing is committed blind. Show the ranked **candidate existing plants** (`candidates`) with the match reason; let the user pick "this is <existing plant>" or "create new variety" (prefilled from `suggestedName`/`suggestedCategory`). This is the whole point of the backend's never-auto-create design — the human confirms. - **Confirm** → `POST /seed-lots/from-packet` with `plantId` XOR `newPlant`, plus the lot fields. On success, surface the created plant + lot. - Handle the backend's status codes: 503 `VISION_DISABLED` (shouldn't happen if gated on capabilities, but message it), 413 too-large, 400 unreadable, and the loading state during the (potentially many-second) vision call. **Acceptance.** - On a phone with a vision model configured, "scan a packet" opens the camera, and a photo produces an editable proposal. - Confirming creates the plant (new or matched existing) + the seed lot, matching what `CreateFromPacket` does. - With no vision model, the entry point isn't offered. Frontend only; no backend change (EXIF is its own issue).
steve added the frontendplants labels 2026-07-22 04:37:13 +00:00
steve closed this issue 2026-07-22 17:07:26 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: steve/pansy#102