workers / wine_inventory / src / pince_shelf / vision / DB_compare.py¶
Path: workers/wine_inventory/src/pince_shelf/vision/DB_compare.py
Lane: workers
Executable: yes
Purpose¶
Compare vision counts against DB stock and reconcile discrepancy proposals.
The script reads aggregated vision detections from
<cfg.paths["det_out"]>/results.csv, fetches current stock data from
GET {cfg.api_base}/bins/summary, compares counts by bin, and keeps only
mismatches.
Behavior: - every current diff is sent to the backend - the backend creates new pending proposals or refreshes matching pending rows - pending proposals missing from the current diff batch are marked obsolete - even an empty diff batch is POSTed so stale pending proposals can be retired
Entry points¶
__main__guard detected
Key symbols¶
Classes¶
- (none detected)
Functions¶
_build_ha_snapshot_path(st_bin)_build_proposals_payload(diffs)_compare(vision_counts, db_rows)_create_or_refresh_proposals(api_base, diffs, debug_payload_path, timeout_s)_fetch_bins_summary(api_base, timeout_s)_load_vision_counts(csv_path)_parse_batch_response(data)_write_output(diffs, out_path_csv, out_path_json)main()run(cfg)
Configuration & environment¶
- (no env vars detected by regex)
Dependencies (imports)¶
__future__collectionscsvjsonloggingpathlibpince_shelf.config.settingsrequeststyping
Operational notes (fill in)¶
- Headless/interactive:
- Systemd unit (if any):
- Schedules/triggers:
- Debug artifacts:
- Failure modes: