VisionReceiptResult vision.receipt-result@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
vision
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/vision/receipt-result.v1.json

vision.receipt-result@1: POST /api/v1/receipt answers the store, the line items and the total the local OCR reader read (or the routed fallback read), with `raw_text` when the local pass produced it. OpenVibe.Food decides what enters a pantry; Vision returns the reading.

Fields

FieldTypeRequiredDescriptionConstraints
answerobjectyes
  • no other fields
answer.storestring | nullyes
  • maxLength 150
answer.itemsarray of objectyes
  • maxItems 100
  • items: no other fields
answer.items[].namestringyes
  • maxLength 200
answer.items[].qtynumberyes
  • minimum 0
answer.items[].pricenumberyes
  • minimum 0
answer.totalnumber | nullyes
  • minimum 0
answer.raw_textstring
  • maxLength 20000
answer.receiptobjectyes
  • no other fields
answer.receipt.engineenumyes
  • one of "local", "routed", "local+routed", "local+routed description"
answer.receipt.modelstring | nullyes
answer.receipt.cost_usdnumberyes
  • minimum 0
answer.receipt.msintegeryes
  • minimum 0
answer.receipt.confidencenumber | nullyes
answer.receipt.retentionstringyes

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: one
{
  "answer": {
    "store": "Corner Market",
    "items": [
      {
        "name": "Milk",
        "qty": 2,
        "price": 3.5
      }
    ],
    "total": 7,
    "receipt": {
      "engine": "local",
      "model": "Tesseract 5",
      "cost_usd": 0,
      "ms": 120,
      "confidence": 0.9,
      "retention": "not stored"
    }
  }
}
Rejected: one
{
  "answer": {
    "store": "Corner Market",
    "items": [
      {
        "name": "Milk",
        "qty": "two",
        "price": 3.5
      }
    ],
    "total": 7,
    "receipt": {
      "engine": "local",
      "model": "Tesseract 5",
      "cost_usd": 0,
      "ms": 120,
      "confidence": 0.9,
      "retention": "not stored"
    }
  }
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('vision.receipt-result@1', value);   // { valid, errors: [{ path, message }] }