Skip to the content

Human review

What to save on its own, what to show a person, and what to show them: using review.required and the evidence.

On this page

Every result answers one question for your software: should a person check this before it is used? This guide is about using that answer: what to save on its own, what to put in front of a person, and what to show them.

The answer, and its reasons#

review.required is true when a person should look first, and review.reasons says why, one entry per reason: the field it concerns (or null for the document as a whole), a code, and a message in plain words. Every code is listed under Review.

A reason can come from a value's own confidence being under its field's bar, from a check it broke, from the document's own sums not adding up, or from a second reader that read it differently. Whatever the reason, the value itself is returned exactly as read: checks and the second reader never change it quietly.

Save what passes, queue what is flagged#

The simplest integration takes the answer as it is:

// After POST /v1/extractions (or an extraction.completed webhook):
if (!extraction.review.required) {
  await saveReceipt(extraction.data);          // nothing is in doubt
} else {
  await reviewQueue.add({
    id: extraction.id,
    data: extraction.data,                     // what was read, unchanged
    reasons: extraction.review.reasons,        // [{ field, code, message }]
    evidence: extraction.fields,               // boxes, printed text, alternatives
  });
}

A value can be well read and still wrong for you

Your own business rules still apply after ReceViz's. Put the ones a document type can express in it (a maximum amount, a date not in the future or not too old, one field compared with another), so they become review reasons of their own. See Validation and Rules.

What to show the person#

A reviewer decides fastest with the page and the doubtful values side by side. For each field, the result has:

  • page and bounding_box: where it was printed, to highlight on the page;
  • raw_text: the words exactly as printed, to compare with the value;
  • confidence and checks: how sure ReceViz is, and what backed it;
  • alternatives: up to three other readings, when two were close, for the person to choose from.
javascript
// bounding_box is a fraction of the page, from its top-left corner.
// Laid over the page image, it is a percentage of the image's box:
function highlightStyle(box) {
  return {
    position: "absolute",
    left: `${box.x * 100}%`,
    top: `${box.y * 100}%`,
    width: `${box.width * 100}%`,
    height: `${box.height * 100}%`,
  };
}

How much of this comes back depends on your organisation's evidence setting: with positions only there is no raw_text, and with values alone there is neither. See Evidence.

When the second reader disagrees#

In Verified mode, a disagreement always goes to a person. The field's verification says which reading was kept and why the second reader read it differently, and with full evidence the other reading is there to choose instead:

json
{
  "status": "disagreed",
  "reason": "AMOUNT DUE 160.00 is printed below the total.",
  "reasons": [
    "always",
    "ambiguous"
  ],
  "kept": "rules",
  "alternative": {
    "value": 160,
    "source": "verifier"
  }
}

What can happen to a field lists every outcome.

Deciding how much reaches a person#

Three settings move the balance between reviewing and saving:

  • Each field's confidence bar (confidence_threshold): 0.7 unless the document type says otherwise, 0.8 for a receipt's total in the templates. Raise it for a field that is costly to get wrong, lower it for one a person glances at anyway. It changes what is reviewed, never the value.
  • The mode: Standard checks formats, rules and the document's sums; Fast skips them, so fewer results are flagged and more mistakes get through; Verified adds the second reader for the doubtful fields.
  • Your rules: every rule in the document type that fails becomes a reason of its own.

Keep what the reviewer needs#

A result is held only as long as your data policy says: 30 days, 24 hours, or not at all. A review queue that may wait longer than that should store what the reviewer needs when the result arrives, rather than fetching it again later. A result that is no longer held comes back with result_purged; see Failed and purged extractions.