Photo Picks — Technical Spec
Technical Spec
Ver 1
Updated 2026-10-08
- Requested by Dave Cantin in #sa-it-discussion, thread 1791477865.549289, 2026-10-08.
- Code:
app/photo_picks.py, with templates pp_file.html and pp_job.html (screen key pp_file, a handheld screen). The router is included in im2.py after ps. - Queue:
/opt/im2/pp_queue/{job}/ holds meta.json, combined.pdf (built by ps._build_pdf), result.json (written by the worker) and applied.json. - Worker: Viktor's
skills/im2_app/scripts/pp_worker.py, run by script cron /logistics/pp-reader every 5 minutes. - It renders each page at 170 dpi and reads it with Gemini through
analyze_video, using a one-frame mp4 per page. - It merges the pages into
{order_no, picker_name, lines[{sku, qty, unclear}]}. - It then runs
photo_picks.py apply <job> on the droplet. The CLI imports im2 first to avoid the circular import. apply_job works as follows:- Resolves the RO with
find_order. - Calls
get_or_open_pick(order, 'PHOTO_PICK', picker) and sets ro_pick.operator to the picker name. - Uses
ensure_pick_class. - Order lines go through
save_order_line_qty. SKUs that aren't on the RO go through save_addition_qty. - Flags: unclear, not on RO, over qty on hand, replaced qty, picker not readable, RO not found.
- Never posts.
- Table
ro_pick_photo(pick_id, job_id, qb_attached jsonb) in the RO DB is created by apply_job. - Pick Review shows 📷 links via
_photo_map. The screen label is "Photo Pick". - Posting:
ro_pick.post_pick_to_qb calls photo_picks.attach_to_qb after a non-truck post. It uploads the PDF as a QB Attachable to the Invoice and the CreditMemo through /upload. - This is best effort. Failures go into
result.photo_attach, and the post is never undone. - The print report footer now begins with "RO N" so that every page carries the RO #.