{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "F03650D7-7B7F-4D85-A881-B8257D98AF15",
    "name": "AWS Textract: prescription checked for Rx review"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -7.134440278521694,
        "y": 22.86020353508302,
        "zoom": 0.43
      },
      "autoSave": false,
      "descriptions": {
        "flow": "A prescription faxed to the specialty pharmacy's Documo line is read with AWS Textract (queries and signatures). A signed, complete prescription with clear answers and no printed schedule is filed in CareTend Incoming Documents on the Rx review path. Anything else goes to the intake pharmacist in Slack with what is missing; the pharmacist can file it for review, have the flow fax the prescriber a request (never for a controlled substance) and file it as held, or handle it by hand. The flow never writes, changes or approves a prescription.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "Checks each prescription faxed to the specialty pharmacy's Documo line with Textract SIGNATURES and QUERIES, files a signed and complete one on the CareTend Rx review path, and sends anything unsigned, incomplete, unclear or controlled to the intake pharmacist in Slack.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 453,
            "y": 170
          }
        },
        "flowElementId": "529D5EFE-B54C-4CB3-9880-E75A962B141D",
        "groupId": null,
        "id": "B3E09132-346A-4288-B6E0-E7F621901335",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "a1724308-89cd-45c5-8c90-5df2b1f1a9ed",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Fax",
                      "subPathSegments": [
                        {
                          "key": "file",
                          "optional": false
                        },
                        {
                          "key": "url",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "a1724308-89cd-45c5-8c90-5df2b1f1a9ed"
            ]
          },
          "elseComponent": {
            "componentId": "3120CA13-A556-480D-9128-136677B9D758",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cFile",
          "storeResult": false,
          "thenComponent": {
            "componentId": "CB8B614C-C19F-4B69-B6BE-9C775070F776",
            "componentType": "ELEMENT"
          }
        },
        "name": "Fax PDF saved?",
        "nextElementIds": [
          "3120CA13-A556-480D-9128-136677B9D758",
          "CB8B614C-C19F-4B69-B6BE-9C775070F776"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Files a received fax (for example a new referral) into CareTend's Incoming Documents grid as a New Fax document, optionally on an Incoming Document Path such as Intake Referrals so the intake team picks it up. The file is downloaded from the URL you give. Returns the new document ID.",
          "elementId": "EXTENSION:::SHARED:::default:::wellsky-caretend:::uploadIncomingFax",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "File it for Rx review in CareTend Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::wellsky-caretend:::uploadIncomingFax",
          "legacyElementId": null,
          "methodName": "uploadIncomingFax",
          "position": {
            "x": 789,
            "y": 1231
          }
        },
        "flowElementId": "C2EB0099-C313-4F98-8E25-6193A2918EF5",
        "groupId": null,
        "id": "2FA8D7D3-D27B-4E42-8115-943B8F54E849",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Fax file",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Fax file",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Fax file",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "description",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check",
                    "subPathSegments": [
                      {
                        "key": "title",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "companyIds",
              "type": "SIMPLE_LIST",
              "value": [
                {
                  "expression": [
                    {
                      "id": "PLACEHOLDER_DATA",
                      "label": "CareTend company ID",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_STATIC_DATA",
                      "value": "CareTend company ID"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                }
              ]
            },
            {
              "name": "assignmentType",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "assignedEntityId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "workflowGroups",
              "type": "SIMPLE_LIST",
              "value": [
                {
                  "expression": [
                    {
                      "id": "TEXT",
                      "label": null,
                      "type": "INPUT",
                      "value": "spRx"
                    }
                  ],
                  "mode": "BASIC",
                  "parseJsonString": false,
                  "resultType": null
                }
              ]
            },
            {
              "name": "category",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "incomingDocumentPath",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Rx review path",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Rx review path"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "keywords",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "notes",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check",
                    "subPathSegments": [
                      {
                        "key": "note",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " Faxed from "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "faxCallerId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", Documo message "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "receivedDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "createdAt",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "queueDate",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sentDateTime",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "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": "uploadIncomingFax",
          "onFailElemId": "E96042BE-E67D-4225-8010-6CB92B572F04",
          "packageId": "default",
          "resultAlias": "Filed",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "wellsky-caretend",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "File it for Rx review in CareTend",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Textract could not start Result"
          },
          "position": {
            "x": 1206,
            "y": 40
          }
        },
        "flowElementId": "87527278-1893-4D51-9EF1-DFFA5B43704D",
        "groupId": null,
        "id": "4C7B18A3-6623-4BA2-BE2D-2F8400049FA3",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Textract error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Textract could not start",
        "nextElementIds": [
          "3120CA13-A556-480D-9128-136677B9D758"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "d18f7b61-9a30-4695-ab36-13130436734d",
            "Textract result": "561201f2-0a1d-47fb-b2f4-ce653564d3e9"
          },
          "position": {
            "x": 1073,
            "y": 59
          }
        },
        "flowElementId": "10BDF549-5B53-4E6A-A7BE-A6E0837F4DA4",
        "groupId": "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7",
        "id": "6C178AEE-4B20-4F8B-84B6-170D6C447C69",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Reading done",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "yes"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "Textract result",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Analysis",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "30C8D1D0-B723-46C3-9381-FE6D89CD3E28"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "keep",
          "storeResult": true
        },
        "name": "Keep what Textract read",
        "nextElementIds": [
          "F6C48659-3EE7-4588-BF91-6D551FC96213"
        ],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check the prescription Result"
          },
          "position": {
            "x": 110,
            "y": 340
          }
        },
        "flowElementId": "7FEACFA6-570F-468D-8442-0E85C899D1E0",
        "groupId": null,
        "id": "0233615D-6F60-4924-B181-8E78759DB9F6",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "read",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Read",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "0865B851-0517-4480-8749-60808E2246EE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "confidenceFloor",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Confidence floor",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Confidence floor"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const s = (v) => String(v == null ? '' : v).replace(/\\s+/g, ' ').trim();\nconst floor = Number(confidenceFloor) || 90;\nconst answers = (read && read.answers) || {};\nconst conf = (read && read.confidence) || {};\nconst fields = [\n  ['PATIENT_NAME', 'patient name', true], ['PATIENT_DOB', 'patient date of birth', true], ['DRUG', 'drug', true], ['STRENGTH', 'strength', true],\n  ['QUANTITY', 'quantity', true], ['DIRECTIONS', 'directions (sig)', true], ['REFILLS', 'refills', false], ['PRESCRIBER', 'prescriber name', true],\n  ['PRESCRIBER_NPI', 'prescriber NPI', true], ['DEA', 'DEA number', false], ['SCHEDULE', 'schedule', false], ['PRESCRIBER_FAX', 'prescriber fax', false],\n  ['DATE_WRITTEN', 'date written', false], ['DAW', 'dispense as written', false],\n];\nconst got = {};\nconst missing = [];\nconst unsure = [];\nconst confirm = [];\nfor (const [key, label, required] of fields) {\n  const v = s(answers[key]);\n  got[key] = v;\n  if (!v) { if (required) missing.push(label); continue; }\n  const c = conf[key];\n  if (typeof c === 'number' && c < floor) { unsure.push(`${label} read as \"${v}\" (${c}% sure)`); confirm.push(`the ${label} (we read \"${v}\")`); }\n}\nconst text = String((read && read.text) || '');\n// The flow never judges whether a drug is controlled. Any answer to the schedule question, or a schedule printed anywhere on the fax, sends it to the pharmacist.\nconst schedRe = /\\bC\\s*[-‐-―−]?\\s*(II|III|IV|V|[2-5])\\b|\\bSched(?:ule)?\\.?\\s*[:#]?\\s*(II|III|IV|V|[2-5])\\b/i;\nconst hit = schedRe.exec(text);\nconst schedule = got.SCHEDULE ? got.SCHEDULE : (hit ? hit[0] : '');\n// SIGNATURES only says a signature-like mark exists. It must be on the page that holds the prescription; an unclear one goes to the pharmacist.\nconst pageText = (read && read.pageText) || {};\nconst pageKeys = Object.keys(pageText);\nconst drugKey = s(got.DRUG).toLowerCase();\nlet rxPages = drugKey.length > 2 ? pageKeys.filter((p) => String(pageText[p]).toLowerCase().includes(drugKey)) : [];\nif (!rxPages.length) rxPages = pageKeys.filter((p) => /\\b(rx|sig|refills?|dispense|qty|quantity)\\b/i.test(String(pageText[p])));\nconst allSigs = (read && read.signatures) || [];\nconst sigs = allSigs.filter((x) => rxPages.includes(String(x.page)));\nif (!rxPages.length) missing.push('a page that reads as the prescription');\nelse if (rxPages.length > 1) { unsure.push(`more than one page reads as a prescription (pages ${rxPages.join(', ')})`); confirm.push('that each prescription on the fax is signed'); }\nconst best = sigs.reduce((m, x) => Math.max(m, Number(x.confidence) || 0), 0);\nif (!sigs.length) missing.push(allSigs.length ? `prescriber signature on the prescription page (a signature was found only on page ${[...new Set(allSigs.map((x) => x.page))].join(', ')})` : 'prescriber signature');\nelse if (best < floor) { unsure.push(`the signature (Textract is ${best}% sure there is one)`); confirm.push('the signature (please send a signed copy)'); }\nconst realWords = (text.match(/[A-Za-z]{3,}/g) || []).length;\nconst readable = realWords >= 15;\nconst isRx = readable && (!!(got.DRUG || got.DIRECTIONS || got.QUANTITY) || /\\b(rx|prescription|sig|refills?|dispense|qty)\\b/i.test(text));\nconst clean = isRx && !missing.length && !unsure.length && !schedule;\nconst plain = got.PRESCRIBER.replace(/\\b(dr|md|do|np|pa|aprn|fnp|dnp|phd)\\b\\.?/gi, ' ').replace(/[,.]/g, ' ').replace(/\\s+/g, ' ').trim();\nconst parts = plain.split(' ').filter(Boolean);\nconst issues = [...missing.map((m) => `missing: ${m}`), ...unsure.map((u) => `unclear: ${u}`), ...(schedule ? [`controlled substance schedule printed or answered: ${schedule}`] : [])];\nconst note = clean ? 'Read by Textract: signed on the prescription page, and patient, birth date, drug, strength, quantity, directions, prescriber and NPI all present and read with confidence, with no schedule.' : `Textract flagged: ${issues.join('; ')}. Sent on for Rx review by the intake pharmacist in Slack.`;\nconst title = `Rx ${got.DRUG || 'prescription'} ${got.STRENGTH || ''} for ${got.PATIENT_NAME || 'patient not read'}${got.PATIENT_DOB ? `, DOB ${got.PATIENT_DOB}` : ''}`.replace(/\\s+/g, ' ').trim().slice(0, 120);\nreturn { isPrescription: isRx ? 'yes' : 'no', readable: readable ? 'yes' : 'no', unreadableNote: readable ? '' : 'Textract found too little readable text to tell what it is.', clean: clean ? 'yes' : 'no', controlled: schedule ? 'yes' : 'no', schedule, missing, unsure, confirm, issues, got, rxPages, signatureCount: sigs.length, prescriberFirst: parts.length > 1 ? parts[0] : '', prescriberLast: parts.length ? parts[parts.length - 1] : '', title, note };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Check",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Check the prescription",
        "nextElementIds": [
          "FCCE602A-075D-44E0-88B4-0203374BE1E5"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "254682da-2990-42a2-b3fe-51d1004dcc17",
            "Textract result": "7cf0d69a-41b4-4de6-a8c5-4f06ee59828b",
            "Fax file": "79c6ab96-6b57-4099-9942-eb3ccb9b598e",
            "Reading error": "6c2e8a56-18a9-49b8-a401-cded281ea65e"
          },
          "position": {
            "x": 1217,
            "y": 170
          }
        },
        "flowElementId": "11D2376C-FF45-4046-898E-F2717EE4DF4B",
        "groupId": null,
        "id": "2AE73202-10C3-4515-A732-DE169D2838CE",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Reading done",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "no"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "Textract result",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EMPTY_OBJECT",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "general.createObject()"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "Fax file",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "Reading error",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "none"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "bucket0",
          "storeResult": true
        },
        "name": "Not read yet",
        "nextElementIds": [],
        "nextGroupIds": [
          "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 453,
            "y": 340
          }
        },
        "flowElementId": "14D2EA98-405F-4E66-9587-30D75523EFF5",
        "groupId": null,
        "id": "9F1A667B-9CA5-4BED-B4FC-B70F6E47E218",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "345d7ead-552d-439e-9e6b-3610169360ee",
                "nestedOperation": null,
                "operation": "isEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Read",
                      "subPathSegments": [
                        {
                          "key": "problem",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "0865B851-0517-4480-8749-60808E2246EE"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "345d7ead-552d-439e-9e6b-3610169360ee"
            ]
          },
          "elseComponent": {
            "componentId": "3120CA13-A556-480D-9128-136677B9D758",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cPages",
          "storeResult": false,
          "thenComponent": {
            "componentId": "0233615D-6F60-4924-B181-8E78759DB9F6",
            "componentType": "ELEMENT"
          }
        },
        "name": "Read every page?",
        "nextElementIds": [
          "0233615D-6F60-4924-B181-8E78759DB9F6",
          "3120CA13-A556-480D-9128-136677B9D758"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "wait",
          "isFirstElement": true,
          "blockDefinitionId": "wait",
          "mode": "SIMPLE",
          "position": {
            "x": 110,
            "y": 59
          }
        },
        "flowElementId": "7800544D-95DA-4679-8B10-08165D37AFD0",
        "groupId": "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7",
        "id": "320F5DE3-B280-4900-BD02-642322AE175D",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "delay": {
            "expression": [
              {
                "id": "NUMBER",
                "label": null,
                "type": "INPUT",
                "value": 10
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": "DOUBLE"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "pause",
          "storeResult": true
        },
        "name": "Give Textract a moment",
        "nextElementIds": [
          "30C8D1D0-B723-46C3-9381-FE6D89CD3E28"
        ],
        "nextGroupIds": [],
        "type": "WAIT"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 426,
            "y": 900
          }
        },
        "flowElementId": "6972DEA3-01EE-4109-9F2F-140CAC6982F1",
        "groupId": null,
        "id": "3465C51A-A450-49CE-9473-CE363DE81FFC",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "4be8adcd-3ad6-4c13-9a57-b0531a8d748d",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Check",
                      "subPathSegments": [
                        {
                          "key": "clean",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "yes"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "4be8adcd-3ad6-4c13-9a57-b0531a8d748d"
            ]
          },
          "elseComponent": {
            "componentId": "65D95023-E93F-46AD-8DC9-CE1603C0BB87",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cClean",
          "storeResult": false,
          "thenComponent": {
            "componentId": "2FA8D7D3-D27B-4E42-8115-943B8F54E849",
            "componentType": "ELEMENT"
          }
        },
        "name": "Signed, complete and clear?",
        "nextElementIds": [
          "2FA8D7D3-D27B-4E42-8115-943B8F54E849",
          "65D95023-E93F-46AD-8DC9-CE1603C0BB87"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 118,
            "y": 900
          }
        },
        "flowElementId": "2C042470-4FA5-420A-8B2B-358E207AAF01",
        "groupId": null,
        "id": "FCCE602A-075D-44E0-88B4-0203374BE1E5",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "ceb8e3f4-89bb-4367-9802-1d45300746af",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Check",
                      "subPathSegments": [
                        {
                          "key": "isPrescription",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "yes"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "ceb8e3f4-89bb-4367-9802-1d45300746af"
            ]
          },
          "elseComponent": {
            "componentId": "BA28C65A-24E5-4D1D-B526-F1CEFB069C6E",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cRx",
          "storeResult": false,
          "thenComponent": {
            "componentId": "3465C51A-A450-49CE-9473-CE363DE81FFC",
            "componentType": "ELEMENT"
          }
        },
        "name": "Prescription?",
        "nextElementIds": [
          "3465C51A-A450-49CE-9473-CE363DE81FFC",
          "BA28C65A-24E5-4D1D-B526-F1CEFB069C6E"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves the results of an asynchronous document analysis job started by Start Document Analysis. Returns the JobStatus (IN_PROGRESS, SUCCEEDED, FAILED, or PARTIAL_SUCCESS). When SUCCEEDED, this operation automatically paginates through all result pages and returns the full set of Blocks plus convenience extractions across the whole document: form key-value pairs, a query-to-answer map with a matching query-to-confidence map (queryConfidence, 0-100, null where a query has no answer), and simplified table rows. Poll this operation until JobStatus is no longer IN_PROGRESS.",
          "elementId": "EXTENSION:::SHARED:::default:::aws-textract:::getDocumentAnalysis",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check the reading Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::aws-textract:::getDocumentAnalysis",
          "legacyElementId": "JS###v1###Textract###getDocumentAnalysis",
          "methodName": "getDocumentAnalysis",
          "position": {
            "x": 434,
            "y": 50
          }
        },
        "flowElementId": "CD173B00-0C8B-420B-A987-147FE3EBB945",
        "groupId": "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7",
        "id": "30C8D1D0-B723-46C3-9381-FE6D89CD3E28",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "jobId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Job",
                    "subPathSegments": [
                      {
                        "key": "jobId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB8B614C-C19F-4B69-B6BE-9C775070F776"
                  }
                ],
                "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": "getDocumentAnalysis",
          "onFailElemId": "634E87CB-9775-4784-B6AE-8108878206ED",
          "packageId": "default",
          "resultAlias": "Analysis",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "aws-textract",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Check the reading",
        "nextElementIds": [
          "5B9507A1-DAA9-4D1B-933D-670B554EA271"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 754,
            "y": 59
          }
        },
        "flowElementId": "A58E22C8-5356-4E3B-B235-5826614A82C0",
        "groupId": "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7",
        "id": "5B9507A1-DAA9-4D1B-933D-670B554EA271",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "0ee304d2-16ee-4154-b372-82b739e80854",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Analysis",
                      "subPathSegments": [
                        {
                          "key": "jobStatus",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "30C8D1D0-B723-46C3-9381-FE6D89CD3E28"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "IN_PROGRESS"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "0ee304d2-16ee-4154-b372-82b739e80854"
            ]
          },
          "elseComponent": {
            "componentId": "6C178AEE-4B20-4F8B-84B6-170D6C447C69",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "still",
          "storeResult": false,
          "thenComponent": null
        },
        "name": "Still reading?",
        "nextElementIds": [
          "6C178AEE-4B20-4F8B-84B6-170D6C447C69"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Fires when Documo finishes receiving a fax. The event carries the fax record (message ID, status, result code, fax number, caller ID, CSID, pages, times) and, for a successful fax, its PDF saved to FlowRunner file storage at workspace scope in \"file\" (URL, name, content type, size). \"file\" is null for a failed fax, or when the PDF could not be fetched, with the reason in \"fileError\"; use Download Fax with the message ID then. Optionally only fires for one receiving number or one outcome.",
          "elementId": "EXTENSION:::SHARED:::default:::documo:::onNewInboundFax",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-trigger",
          "newElementId": "EXTENSION:::SHARED:::default:::documo:::onNewInboundFax",
          "legacyElementId": null,
          "methodName": "onNewInboundFax",
          "position": {
            "x": 118,
            "y": 161
          }
        },
        "flowElementId": "5241AE31-3B63-482C-9CBE-57C912173836",
        "groupId": null,
        "id": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0",
        "metaInfo": {
          "callbackUrl": null,
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "connectionId": null,
          "eventName": "onNewInboundFax",
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Fax",
          "scope": "SINGLE_APP",
          "serviceId": "documo",
          "slaConditions": [],
          "staticData": {
            "status": "success"
          },
          "storeResult": true,
          "subtype": "REALTIME",
          "type": "CUSTOM"
        },
        "name": "New fax on Documo",
        "nextElementIds": [
          "B3E09132-346A-4288-B6E0-E7F621901335"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Gather what Textract read Result"
          },
          "position": {
            "x": 807,
            "y": 340
          }
        },
        "flowElementId": "7D433065-B648-4821-885F-022E8B8CEE4D",
        "groupId": null,
        "id": "0865B851-0517-4480-8749-60808E2246EE",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "analysis",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Textract result",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Textract result",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Textract result",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "readingError",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Reading error",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Reading error",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Reading error",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const a = analysis || {};\nconst blocks = Array.isArray(a.blocks) ? a.blocks : [];\nconst clean = (c) => String(c == null ? '' : c).replace(/\\s+/g, ' ').trim();\nconst answers = {};\nconst confidence = {};\nconst q = a.queries || {};\nconst qc = a.queryConfidence || {};\nfor (const k of Object.keys(q)) {\n  answers[k] = clean(q[k]);\n  confidence[k] = typeof qc[k] === 'number' ? Math.round(qc[k]) : null;\n}\nconst signatures = blocks.filter((b) => b.BlockType === 'SIGNATURE').map((b) => ({ page: b.Page || 1, confidence: Math.round(b.Confidence || 0) }));\nconst lines = blocks.filter((b) => b.BlockType === 'LINE');\nconst text = lines.map((b) => clean(b.Text)).join('\\n').slice(0, 20000);\nconst pageText = {};\nfor (const b of lines) { const p = String(b.Page || 1); pageText[p] = (pageText[p] ? pageText[p] + '\\n' : '') + clean(b.Text); }\nconst chars = text.replace(/\\s/g, '').length;\nconst err = clean(readingError) === 'none' ? '' : clean(readingError);\nconst status = a.jobStatus || '';\nlet problem = status === 'SUCCEEDED' ? '' : (status === 'FAILED' ? 'Textract could not read it.' : (status === 'PARTIAL_SUCCESS' ? 'Textract read only part of it.' : 'Textract had not finished reading it after 15 minutes.'));\nif (err) problem = `Textract returned an error while reading it: ${err}`;\nelse if (!problem && chars < 60) problem = 'Textract found almost no text on it, so it may be blank or too faint to read.';\nreturn { status, problem, pages: a.pages || 0, answers, confidence, signatures, text, pageText, chars };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Read",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Gather what Textract read",
        "nextElementIds": [
          "9F1A667B-9CA5-4BED-B4FC-B70F6E47E218"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels 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:::sendMessageToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the pharmacist: fax not read Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 786,
            "y": 501
          }
        },
        "flowElementId": "36AA6F20-D639-457D-9514-111F17D53D44",
        "groupId": null,
        "id": "3120CA13-A556-480D-9128-136677B9D758",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "*A fax on the Documo line could not be read.* It came from "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "faxCallerId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " with "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "pagesCount",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " pages (Documo message "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "). "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "fileError",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Read",
                    "subPathSegments": [
                      {
                        "key": "problem",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0865B851-0517-4480-8749-60808E2246EE"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Textract error",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "4C7B18A3-6623-4BA2-BE2D-2F8400049FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check",
                    "subPathSegments": [
                      {
                        "key": "unreadableNote",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "\nIf it is a prescription, please check it by hand. Nothing was filed in CareTend. "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "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": [],
                "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": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Unread note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the pharmacist: fax not read",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Starts an asynchronous document analysis job over a document in Amazon S3 (used for multi-page PDFs and TIFFs, up to 500 MB / 3000 pages). Choose one or more feature types (FORMS, TABLES, QUERIES, SIGNATURES, LAYOUT). Returns a JobId. Poll Get Document Analysis with that JobId until JobStatus is SUCCEEDED. Give the document as an S3 Bucket and S3 Object Name, or as a FlowRunner File URL: the file is then uploaded to the connection's Staging S3 Bucket (or the S3 Bucket given here) under flowrunner-textract/, and the result also returns that s3Bucket and s3Name. The staged object is not deleted, because Textract reads it after this action returns: expire it with an S3 lifecycle rule on the prefix, or delete it once the job has finished. The bucket must be in the same region as this integration, and the credentials need s3:PutObject and s3:GetObject on it.",
          "elementId": "EXTENSION:::SHARED:::default:::aws-textract:::startDocumentAnalysis",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Start reading the prescription Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::aws-textract:::startDocumentAnalysis",
          "legacyElementId": "JS###v1###Textract###startDocumentAnalysis",
          "methodName": "startDocumentAnalysis",
          "position": {
            "x": 796,
            "y": 161
          }
        },
        "flowElementId": "B0DEDC66-33A5-46C0-B0F1-1EBF5B78F49B",
        "groupId": null,
        "id": "CB8B614C-C19F-4B69-B6BE-9C775070F776",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "featureTypes",
              "type": "SIMPLE_LIST",
              "value": [
                {
                  "expression": [
                    {
                      "id": "TEXT",
                      "label": null,
                      "type": "INPUT",
                      "value": "QUERIES"
                    }
                  ],
                  "mode": "BASIC",
                  "parseJsonString": false,
                  "resultType": null
                },
                {
                  "expression": [
                    {
                      "id": "TEXT",
                      "label": null,
                      "type": "INPUT",
                      "value": "SIGNATURES"
                    }
                  ],
                  "mode": "BASIC",
                  "parseJsonString": false,
                  "resultType": null
                }
              ]
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "s3Bucket",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "s3Name",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "queries",
              "type": "COMPLEX_LIST",
              "value": [
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What is the patient's full name?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "PATIENT_NAME"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What is the patient's date of birth?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "PATIENT_DOB"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What drug is prescribed?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "DRUG"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What is the strength of the drug?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "STRENGTH"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What quantity is to be dispensed?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "QUANTITY"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What are the directions or sig?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "DIRECTIONS"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "How many refills are allowed?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "REFILLS"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What is the prescriber's name?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "PRESCRIBER"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What is the prescriber's NPI?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "PRESCRIBER_NPI"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What is the prescriber's DEA number?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "DEA"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What controlled substance schedule is printed?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "SCHEDULE"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What is the prescriber's fax number?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "PRESCRIBER_FAX"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What date was the prescription written?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "DATE_WRITTEN"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "Is dispense as written or substitution permitted marked?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "DAW"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                }
              ]
            },
            {
              "name": "clientRequestToken",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "jobTag",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "rx-fax"
                  }
                ],
                "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": "startDocumentAnalysis",
          "onFailElemId": "4C7B18A3-6623-4BA2-BE2D-2F8400049FA3",
          "packageId": "default",
          "resultAlias": "Job",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "aws-textract",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Start reading the prescription",
        "nextElementIds": [
          "2AE73202-10C3-4515-A732-DE169D2838CE"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "break-repeat",
          "isFirstElement": false,
          "blockDefinitionId": "break-repeat",
          "position": {
            "x": 1402,
            "y": 59
          }
        },
        "flowElementId": "C98223E9-6A69-453B-9110-9FE1C00CADE9",
        "groupId": "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7",
        "id": "F6C48659-3EE7-4588-BF91-6D551FC96213",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "done",
          "storeResult": true
        },
        "name": "Done reading",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "BREAK"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 451,
            "y": 1500
          }
        },
        "flowElementId": "29FD1C96-792C-4332-B278-1A136B23AF36",
        "groupId": null,
        "id": "E94A1862-B3D6-428E-A32B-93B8921F18BA",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "272daf59-e5f9-404f-a2a8-38508030e72c",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Pharmacist answer",
                      "subPathSegments": [
                        {
                          "key": "decision",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "71FCB453-F5EE-4E6D-B3A3-7C284AC8D39A"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "file"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "272daf59-e5f9-404f-a2a8-38508030e72c"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cReview",
          "storeResult": false,
          "thenComponent": {
            "componentId": "2FA8D7D3-D27B-4E42-8115-943B8F54E849",
            "componentType": "ELEMENT"
          }
        },
        "name": "Send it to Rx review?",
        "nextElementIds": [
          "2FA8D7D3-D27B-4E42-8115-943B8F54E849"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Prescriber search failed Result"
          },
          "position": {
            "x": 1205,
            "y": 770
          }
        },
        "flowElementId": "B1953C59-14DF-4E6D-B4AD-AAE6A853798C",
        "groupId": null,
        "id": "AB1B91AE-03A6-4144-A15F-3E615E789EDF",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Search error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Prescriber search failed",
        "nextElementIds": [
          "6E28DB1C-3A17-40F4-B86C-DBA90353FD7F"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "notes": "Downloads a fax's document as PDF (or TIFF) and saves it to FlowRunner file storage. Returns the file's URL, name, content type and size, ready to attach, store or parse in the next step.",
          "elementId": "EXTENSION:::SHARED:::default:::documo:::downloadFax",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get a fresh copy of the fax Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::documo:::downloadFax",
          "legacyElementId": null,
          "methodName": "downloadFax",
          "position": {
            "x": 432,
            "y": 1061
          }
        },
        "flowElementId": "013A9875-713A-412C-81A8-4EB19A96CE74",
        "groupId": null,
        "id": "7BBF0575-28D2-47E5-A9C5-944C14874276",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "messageId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "format",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "pdf"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileOptions",
              "type": "OBJECT",
              "value": [
                {
                  "name": "scope",
                  "type": "SIMPLE",
                  "value": {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "FLOW"
                      }
                    ],
                    "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": "downloadFax",
          "onFailElemId": "E96042BE-E67D-4225-8010-6CB92B572F04",
          "packageId": "default",
          "resultAlias": "Fresh copy",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "documo",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get a fresh copy of the fax",
        "nextElementIds": [
          "8ED59203-A6B4-4E60-8F49-9528C30E6560"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends one or more files as a fax to a fax number, with an optional cover page. Files are given as URLs (for example FlowRunner file URLs from an earlier step); each is downloaded and faxed in the order listed. Text written in the step (Text Page) is faxed as pages of its own, before the files, with no length limit beyond Documo's file limits. Returns the new fax record with its message ID and status (\"processing\" until delivery finishes; use Get Fax or the fax history to follow it).",
          "elementId": "EXTENSION:::SHARED:::default:::documo:::sendFax",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Fax the prescriber what is missing Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::documo:::sendFax",
          "legacyElementId": null,
          "methodName": "sendFax",
          "position": {
            "x": 780,
            "y": 1751
          }
        },
        "flowElementId": "8FCAAD6B-B1C8-4B16-8796-70ED4232D413",
        "groupId": null,
        "id": "D2E0184F-F66D-4244-B4F5-047016A2B1C7",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "faxNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Request",
                    "subPathSegments": [
                      {
                        "key": "faxNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D389B791-9FBC-4741-A108-23695414A7E6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrls",
              "type": "SIMPLE_LIST",
              "value": [
                {
                  "expression": [
                    {
                      "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                      "label": "Default - Fax file",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_PATH",
                      "value": "executionContext.dataBuckets.Default.Fax file",
                      "valueSegments": [
                        {
                          "key": "executionContext",
                          "optional": false
                        },
                        {
                          "key": "dataBuckets",
                          "optional": false
                        },
                        {
                          "key": "Default",
                          "optional": false
                        },
                        {
                          "key": "Fax file",
                          "optional": false
                        }
                      ]
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                }
              ]
            },
            {
              "name": "text",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card",
                    "subPathSegments": [
                      {
                        "key": "request",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6E28DB1C-3A17-40F4-B86C-DBA90353FD7F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "coverPage",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "coverPageId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "recipientName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card",
                    "subPathSegments": [
                      {
                        "key": "recipient",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6E28DB1C-3A17-40F4-B86C-DBA90353FD7F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "senderName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Pharmacy name",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Pharmacy name"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subject",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card",
                    "subPathSegments": [
                      {
                        "key": "subject",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6E28DB1C-3A17-40F4-B86C-DBA90353FD7F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "notes",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "callerId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "scheduledDate",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "optimizeFax",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "customFields",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "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": "sendFax",
          "onFailElemId": "E96042BE-E67D-4225-8010-6CB92B572F04",
          "packageId": "default",
          "resultAlias": "Sent fax",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "documo",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Fax the prescriber what is missing",
        "nextElementIds": [
          "FE41DAC3-0516-481B-91BA-E94510B51DF3"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "CareTend or Documo refused Result"
          },
          "position": {
            "x": 1186,
            "y": 1630
          }
        },
        "flowElementId": "425799A3-0099-4D39-ABB3-DB91DBAF8BE6",
        "groupId": null,
        "id": "E96042BE-E67D-4225-8010-6CB92B572F04",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Refusal",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "CareTend or Documo refused",
        "nextElementIds": [
          "C9F3D2EA-F9CB-495E-B8D3-E60CF013D4C6"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the card for the pharmacist Result"
          },
          "position": {
            "x": 1173,
            "y": 900
          }
        },
        "flowElementId": "113513B9-E532-4038-B5B3-9F0BCEB75AA9",
        "groupId": null,
        "id": "6E28DB1C-3A17-40F4-B86C-DBA90353FD7F",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "check",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "persons",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Prescriber search",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "65D95023-E93F-46AD-8DC9-CE1603C0BB87"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "senderNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "faxCallerId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "faxUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "faxId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "receivedAt",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "createdAt",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pharmacy",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Pharmacy name",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Pharmacy name"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answerLink",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Answer link",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Answer link"
                  }
                ],
                "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": "const s = (v) => String(v == null ? '' : v).replace(/\\s+/g, ' ').trim();\nconst digits = (v) => s(v).replace(/\\D/g, '').replace(/^1(?=\\d{10}$)/, '');\nconst show = (d) => (d.length === 10 ? `(${d.slice(0, 3)}) ${d.slice(3, 6)}-${d.slice(6)}` : d);\nconst link = (params) => `${answerLink}?execution=${encodeURIComponent(executionId)}&${new URLSearchParams(params).toString()}`;\nconst g = check.got || {};\n// Search Persons has no NPI, so a fax number is used only when exactly one person with a fax matches the name.\nconst pool = (check.prescriberLast && persons && persons.result && persons.result.data) || [];\nconst withFax = pool.filter((p) => digits(p.faxNumber));\nconst person = withFax.length === 1 ? withFax[0] : null;\nconst caretendFax = person ? digits(person.faxNumber) : '';\nconst sender = digits(senderNumber);\nconst controlled = check.controlled === 'yes';\nconst recipient = (person ? `${s(person.firstName)} ${s(person.lastName)}` : (g.PRESCRIBER || 'Prescriber')).slice(0, 40);\nconst received = s(receivedAt).slice(0, 10);\nconst need = [...check.missing.map((m) => `- ${m}`), ...check.confirm.map((c) => `- please confirm ${c}`)];\nconst request = [\n  'Information needed for a prescription',\n  '',\n  `To: ${recipient}`,\n  `From: ${pharmacy}`,\n  '',\n  `We received a prescription by fax on ${received} for:`,\n  `Patient: ${g.PATIENT_NAME || '(not legible)'}, date of birth ${g.PATIENT_DOB || '(not legible)'}`,\n  `Medication: ${[g.DRUG, g.STRENGTH].filter(Boolean).join(' ') || '(not legible)'}`,\n  '',\n  'Before we can fill it, we need:',\n  ...need,\n  '',\n  'Please fax back a complete, signed prescription or the missing information. A copy of what we received is attached. Thank you.',\n].join('\\n');\nconst lines = [\n  `*Faxed prescription to check: ${[g.DRUG, g.STRENGTH].filter(Boolean).join(' ') || 'drug not read'} for ${g.PATIENT_NAME || 'a patient whose name was not read'}${g.PATIENT_DOB ? `, born ${g.PATIENT_DOB}` : ''}*`,\n  `Received ${received} from ${sender ? show(sender) : 'an unknown number'}. <${faxUrl}|Open the fax> (Documo message ${faxId}).`,\n  '*What needs a look:*',\n  ...check.issues.map((i) => `• ${i}`),\n  `Textract read: quantity ${g.QUANTITY || '?'}; directions ${g.DIRECTIONS || '?'}; refills ${g.REFILLS || '?'}; prescriber ${g.PRESCRIBER || '?'}, NPI ${g.PRESCRIBER_NPI || '?'}, DEA ${g.DEA || 'none read'}; written ${g.DATE_WRITTEN || '?'}; signatures found: ${check.signatureCount}.`,\n];\nconst buttons = [{ type: 'button', style: 'primary', text: { type: 'plain_text', text: 'File it for Rx review' }, url: link({ decision: 'file' }) }];\nif (controlled) {\n  lines.push(`A controlled substance schedule is printed (${check.schedule}). The flow does not fax the prescriber about it. Please contact the prescriber yourself.`);\n} else {\n  if (person) lines.push(`CareTend has ${recipient}${s(person.organizationName) ? ` at ${s(person.organizationName)}` : ''} with fax ${show(caretendFax)}.`);\n  else lines.push(pool.length > 1 ? 'CareTend has more than one person who could be this prescriber, so no fax number was taken from CareTend.' : 'The prescriber was not found in CareTend with a fax number.');\n  if (sender && caretendFax && sender !== caretendFax) lines.push(`The fax came from ${show(sender)}, which is not the number in CareTend. Check which one to use.`);\n  if (caretendFax || sender) lines.push('The flow can fax the prescriber this request, with a copy of the prescription:', '```' + request + '```');\n  if (caretendFax) buttons.push({ type: 'button', text: { type: 'plain_text', text: `Fax the request to ${show(caretendFax)} (CareTend)` }, url: link({ decision: 'fax', to: 'caretend' }) });\n  if (sender && sender !== caretendFax) buttons.push({ type: 'button', text: { type: 'plain_text', text: `Fax the request to ${show(sender)} (sender)` }, url: link({ decision: 'fax', to: 'sender' }) });\n}\nbuttons.push({ type: 'button', text: { type: 'plain_text', text: \"I'll handle it\" }, url: link({ decision: 'handle' }) });\nconst body = lines.join('\\n');\nconst sections = [];\nfor (let i = 0; i < body.length; i += 2900) sections.push({ type: 'section', text: { type: 'mrkdwn', text: body.slice(i, i + 2900) } });\nreturn { text: `Faxed prescription to check for ${g.PATIENT_NAME || 'a patient'}`, blocks: [...sections, { type: 'actions', elements: buttons }], request, recipient, caretendFax, sender, subject: `Prescription for ${g.PATIENT_NAME || 'your patient'}: info needed`.slice(0, 55) };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Card",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the card for the pharmacist",
        "nextElementIds": [
          "E5D16B2E-9DF4-422D-8D03-02B3C0FE78AA"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels 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:::sendMessageToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the pharmacist: not done Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1187,
            "y": 1491
          }
        },
        "flowElementId": "EDB99BAB-2CF5-41BD-A46E-4AD2E07F8F4F",
        "groupId": null,
        "id": "C9F3D2EA-F9CB-495E-B8D3-E60CF013D4C6",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "*A step failed for the faxed prescription "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check",
                    "subPathSegments": [
                      {
                        "key": "title",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ".* Step: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Refusal",
                    "subPathSegments": [
                      {
                        "key": "source",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E96042BE-E67D-4225-8010-6CB92B572F04"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". The service said: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Refusal",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E96042BE-E67D-4225-8010-6CB92B572F04"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Please file it or fax the prescriber by hand. Documo message "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "."
                  }
                ],
                "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": [],
                "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": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Refusal note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the pharmacist: not done",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Pick the fax number Result"
          },
          "position": {
            "x": 453,
            "y": 1760
          }
        },
        "flowElementId": "947BF33A-9D1A-415D-A114-C027389FC87D",
        "groupId": null,
        "id": "D389B791-9FBC-4741-A108-23695414A7E6",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "card",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "6E28DB1C-3A17-40F4-B86C-DBA90353FD7F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answer",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Pharmacist answer",
                    "subPathSegments": null,
                    "type": "TRIGGER_DATA",
                    "value": "71FCB453-F5EE-4E6D-B3A3-7C284AC8D39A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "check",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const d = answer && answer.to === 'caretend' ? card.caretendFax : (answer && answer.to === 'sender' ? card.sender : '');\nconst shown = d.length === 10 ? `(${d.slice(0, 3)}) ${d.slice(3, 6)}-${d.slice(6)}` : d;\nconst asked = [...(check.missing || []), ...(check.confirm || [])].join('; ');\nreturn { faxNumber: d ? (d.length === 10 ? `+1${d}` : `+${d}`) : '', note: `Held: the intake pharmacist had the flow fax ${card.recipient} at ${shown} on ${new Date().toISOString().slice(0, 10)} for: ${asked}.` };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Request",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Pick the fax number",
        "nextElementIds": [
          "D2E0184F-F66D-4244-B4F5-047016A2B1C7"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Finds people in CareTend, such as prescribers, referral sources and other contacts, by name, organization, type or specialty. Each match carries its phone number, fax number and email address, for example to fax an order status to the referring office. Returns one page of matches with the total count.",
          "elementId": "EXTENSION:::SHARED:::default:::wellsky-caretend:::searchPersons",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the prescriber in CareTend Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::wellsky-caretend:::searchPersons",
          "legacyElementId": null,
          "methodName": "searchPersons",
          "position": {
            "x": 789,
            "y": 891
          }
        },
        "flowElementId": "80132024-5F5B-4FCF-BFB4-7C2BB771C3BE",
        "groupId": null,
        "id": "65D95023-E93F-46AD-8DC9-CE1603C0BB87",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check",
                    "subPathSegments": [
                      {
                        "key": "prescriberLast",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check",
                    "subPathSegments": [
                      {
                        "key": "prescriberFirst",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "middleName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "organizationName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "referralSourcesOnly",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeInactive",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "partyTypeDescription",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "personTypeNames",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "providerSpecialtyNames",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "companyIds",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "partyId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sortDirection",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 10
                  }
                ],
                "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": "searchPersons",
          "onFailElemId": "AB1B91AE-03A6-4144-A15F-3E615E789EDF",
          "packageId": "default",
          "resultAlias": "Prescriber search",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "wellsky-caretend",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the prescriber in CareTend",
        "nextElementIds": [
          "6E28DB1C-3A17-40F4-B86C-DBA90353FD7F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels 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:::sendMessageToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Ask the intake pharmacist Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1198,
            "y": 1061
          }
        },
        "flowElementId": "CF78AC91-E7B5-4D02-B6BA-A7CC7E0E02B1",
        "groupId": null,
        "id": "E5D16B2E-9DF4-422D-8D03-02B3C0FE78AA",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "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": "Card",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6E28DB1C-3A17-40F4-B86C-DBA90353FD7F"
                  }
                ],
                "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": "Card",
                    "subPathSegments": [
                      {
                        "key": "blocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6E28DB1C-3A17-40F4-B86C-DBA90353FD7F"
                  }
                ],
                "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": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Question to pharmacist",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Ask the intake pharmacist",
        "nextElementIds": [
          "71FCB453-F5EE-4E6D-B3A3-7C284AC8D39A"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 784,
            "y": 1070
          }
        },
        "flowElementId": "D0BA5338-FD39-45A3-BEFF-2239869D990D",
        "groupId": null,
        "id": "71FCB453-F5EE-4E6D-B3A3-7C284AC8D39A",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "resultAlias": "Pharmacist answer",
          "slaConditions": [],
          "storeResult": true,
          "type": "CALLBACK"
        },
        "name": "Wait for the pharmacist's answer",
        "nextElementIds": [
          "7BBF0575-28D2-47E5-A9C5-944C14874276"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Fax file": "5f968f5a-f3f1-401b-820c-e41ed85e36fc"
          },
          "position": {
            "x": 118,
            "y": 1070
          }
        },
        "flowElementId": "444F2AF2-1F99-49CF-A7B5-C6F287CDBB0A",
        "groupId": null,
        "id": "8ED59203-A6B4-4E60-8F49-9528C30E6560",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Fax file",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Fresh copy",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "7BBF0575-28D2-47E5-A9C5-944C14874276"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "useFresh",
          "storeResult": true
        },
        "name": "Use the fresh copy",
        "nextElementIds": [
          "E4AE6E31-6827-48A2-A2BF-43C2EC2B26F5"
        ],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 118,
            "y": 1760
          }
        },
        "flowElementId": "A589D6EB-2525-406F-B32B-3ACAC5818832",
        "groupId": null,
        "id": "E4AE6E31-6827-48A2-A2BF-43C2EC2B26F5",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "6db1d95f-025a-44aa-be4a-81c982e76b50",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Pharmacist answer",
                      "subPathSegments": [
                        {
                          "key": "decision",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "71FCB453-F5EE-4E6D-B3A3-7C284AC8D39A"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "fax"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "6db1d95f-025a-44aa-be4a-81c982e76b50"
            ]
          },
          "elseComponent": {
            "componentId": "E94A1862-B3D6-428E-A32B-93B8921F18BA",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cFax",
          "storeResult": false,
          "thenComponent": {
            "componentId": "D389B791-9FBC-4741-A108-23695414A7E6",
            "componentType": "ELEMENT"
          }
        },
        "name": "Fax the prescriber?",
        "nextElementIds": [
          "E94A1862-B3D6-428E-A32B-93B8921F18BA",
          "D389B791-9FBC-4741-A108-23695414A7E6"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Files a received fax (for example a new referral) into CareTend's Incoming Documents grid as a New Fax document, optionally on an Incoming Document Path such as Intake Referrals so the intake team picks it up. The file is downloaded from the URL you give. Returns the new document ID.",
          "elementId": "EXTENSION:::SHARED:::default:::wellsky-caretend:::uploadIncomingFax",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "File it as held in CareTend Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::wellsky-caretend:::uploadIncomingFax",
          "legacyElementId": null,
          "methodName": "uploadIncomingFax",
          "position": {
            "x": 1198,
            "y": 1751
          }
        },
        "flowElementId": "FE6315D6-731A-42E3-8845-9CD2CD4673DD",
        "groupId": null,
        "id": "FE41DAC3-0516-481B-91BA-E94510B51DF3",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Fax file",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Fax file",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Fax file",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "description",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check",
                    "subPathSegments": [
                      {
                        "key": "title",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "companyIds",
              "type": "SIMPLE_LIST",
              "value": [
                {
                  "expression": [
                    {
                      "id": "PLACEHOLDER_DATA",
                      "label": "CareTend company ID",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_STATIC_DATA",
                      "value": "CareTend company ID"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                }
              ]
            },
            {
              "name": "assignmentType",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "assignedEntityId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "workflowGroups",
              "type": "SIMPLE_LIST",
              "value": [
                {
                  "expression": [
                    {
                      "id": "TEXT",
                      "label": null,
                      "type": "INPUT",
                      "value": "spRx"
                    }
                  ],
                  "mode": "BASIC",
                  "parseJsonString": false,
                  "resultType": null
                }
              ]
            },
            {
              "name": "category",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "incomingDocumentPath",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Held prescriptions path",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Held prescriptions path"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "keywords",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "notes",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Request",
                    "subPathSegments": [
                      {
                        "key": "note",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D389B791-9FBC-4741-A108-23695414A7E6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " Faxed from "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "faxCallerId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", Documo message "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "receivedDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "createdAt",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "queueDate",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sentDateTime",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "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": "uploadIncomingFax",
          "onFailElemId": "E96042BE-E67D-4225-8010-6CB92B572F04",
          "packageId": "default",
          "resultAlias": "Held",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "wellsky-caretend",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "File it as held in CareTend",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Textract returned an error Result"
          },
          "position": {
            "x": 734,
            "y": 189
          }
        },
        "flowElementId": "FA639EB0-D05D-43E8-A689-13676C67FBCD",
        "groupId": "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7",
        "id": "634E87CB-9775-4784-B6AE-8108878206ED",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Check error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Textract returned an error",
        "nextElementIds": [
          "3B8ADF7E-98E3-4537-8178-73EB8B1B5179"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 453,
            "y": 770
          }
        },
        "flowElementId": "22584B0C-54DA-43BD-A245-E4C6FE28F098",
        "groupId": null,
        "id": "BA28C65A-24E5-4D1D-B526-F1CEFB069C6E",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "83474adf-8022-4d6f-803e-a50c830bdba0",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Check",
                      "subPathSegments": [
                        {
                          "key": "readable",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "0233615D-6F60-4924-B181-8E78759DB9F6"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "yes"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "83474adf-8022-4d6f-803e-a50c830bdba0"
            ]
          },
          "elseComponent": {
            "componentId": "3120CA13-A556-480D-9128-136677B9D758",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cReadable",
          "storeResult": false,
          "thenComponent": null
        },
        "name": "Could it be read?",
        "nextElementIds": [
          "3120CA13-A556-480D-9128-136677B9D758"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "break-repeat",
          "isFirstElement": false,
          "blockDefinitionId": "break-repeat",
          "position": {
            "x": 1402,
            "y": 189
          }
        },
        "flowElementId": "50DFCA9A-EF7F-4378-A264-E529C0FB153A",
        "groupId": "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7",
        "id": "E42C35CD-A577-4EA0-9D47-DB5765ADE065",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "brk2",
          "storeResult": true
        },
        "name": "Stop reading",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "BREAK"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "16b8c678-7490-43f7-b644-071f4164b2d9",
            "Reading error": "604bd5b0-c64e-476c-8fbe-8cceae0d6e69"
          },
          "position": {
            "x": 1088,
            "y": 189
          }
        },
        "flowElementId": "C9A68BB5-BCA7-4F9A-931B-5865182CD16D",
        "groupId": "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7",
        "id": "3B8ADF7E-98E3-4537-8178-73EB8B1B5179",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Reading done",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "yes"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "Reading error",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Check error",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "634E87CB-9775-4784-B6AE-8108878206ED"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "stopErr",
          "storeResult": true
        },
        "name": "Keep the error",
        "nextElementIds": [
          "E42C35CD-A577-4EA0-9D47-DB5765ADE065"
        ],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      }
    ],
    "firstElementId": "16DC185E-D4DD-42EC-B009-5BBBF79AFEB0",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "repeat",
          "isFirstElement": false,
          "blockDefinitionId": "repeat",
          "viewport": {
            "x": -57.96437659033079,
            "y": -4.529262086513995,
            "zoom": 0.89
          },
          "position": {
            "x": 1199,
            "y": 340
          }
        },
        "flowElementId": "445EE624-8888-476A-A5AE-891AAC607C74",
        "groupId": null,
        "id": "9CE6CF55-5240-437D-A9CA-5CA7AF263BD7",
        "loopType": "REPEAT",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "fba9903d-bbf4-4840-aff4-e0f71e010a98",
                "nestedOperation": null,
                "operation": "notEqual",
                "property": {
                  "expression": [
                    {
                      "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                      "label": "Default - Reading done",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_PATH",
                      "value": "executionContext.dataBuckets.Default.Reading done",
                      "valueSegments": [
                        {
                          "key": "executionContext",
                          "optional": false
                        },
                        {
                          "key": "dataBuckets",
                          "optional": false
                        },
                        {
                          "key": "Default",
                          "optional": false
                        },
                        {
                          "key": "Reading done",
                          "optional": false
                        }
                      ]
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "yes"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "fba9903d-bbf4-4840-aff4-e0f71e010a98"
            ]
          },
          "enabled": true,
          "firstElementId": "320F5DE3-B280-4900-BD02-642322AE175D",
          "maxIterations": 90,
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "Wait for Textract to finish",
        "nextElementIds": [
          "0865B851-0517-4480-8749-60808E2246EE"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "BF161CC1-962C-4CF7-8621-AF59F84CF385",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": null,
        "valid": true
      },
      "errorMessage": null,
      "executionStaticData": [
        {
          "description": "An answer or signature Textract read with less confidence than this (0 to 100) goes to the intake pharmacist.",
          "error": null,
          "name": "Confidence floor",
          "type": "INT",
          "value": ""
        },
        {
          "description": "The ID of your CareTend company (pharmacy) that filed prescriptions belong to.",
          "error": null,
          "name": "CareTend company ID",
          "type": "INT",
          "value": ""
        },
        {
          "description": "The CareTend Incoming Document Path where signed, complete prescriptions wait for Rx review.",
          "error": null,
          "name": "Rx review path",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The CareTend Incoming Document Path for prescriptions held while the prescriber is asked for what is missing.",
          "error": null,
          "name": "Held prescriptions path",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "Your pharmacy's name, printed on the fax to the prescriber.",
          "error": null,
          "name": "Pharmacy name",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The URL of the block Wait for the pharmacist's answer. The Slack buttons open it.",
          "error": null,
          "name": "Answer link",
          "type": "STRING",
          "value": ""
        }
      ],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-12-03T04:14:18.740Z"
}
