{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "A51D76C7-1424-46E4-A1C1-CD6244BB788A",
    "name": "Invoice Field Check with Jev"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": 305.4057004120276,
        "y": -72.23820847803597,
        "zoom": 0.8066417592221287
      },
      "autoSave": true,
      "descriptions": {
        "flow": "Checks every value an extractor read from a supplier invoice photo against the photo with Jev: a page check, then for each value a zoomed box and a crop check, as in TypeSafe's OCR confidence and bounding boxes cookbook. Values under 0.25 on either check are logged as a pending review in the Jev review log and sent to a person on Slack with buttons; the \"Jev review decisions\" flow records the click. The run does not wait.",
        "initialData": "",
        "initialDataFields": {
          "imageUrl": "Public URL of the invoice photo (JPEG or PNG).",
          "fields": "The values the extractor read, as a JSON object keyed by field: supplier_name, invoice_number, invoice_date, amount_due, bank_name, account_holder, account_number, branch_code."
        }
      }
    },
    "description": "Checks every value an invoice reader pulled from a supplier invoice photo with Jev, first against the whole page and then against a close-up of the value. Values scoring below 0.25 on either check are logged in a Google Sheet and sent to a person in Slack. Rebuilt from TypeSafe's \"Build with Jev\" recipe for OCR confidence and bounding boxes.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Asks Jev several typed questions about the same content in one request (yes/no, choice, score and, in preview, box), written in the TypeSafe API format. Answers come back keyed by the names you choose. Use it to combine questions, or for structured criteria the other actions do not offer.",
          "elementId": "EXTENSION:::SHARED:::default:::jev:::askQuestions",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check each value on the page Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::jev:::askQuestions",
          "legacyElementId": null,
          "methodName": "askQuestions",
          "position": {
            "x": -23.32402186836474,
            "y": 270.74835400328675
          }
        },
        "flowElementId": "406519BC-9B63-4D03-8AE5-3BDDEC3B7FEF",
        "groupId": null,
        "id": "426AB21B-2F8C-4657-81E3-36DF72447A50",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "model",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "jev-1.14.0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "questions",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "prep",
                    "subPathSegments": [
                      {
                        "key": "questions",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "36F0D042-D69A-41B1-8E8B-9535DE5EAA2D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "text",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "data",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageUrls",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "prep",
                    "subPathSegments": [
                      {
                        "key": "pageImageUrls",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "36F0D042-D69A-41B1-8E8B-9535DE5EAA2D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "longContext",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "askQuestions",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "pageCheck",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "jev",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Check each value on the page",
        "nextElementIds": [
          "7D7A0372-F613-4A01-9F91-62DDCCFCE3F4"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Zoom in around each value Result"
          },
          "position": {
            "x": 349.2581588059778,
            "y": 272.47080841498394
          }
        },
        "flowElementId": "9067E6A2-91D7-44CD-AEA7-828A46B4F8DC",
        "groupId": null,
        "id": "7D7A0372-F613-4A01-9F91-62DDCCFCE3F4",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "ctx",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "prep",
                    "subPathSegments": [
                      {
                        "key": "ctx",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "36F0D042-D69A-41B1-8E8B-9535DE5EAA2D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageAnswers",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "pageCheck",
                    "subPathSegments": [
                      {
                        "key": "answers",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "426AB21B-2F8C-4657-81E3-36DF72447A50"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "// Zoom region per value, as in the cookbook: 3x the box, at least 30% x 15% of the page.\nconst P = ctx;\nconst W = P.width, H = P.height, source = P.source;\nconst clamp = (x, lo, hi) => Math.min(hi, Math.max(lo, x));\nfunction cropImage(l, t, w, h, minLong) {\n  const x = Math.round(l * W), y = Math.round(t * H);\n  const cw = Math.max(1, Math.min(W - x, Math.round(w * W)));\n  const ch = Math.max(1, Math.min(H - y, Math.round(h * H)));\n  let s = Math.max(1, minLong / Math.max(cw, ch));\n  s = Math.min(s, 1568 / Math.max(cw, ch));\n  const sw = Math.round(cw * s), sh = Math.round(ch * s);\n  const CW = Math.max(sw, 280), CH = Math.max(sh, 280);\n  const inner = 'wsrv.nl/?url=' + encodeURIComponent(source) + '&cx=' + x + '&cy=' + y + '&cw=' + cw + '&ch=' + ch + '&output=png';\n  const url = 'https://wsrv.nl/?url=' + encodeURIComponent(inner) + '&w=' + CW + '&h=' + CH + '&fit=contain&cbg=white&output=jpg&q=90';\n  return { url, frame: { left: (CW - sw) / 2 / CW, top: (CH - sh) / 2 / CH, width: sw / CW, height: sh / CH } };\n}\n\n// One zoomed image per value. Each goes to Jev in its own request: with several images in one\n// request, Jev's boxes drifted away from the values.\nconst items = P.fieldNames.map(f => {\n  const a = pageAnswers[f + '_box'];\n  const b = (a && a.box) ? a.box : { left: 0, top: 0, right: 1, bottom: 1 };\n  const w = Math.min(1, Math.max(0.30, (b.right - b.left) * 3));\n  const h = Math.min(1, Math.max(0.15, (b.bottom - b.top) * 3));\n  const left = clamp((b.left + b.right) / 2 - w / 2, 0, 1 - w);\n  const top = clamp((b.top + b.bottom) / 2 - h / 2, 0, 1 - h);\n  const c = cropImage(left, top, w, h, 1200);\n  const q = {};\n  q[f + '_zoom'] = { type: 'box', instructions: P.descriptions[f] + ', printed as “' + P.values[f] + '” in this image: `images`' };\n  return { field: f, region: { left, top, width: w, height: h, frame: c.frame, pageBox: b }, zoomImageUrls: [c.url], zoomQuestions: JSON.stringify(q) };\n});\n\nreturn { items, task: 'Locate fields in zoomed-in parts of a supplier invoice.' };\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "zoomPrep",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Zoom in around each value",
        "nextElementIds": [
          "11C48DAE-1D9B-49CD-877B-9EBB98808970"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": true,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Prepare the photo and page questions Result"
          },
          "position": {
            "x": -46,
            "y": 132
          }
        },
        "flowElementId": "31A667AC-9C50-4F36-A299-87C3EE2BBF48",
        "groupId": null,
        "id": "36F0D042-D69A-41B1-8E8B-9535DE5EAA2D",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "imageUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "INITIAL_DATA",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "imageUrl",
                        "optional": false
                      }
                    ],
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.initialData",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "initialData",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fields",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "INITIAL_DATA",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "fields",
                        "optional": false
                      }
                    ],
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.initialData",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "initialData",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "// Field descriptions and wording are TypeSafe's, from the OCR confidence and bounding boxes cookbook.\nconst FIELDS = {\n  supplier_name: \"the supplier's (seller's) business name\",\n  invoice_number: 'the invoice or document number',\n  invoice_date: 'the invoice date',\n  amount_due: 'the final total amount payable',\n  bank_name: \"the name of the supplier's bank in the payment details\",\n  account_holder: \"the account holder name in the supplier's bank details\",\n  account_number: \"the supplier's bank account number\",\n  branch_code: \"the supplier's bank branch code\"\n};\nconst SAME_VALUE = 'Ignore differences in spacing, punctuation, currency symbols and letter case.';\nconst values = typeof fields === 'string' ? JSON.parse(fields) : fields;\nconst source = String(imageUrl).replace(/^https?:\\/\\//, '');\n\n// Read the photo's size, and fit the page within Jev's 1568 px limit.\nconst res = await fetch('https://wsrv.nl/?url=' + encodeURIComponent(source) + '&output=json');\nif (!res.ok) throw new Error('Could not read the invoice photo (HTTP ' + res.status + ').');\nconst meta = await res.json();\nconst pageUrl = 'https://wsrv.nl/?url=' + encodeURIComponent(source) + '&w=1568&h=1568&fit=inside&we&output=jpg&q=90';\n\nconst fieldNames = Object.keys(values).filter(f => FIELDS[f]);\nconst questions = {};\nfor (const f of fieldNames) {\n  const v = values[f];\n  questions[f + '_box'] = { type: 'box', instructions: FIELDS[f] + ', printed as “' + v + '” in `images`' };\n  questions[f + '_fits'] = { type: 'noul', instructions: 'Is “' + v + '” ' + FIELDS[f] + ' on `images`? ' + SAME_VALUE };\n}\n\nreturn {\n  ctx: { imageUrl, source, width: meta.width, height: meta.height, fieldNames, values, descriptions: FIELDS, sameValue: SAME_VALUE },\n  pageImageUrls: [pageUrl],\n  questions: JSON.stringify(questions)\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "prep",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Prepare the photo and page questions",
        "nextElementIds": [
          "426AB21B-2F8C-4657-81E3-36DF72447A50"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends a direct message to a user on Slack with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendDirectMessage",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Ask AP to review on Slack Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendDirectMessage",
          "legacyElementId": "JS###v1###Slack###sendDirectMessage",
          "methodName": "sendDirectMessage",
          "position": {
            "x": 420.91348363195414,
            "y": 831.653194098284
          }
        },
        "flowElementId": "DC42C0B8-C58E-4F29-AD91-66EF55DB7DE3",
        "groupId": null,
        "id": "8DB07FB0-DA43-4074-9599-6C47293D241D",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "userId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "decide",
                    "subPathSegments": [
                      {
                        "key": "messageText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "149B9093-C611-4A28-AAD6-FA7FA9218628"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "decide",
                    "subPathSegments": [
                      {
                        "key": "blocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "149B9093-C611-4A28-AAD6-FA7FA9218628"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendDirectMessage",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "askPerson",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Ask AP to review on Slack",
        "nextElementIds": [
          "0FF686AC-36B3-411E-9B23-DD7360E124A4"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "return-result",
          "isFirstElement": false,
          "blockDefinitionId": "return-result",
          "position": {
            "x": -13.918329647035762,
            "y": 685.1986069012116
          }
        },
        "flowElementId": "80F90F1F-0CDA-467D-8E0F-4E88ED936FB3",
        "groupId": null,
        "id": "A3ABED34-5709-4937-8A4F-4D32469F0F13",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "contentType": "application/json",
          "data": [
            {
              "id": null,
              "name": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "decision"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              },
              "nameType": "DYNAMIC",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "all values passed"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "id": null,
              "name": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "fields"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              },
              "nameType": "DYNAMIC",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "decide",
                    "subPathSegments": [
                      {
                        "key": "fields",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "149B9093-C611-4A28-AAD6-FA7FA9218628"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "releaseCaller": false,
          "resultAlias": "resultOk",
          "singleData": null,
          "storeResult": true
        },
        "name": "Return the checked invoice",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "COMPOSE_RESULT"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Decide which values need review Result"
          },
          "position": {
            "x": 664.9659455325888,
            "y": 523.2676014931101
          }
        },
        "flowElementId": "3BA47AA8-0C07-47A1-9CD6-50CC5F5540B0",
        "groupId": null,
        "id": "149B9093-C611-4A28-AAD6-FA7FA9218628",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "ctx",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "prep",
                    "subPathSegments": [
                      {
                        "key": "ctx",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "36F0D042-D69A-41B1-8E8B-9535DE5EAA2D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageAnswers",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "pageCheck",
                    "subPathSegments": [
                      {
                        "key": "answers",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "426AB21B-2F8C-4657-81E3-36DF72447A50"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "checked",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - checked",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.checked",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "checked",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "executionId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_ID",
                    "label": null,
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.executionId",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "executionId",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "// The cookbook's rule: a value needs review if the page check OR the crop check is below 0.25.\nconst BAR = 0.25;\nconst P = ctx;\nconst r2 = x => (typeof x === 'number' ? Math.round(x * 100) / 100 : null);\nconst byField = {};\nfor (const c of (Array.isArray(checked) ? checked : [])) byField[c.field] = c;\nconst fields = P.fieldNames.map(f => {\n  const fits = (pageAnswers[f + '_fits'] || {}).noul;\n  const c = byField[f] || {};\n  const shows = c.shows;\n  const review = !(fits >= BAR) || !(shows >= BAR);\n  return { field: f, value: P.values[f], pageCheck: r2(fits), cropCheck: r2(shows), status: review ? 'review' : 'ok', box: c.box || null, reviewImageUrl: c.reviewImageUrl || null };\n});\nconst flagged = fields.filter(x => x.status === 'review');\n\n// The review lives in the Jev review log; the buttons carry its id. No run waits for the click.\nconst reviewId = 'inv-' + executionId;\nconst label = f => f.replace(/_/g, ' ');\nconst supplier = P.values.supplier_name || 'an unknown supplier';\nconst invNo = P.values.invoice_number || '(no number)';\nconst headline = 'Invoice ' + invNo + ' from ' + supplier;\nconst blocks = [\n  { type: 'section', text: { type: 'mrkdwn', text: '*' + headline + ' needs your eyes.* Jev is not sure about ' + flagged.length + ' of the ' + fields.length + ' values we read. <' + P.imageUrl + '|Open the invoice photo>' } }\n];\nfor (const x of flagged) {\n  blocks.push({ type: 'section', text: { type: 'mrkdwn', text: '*' + label(x.field) + '*: we read “' + x.value + '”\\nPage check ' + x.pageCheck + ', crop check ' + x.cropCheck + ' (review below 0.25)' } });\n  if (x.reviewImageUrl) blocks.push({ type: 'image', image_url: x.reviewImageUrl, alt_text: 'Where Jev found the ' + label(x.field) });\n}\nblocks.push({ type: 'actions', block_id: 'jev_review', elements: [\n  { type: 'button', action_id: 'jev_inv_ok', style: 'primary', text: { type: 'plain_text', text: 'Values are right' }, value: reviewId },\n  { type: 'button', action_id: 'jev_inv_sendback', style: 'danger', text: { type: 'plain_text', text: 'Send back for correction' }, value: reviewId }\n] });\n\nconst summary = headline + ': ' + flagged.map(x => label(x.field)).join(', ') + ' flagged';\nconst logRow = {\n  'Review ID': reviewId,\n  'Flow': 'Invoice Field Check with Jev',\n  'Run ID': executionId,\n  'Created At': new Date().toISOString(),\n  'Summary': summary,\n  'Payload': JSON.stringify({ imageUrl: P.imageUrl, fields: fields.map(x => ({ field: x.field, value: x.value, pageCheck: x.pageCheck, cropCheck: x.cropCheck, status: x.status })) }),\n  'Status': 'pending',\n  'Decision': '',\n  'Decided By': '',\n  'Decided At': ''\n};\n\nreturn {\n  fields,\n  flaggedCount: flagged.length,\n  reviewId,\n  logRow,\n  messageText: headline + ': ' + flagged.length + ' value(s) need your review',\n  blocks: JSON.stringify(blocks)\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "decide",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Decide which values need review",
        "nextElementIds": [
          "3B0B86BC-2F1A-413D-843F-8E0B8E6D076D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 196.98467356577748,
            "y": 532.1557386563003
          }
        },
        "flowElementId": "4CF8BAF0-3FC1-4E0A-A851-18DEBDC43156",
        "groupId": null,
        "id": "3B0B86BC-2F1A-413D-843F-8E0B8E6D076D",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "c478f876-f32d-42e4-a49c-bb9f2d8361c2",
                "nestedOperation": null,
                "operation": ">",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "decide",
                      "subPathSegments": [
                        {
                          "key": "flaggedCount",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "149B9093-C611-4A28-AAD6-FA7FA9218628"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 0
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "c478f876-f32d-42e4-a49c-bb9f2d8361c2"
            ]
          },
          "elseComponent": {
            "componentId": "A3ABED34-5709-4937-8A4F-4D32469F0F13",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "anyFlagged",
          "storeResult": false,
          "thenComponent": {
            "componentId": "3C117284-E0B7-4F59-B37F-EFE145978C11",
            "componentType": "ELEMENT"
          }
        },
        "name": "Any value below 0.25?",
        "nextElementIds": [
          "A3ABED34-5709-4937-8A4F-4D32469F0F13",
          "3C117284-E0B7-4F59-B37F-EFE145978C11"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Crop the value Result"
          },
          "position": {
            "x": 479.7470758083367,
            "y": 48.69968099727309
          }
        },
        "flowElementId": "8D411EA9-7614-4B1B-A450-14CE0BD3E018",
        "groupId": "B0509453-5A74-44EF-935F-FF03025045C8",
        "id": "0224643D-B767-498A-B461-0F8B71B1335B",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "ctx",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "prep",
                    "subPathSegments": [
                      {
                        "key": "ctx",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "36F0D042-D69A-41B1-8E8B-9535DE5EAA2D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "field",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "field",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "B0509453-5A74-44EF-935F-FF03025045C8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "region",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "region",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "B0509453-5A74-44EF-935F-FF03025045C8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "zoomAnswers",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "zoomOne",
                    "subPathSegments": [
                      {
                        "key": "answers",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "31047983-E18B-4F88-98FF-AB2598472E74"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "// Map the zoomed box back to the page, then crop the value for the crop check.\nconst P = ctx;\nconst W = P.width, H = P.height, source = P.source;\nconst clamp = (x, lo, hi) => Math.min(hi, Math.max(lo, x));\nfunction cropImage(l, t, w, h, minLong) {\n  const x = Math.round(l * W), y = Math.round(t * H);\n  const cw = Math.max(1, Math.min(W - x, Math.round(w * W)));\n  const ch = Math.max(1, Math.min(H - y, Math.round(h * H)));\n  let s = Math.max(1, minLong / Math.max(cw, ch));\n  s = Math.min(s, 1568 / Math.max(cw, ch));\n  const sw = Math.round(cw * s), sh = Math.round(ch * s);\n  const CW = Math.max(sw, 280), CH = Math.max(sh, 280);\n  const inner = 'wsrv.nl/?url=' + encodeURIComponent(source) + '&cx=' + x + '&cy=' + y + '&cw=' + cw + '&ch=' + ch + '&output=png';\n  const url = 'https://wsrv.nl/?url=' + encodeURIComponent(inner) + '&w=' + CW + '&h=' + CH + '&fit=contain&cbg=white&output=jpg&q=90';\n  return { url, frame: { left: (CW - sw) / 2 / CW, top: (CH - sh) / 2 / CH, width: sw / CW, height: sh / CH } };\n}\n\nconst f = field, r = region;\nconst a = zoomAnswers[f + '_zoom'];\nlet box = r.pageBox;\nif (a && a.box) {\n  const fr = r.frame;\n  const fx = v => clamp((v - fr.left) / fr.width, 0, 1);\n  const fy = v => clamp((v - fr.top) / fr.height, 0, 1);\n  box = { left: r.left + fx(a.box.left) * r.width, right: r.left + fx(a.box.right) * r.width, top: r.top + fy(a.box.top) * r.height, bottom: r.top + fy(a.box.bottom) * r.height };\n}\n\n// What the reviewer sees: the value with its label, 3x the box (at least 30% x 12% of the page).\nconst rw = Math.min(1, Math.max(0.30, (box.right - box.left) * 3));\nconst rh = Math.min(1, Math.max(0.12, (box.bottom - box.top) * 3));\nconst rl = clamp((box.left + box.right) / 2 - rw / 2, 0, 1 - rw);\nconst rt = clamp((box.top + box.bottom) / 2 - rh / 2, 0, 1 - rh);\nconst reviewImageUrl = cropImage(rl, rt, rw, rh, 900).url;\n\n// Crop check, as in the cookbook: the box padded by 1% of the page, enlarged to at least 800 px.\nconst l = clamp(box.left - 0.01, 0, 1), t = clamp(box.top - 0.01, 0, 1);\nconst pr = clamp(box.right + 0.01, 0, 1), pb = clamp(box.bottom + 0.01, 0, 1);\nconst crop = cropImage(l, t, pr - l, pb - t, 800);\nconst q = {};\nq[f + '_shows'] = { type: 'noul', instructions: 'Image: `images`\\nDoes this cropped image clearly show ' + P.descriptions[f] + ' as “' + P.values[f] + '”? ' + P.sameValue + ' Answer no if it is cut off, unreadable or different.' };\n\nreturn { box, zoomConfidence: a ? a.confidence : null, reviewImageUrl, cropImageUrls: [crop.url], questions: JSON.stringify(q), task: 'Check values read from cropped parts of a supplier invoice.' };\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "cropOne",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Crop the value",
        "nextElementIds": [
          "46EFF865-0863-46C2-AF35-053CBDC38FCF"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Asks Jev several typed questions about the same content in one request (yes/no, choice, score and, in preview, box), written in the TypeSafe API format. Answers come back keyed by the names you choose. Use it to combine questions, or for structured criteria the other actions do not offer.",
          "elementId": "EXTENSION:::SHARED:::default:::jev:::askQuestions",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Locate the value in its zoomed view Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::jev:::askQuestions",
          "legacyElementId": null,
          "methodName": "askQuestions",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "19F0F1A1-A606-4AA6-A332-987BFDF407A2",
        "groupId": "B0509453-5A74-44EF-935F-FF03025045C8",
        "id": "31047983-E18B-4F88-98FF-AB2598472E74",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "model",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "jev-1.14.0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "questions",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "zoomQuestions",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "B0509453-5A74-44EF-935F-FF03025045C8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "text",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "zoomPrep",
                    "subPathSegments": [
                      {
                        "key": "task",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "7D7A0372-F613-4A01-9F91-62DDCCFCE3F4"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "data",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageUrls",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "zoomImageUrls",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "B0509453-5A74-44EF-935F-FF03025045C8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "longContext",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "askQuestions",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "zoomOne",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "jev",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Locate the value in its zoomed view",
        "nextElementIds": [
          "0224643D-B767-498A-B461-0F8B71B1335B"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "checked": "e290d689-06d3-4f4c-a8e3-e8b0e28fa740"
          },
          "position": {
            "x": 787.7784546971835,
            "y": 318.38979191273927
          }
        },
        "flowElementId": "C35FF3B6-001D-4EC9-A8E4-B4A3F6600227",
        "groupId": "B0509453-5A74-44EF-935F-FF03025045C8",
        "id": "4B03C096-1469-47C4-A130-43A1F9CF50FC",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "checked",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "record",
                    "subPathSegments": [
                      {
                        "key": "list",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9EFD2A14-E290-451E-9A9B-9B39E5EE3785"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "dbAdd",
          "storeResult": true
        },
        "name": "Save the results list",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Add the value to the results Result"
          },
          "position": {
            "x": 763.538323507532,
            "y": 187.13152908033706
          }
        },
        "flowElementId": "A3FCBFF7-8212-4524-94C2-56AF6EFFEBF7",
        "groupId": "B0509453-5A74-44EF-935F-FF03025045C8",
        "id": "9EFD2A14-E290-451E-9A9B-9B39E5EE3785",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "checked",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - checked",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.checked",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "checked",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "field",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "field",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "B0509453-5A74-44EF-935F-FF03025045C8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "box",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "cropOne",
                    "subPathSegments": [
                      {
                        "key": "box",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0224643D-B767-498A-B461-0F8B71B1335B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "reviewImageUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "cropOne",
                    "subPathSegments": [
                      {
                        "key": "reviewImageUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0224643D-B767-498A-B461-0F8B71B1335B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "zoomConfidence",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "cropOne",
                    "subPathSegments": [
                      {
                        "key": "zoomConfidence",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0224643D-B767-498A-B461-0F8B71B1335B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cropAnswers",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "cropCheckOne",
                    "subPathSegments": [
                      {
                        "key": "answers",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "46EFF865-0863-46C2-AF35-053CBDC38FCF"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = Array.isArray(checked) ? checked : [];\nconst a = cropAnswers[field + '_shows'] || {};\nreturn { list: list.concat([{ field, shows: typeof a.noul === 'number' ? a.noul : null, box, zoomConfidence, reviewImageUrl }]) };\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "record",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Add the value to the results",
        "nextElementIds": [
          "4B03C096-1469-47C4-A130-43A1F9CF50FC"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Asks Jev several typed questions about the same content in one request (yes/no, choice, score and, in preview, box), written in the TypeSafe API format. Answers come back keyed by the names you choose. Use it to combine questions, or for structured criteria the other actions do not offer.",
          "elementId": "EXTENSION:::SHARED:::default:::jev:::askQuestions",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check the cropped value Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::jev:::askQuestions",
          "legacyElementId": null,
          "methodName": "askQuestions",
          "position": {
            "x": 771.1970226412155,
            "y": 41.44994683287882
          }
        },
        "flowElementId": "144B4535-5024-4484-8CDC-7E78508FC523",
        "groupId": "B0509453-5A74-44EF-935F-FF03025045C8",
        "id": "46EFF865-0863-46C2-AF35-053CBDC38FCF",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "model",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "jev-1.14.0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "questions",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "cropOne",
                    "subPathSegments": [
                      {
                        "key": "questions",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0224643D-B767-498A-B461-0F8B71B1335B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "text",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "cropOne",
                    "subPathSegments": [
                      {
                        "key": "task",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0224643D-B767-498A-B461-0F8B71B1335B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "data",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageUrls",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "cropOne",
                    "subPathSegments": [
                      {
                        "key": "cropImageUrls",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0224643D-B767-498A-B461-0F8B71B1335B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "longContext",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "askQuestions",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "cropCheckOne",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "jev",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Check the cropped value",
        "nextElementIds": [
          "9EFD2A14-E290-451E-9A9B-9B39E5EE3785"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "checked": "8638ade2-ffeb-4d59-9f6b-951ab1437a46"
          },
          "position": {
            "x": 688.7333378716618,
            "y": 274.1583494220629
          }
        },
        "flowElementId": "24985869-6FD8-4292-AA32-B7B35148C0DA",
        "groupId": null,
        "id": "11C48DAE-1D9B-49CD-877B-9EBB98808970",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "checked",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EMPTY_LIST",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "arrays.create()"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "dbInit",
          "storeResult": true
        },
        "name": "Start an empty results list",
        "nextElementIds": [],
        "nextGroupIds": [
          "B0509453-5A74-44EF-935F-FF03025045C8"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "return-result",
          "isFirstElement": false,
          "blockDefinitionId": "return-result",
          "position": {
            "x": 433.04408394033214,
            "y": 991.6399304784564
          }
        },
        "flowElementId": "E8E3AE72-4ED8-4C34-850A-A314FFE9AD04",
        "groupId": null,
        "id": "0FF686AC-36B3-411E-9B23-DD7360E124A4",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "contentType": "application/json",
          "data": [
            {
              "id": null,
              "name": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "decision"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              },
              "nameType": "DYNAMIC",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "sent for review"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "id": null,
              "name": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "reviewId"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              },
              "nameType": "DYNAMIC",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "decide",
                    "subPathSegments": [
                      {
                        "key": "reviewId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "149B9093-C611-4A28-AAD6-FA7FA9218628"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "id": null,
              "name": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "fields"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              },
              "nameType": "DYNAMIC",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "decide",
                    "subPathSegments": [
                      {
                        "key": "fields",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "149B9093-C611-4A28-AAD6-FA7FA9218628"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "releaseCaller": false,
          "resultAlias": "resultSent",
          "singleData": null,
          "storeResult": true
        },
        "name": "Return: sent for review",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "COMPOSE_RESULT"
      },
      {
        "clientMetadata": {
          "notes": "Adds new data rows to Google Sheets for AI agents to store processed results, log user interactions, or collect data from automated workflows. Perfect for building databases, tracking metrics, saving form submissions, or creating data collection pipelines.",
          "elementId": "EXTENSION:::SHARED:::default:::google-sheets:::addRow",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Log the review as pending Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::google-sheets:::addRow",
          "legacyElementId": "JS###v1###GoogleSheets###addRow",
          "methodName": "addRow",
          "position": {
            "x": 412.7017121541511,
            "y": 698.3812316643044
          }
        },
        "flowElementId": "DFB84657-65BC-468F-9B0A-09FB0FFE5060",
        "groupId": null,
        "id": "3C117284-E0B7-4F59-B37F-EFE145978C11",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "documentId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sheetId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 0
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "row",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "decide",
                    "subPathSegments": [
                      {
                        "key": "logRow",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "149B9093-C611-4A28-AAD6-FA7FA9218628"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "addRow",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "logReview",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "google-sheets",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Log the review as pending",
        "nextElementIds": [
          "8DB07FB0-DA43-4074-9599-6C47293D241D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "36F0D042-D69A-41B1-8E8B-9535DE5EAA2D",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": 150.48901369491932,
            "y": 156.7646312772735,
            "zoom": 0.9037527267510874
          },
          "position": {
            "x": 640.339108794148,
            "y": 403.0181925403818
          }
        },
        "flowElementId": "C869971B-0C2D-4F9C-A84D-4EE58D029FCA",
        "groupId": null,
        "id": "B0509453-5A74-44EF-935F-FF03025045C8",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "enabled": true,
          "firstElementId": "31047983-E18B-4F88-98FF-AB2598472E74",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "zoomPrep",
                "subPathSegments": [
                  {
                    "key": "items",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "7D7A0372-F613-4A01-9F91-62DDCCFCE3F4"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "For each value, locate and crop with Jev",
        "nextElementIds": [
          "149B9093-C611-4A28-AAD6-FA7FA9218628"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "32A3318D-918A-4877-9A1F-07C3F49A8CDF",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": null,
        "valid": true
      },
      "errorMessage": null,
      "executionStaticData": [
        {
          "description": "The TypeSafe API key Jev uses (saved under API Keys as Jev).",
          "error": null,
          "name": "Jev",
          "type": "API_KEY",
          "value": ""
        }
      ],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": true
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-11-13T02:28:56.854Z"
}
