{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "91F34BE1-6E65-4638-9F2A-EA6E1C2B3105",
    "name": "AWS Textract: fill history checked in Healthie"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -4,
        "y": 24,
        "zoom": 0.4
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a pharmacy faxes a fill history to the Phaxio line, Textract reads every page and an AI step lines up each fill as printed. The patient is matched in Healthie on name and birth date, and a near, double or missing match goes to the intake coordinator in Slack. The fax is filed on the chart, the fills are compared with the Healthie medication list, and the medications not on the chart go to the patient's prescriber in Slack. Only the medications the prescriber confirms are added with Add Medication.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "Reads each pharmacy fill history faxed to the Phaxio line with Textract, matches the Healthie patient on name and birth date, compares every fill with the Healthie medication list and asks the prescriber in Slack which missing medications to add before anything is recorded.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "eb0121a1-0052-4c0e-b6ee-d2392720b2de",
            "Textract result": "f547edd4-821d-4751-8c03-b7eaec5fe54d"
          },
          "position": {
            "x": 1073,
            "y": 339
          }
        },
        "flowElementId": "0BEDADAD-38DB-473B-B18F-0706FEB7386F",
        "groupId": "55C6A403-141A-4B3A-B9CF-A5B0B85C8877",
        "id": "D4A19E52-D9B2-4AD8-B495-33391D498459",
        "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": "BA6C5659-78DE-4D20-8F92-7C7554D0EE5A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "keep",
          "storeResult": true
        },
        "name": "Keep what Textract read",
        "nextElementIds": [
          "A3ED5249-88D7-48A6-A7BD-8EA36CA9AFE7"
        ],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Gather what Textract read Result"
          },
          "position": {
            "x": 110,
            "y": 219
          }
        },
        "flowElementId": "A5A99FA2-3097-4FD7-93CD-C684C61BBE32",
        "groupId": null,
        "id": "AB8EF9BF-F4EF-43F3-AF70-6A1369F14BF6",
        "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": "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
              }
            },
            {
              "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 byId = new Map(blocks.map((b) => [b.Id, b]));\nconst words = (b) => ((b && b.Relationships) || []).filter((r) => r.Type === 'CHILD').flatMap((r) => r.Ids || []).map((id) => byId.get(id)).filter((c) => c && c.BlockType === 'WORD');\nconst floor = Number(confidenceFloor) || 90;\nconst unsureCells = [];\nfor (const b of blocks) {\n  if (b.BlockType !== 'CELL') continue;\n  const w = words(b);\n  const text = w.map((x) => x.Text).join(' ').trim();\n  if (!text) continue;\n  const confidence = Math.min(...w.map((x) => (typeof x.Confidence === 'number' ? x.Confidence : 100)));\n  if (confidence < floor) unsureCells.push({ text, page: b.Page || 1, confidence: Math.round(confidence) });\n}\nconst clean = (c) => String(c == null ? '' : c).replace(/\\s+/g, ' ').trim();\nconst tables = (Array.isArray(a.tables) ? a.tables : []).map((t) => (Array.isArray(t.rows) ? t.rows : []).map((r) => (Array.isArray(r) ? r : []).map(clean)));\nconst tablesText = tables.map((rows, i) => `Table ${i + 1}\\n` + rows.map((r) => r.join(' | ')).join('\\n')).join('\\n\\n') || '(no tables found)';\nconst linesText = blocks.filter((b) => b.BlockType === 'LINE').map((b) => `p${b.Page || 1}: ${clean(b.Text)}`).join('\\n').slice(0, 20000);\nconst queries = a.queries || {};\nconst queriesText = Object.keys(queries).map((k) => `${k}: ${queries[k] == null ? '(no answer)' : queries[k]}`).join('\\n');\nconst unsureText = unsureCells.length ? unsureCells.map((c) => `\"${c.text}\" on page ${c.page} (${c.confidence}%)`).join('\\n') : 'none';\nconst status = a.jobStatus || '';\nconst chars = blocks.filter((b) => b.BlockType === 'WORD').map((b) => String(b.Text || '')).join('').replace(/\\s/g, '').length;\nconst err = clean(readingError) === 'none' ? '' : clean(readingError);\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 < 80) 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, chars, tableCount: tables.length, tablesText, linesText, queriesText, unsureCells, unsureText };\n"
              }
            ],
            "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": [
          "3622A67F-6DD2-4C46-8F9D-8BFDB500ED67"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "a3872d95-9b5f-4622-b51a-da68f352b941",
            "Textract result": "0f26c183-95a3-44bc-8c17-c236120aa746",
            "Reading error": "4d1cb224-cbc2-4424-93db-535a12821934"
          },
          "position": {
            "x": 918,
            "y": 219
          }
        },
        "flowElementId": "967F11A4-648C-4107-8494-5DD18E5A517A",
        "groupId": null,
        "id": "85BEB338-BABD-40C2-8370-F5896B15328A",
        "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": "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": [
          "55C6A403-141A-4B3A-B9CF-A5B0B85C8877"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "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 intake: fax not read Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1678,
            "y": 510
          }
        },
        "flowElementId": "5B8B64D6-D778-408F-A158-9FCCE1D9FCF3",
        "groupId": null,
        "id": "209CBCAA-F4A3-405B-8D5A-71F5075358BA",
        "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 Phaxio line could not be read.* It came from "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "from_number",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "caller_name",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " with "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "num_pages",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " pages (Phaxio fax ID "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "). "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "fileError",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Read",
                    "subPathSegments": [
                      {
                        "key": "problem",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "AB8EF9BF-F4EF-43F3-AF70-6A1369F14BF6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Textract error",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "091610A0-D219-4ABE-B545-C400C15E8746"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "\nIf it is a pharmacy fill history, please check it against the chart by hand. Nothing was added to any chart. "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  }
                ],
                "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": "Intake note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell intake: fax not read",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "wait",
          "isFirstElement": true,
          "blockDefinitionId": "wait",
          "mode": "SIMPLE",
          "position": {
            "x": 110,
            "y": 339
          }
        },
        "flowElementId": "EFC07E71-9E74-428F-AFFA-B5EAD10949E2",
        "groupId": "55C6A403-141A-4B3A-B9CF-A5B0B85C8877",
        "id": "3B145B35-728B-4C26-A774-2CB25AFD72D1",
        "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": [
          "BA6C5659-78DE-4D20-8F92-7C7554D0EE5A"
        ],
        "nextGroupIds": [],
        "type": "WAIT"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 130,
            "y": 779
          }
        },
        "flowElementId": "433DEEE3-0F05-4BB0-8C6C-666C12D8B3B8",
        "groupId": null,
        "id": "3622A67F-6DD2-4C46-8F9D-8BFDB500ED67",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "b30b9855-c91f-4973-9d6c-886b98ddd1ea",
                "nestedOperation": null,
                "operation": "isEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Read",
                      "subPathSegments": [
                        {
                          "key": "problem",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "AB8EF9BF-F4EF-43F3-AF70-6A1369F14BF6"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "b30b9855-c91f-4973-9d6c-886b98ddd1ea"
            ]
          },
          "elseComponent": {
            "componentId": "209CBCAA-F4A3-405B-8D5A-71F5075358BA",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cPages",
          "storeResult": false,
          "thenComponent": {
            "componentId": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE",
            "componentType": "ELEMENT"
          }
        },
        "name": "Read every page?",
        "nextElementIds": [
          "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE",
          "209CBCAA-F4A3-405B-8D5A-71F5075358BA"
        ],
        "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": 330
          }
        },
        "flowElementId": "C9B2B61B-D2CA-439E-94EB-C11EB8FF4AD9",
        "groupId": "55C6A403-141A-4B3A-B9CF-A5B0B85C8877",
        "id": "BA6C5659-78DE-4D20-8F92-7C7554D0EE5A",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "jobId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Job",
                    "subPathSegments": [
                      {
                        "key": "jobId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "2B02CF8B-DF4C-48FE-AEE8-C647D58812AB"
                  }
                ],
                "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": "8BF06B55-04FA-4104-8E7B-309E224A84D1",
          "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": [
          "2C183BC8-7098-49A2-8D7E-68065394F8B9"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 754,
            "y": 339
          }
        },
        "flowElementId": "C1E0DDCC-7500-4313-ADB9-414C6E5A8485",
        "groupId": "55C6A403-141A-4B3A-B9CF-A5B0B85C8877",
        "id": "2C183BC8-7098-49A2-8D7E-68065394F8B9",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "192705f0-3e35-479f-a898-faa06d055ec7",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Analysis",
                      "subPathSegments": [
                        {
                          "key": "jobStatus",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "BA6C5659-78DE-4D20-8F92-7C7554D0EE5A"
                    }
                  ],
                  "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": [
              "192705f0-3e35-479f-a898-faa06d055ec7"
            ]
          },
          "elseComponent": {
            "componentId": "D4A19E52-D9B2-4AD8-B495-33391D498459",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "still",
          "storeResult": false,
          "thenComponent": null
        },
        "name": "Still reading?",
        "nextElementIds": [
          "D4A19E52-D9B2-4AD8-B495-33391D498459"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "break-repeat",
          "isFirstElement": false,
          "blockDefinitionId": "break-repeat",
          "position": {
            "x": 1402,
            "y": 339
          }
        },
        "flowElementId": "D761FC87-A29A-44C5-9F55-B395D2255C87",
        "groupId": "55C6A403-141A-4B3A-B9CF-A5B0B85C8877",
        "id": "A3ED5249-88D7-48A6-A7BD-8EA36CA9AFE7",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "done",
          "storeResult": true
        },
        "name": "Done reading",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "BREAK"
      },
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": false,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the fill history Result"
          },
          "tools": {},
          "position": {
            "x": 509,
            "y": 779
          }
        },
        "flowElementId": "7CBEFBEC-2382-4C8F-B1DE-82E0CEC18B2C",
        "groupId": null,
        "id": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE",
        "metaInfo": {
          "aiApiKey": null,
          "aiModel": "claude-sonnet-5",
          "aiProvider": "ANTHROPIC",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "dynamicAiApiKey": {
            "expression": [
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Anthropic key",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Anthropic key"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "files": [],
          "forceParsedOutput": true,
          "langSmithSettings": {
            "enabled": false,
            "apiKey": null,
            "projectName": null,
            "label": "FlowRunner AI-Agent",
            "accountCluster": "US"
          },
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "messagesHistoryEnabled": false,
          "messagesHistoryLimit": 15,
          "onFailElemId": "E063D967-0D96-4E47-9368-7AE36294D213",
          "resultAlias": "History",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "You arrange a pharmacy fill history that Amazon Textract has already read from a fax. A fill history is a pharmacy's list of the prescriptions it filled for one patient; pharmacies also call it a medication history, dispensing history or patient profile. You get Textract's answers to questions about the document, every table it found row by row with cells separated by |, the plain lines of text, and the cells Textract was unsure of. Reply with JSON only, with these fields:\nreadable: false when the text is too sparse, garbled or cut off to tell what the document is or to read its rows; otherwise true\nisFillHistory: true if the document is a pharmacy fill history that can be read; false for anything else, such as a refill request, a clarification, a prior auth request, a prescription, a lab result or a cover sheet, and false when readable is false\npatientFirstName, patientLastName: the patient's names as printed\npatientDateOfBirth: the patient's date of birth as YYYY-MM-DD, or empty text if it is not printed\npharmacyName, pharmacyPhone: the pharmacy that sent it, as printed, or empty text\nfills: one entry per fill row, in the order printed, each with drug (the drug name as printed, without the strength), strength (as printed, such as 20 mg), form (tablet, capsule, solution and so on, or empty text), quantity, daysSupply, directions (the sig as printed, or empty text), fillDate (as YYYY-MM-DD, or as printed when it is unclear), prescriber (as printed), pharmacy (as printed, or the sending pharmacy), unsure (true when any cell of the row is in the list of cells Textract was unsure of)\nRules: copy everything exactly as Textract gives it. Use the tables first and the lines of text only for rows that are not in a table. Never correct a drug name, strength, quantity or date, never convert units, never add a fill that is not printed, and never say whether a medication is right for the patient. Leave out header rows, totals, notes and footers."
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "A fax came in on the Phaxio line from "
              },
              {
                "id": "RESULT",
                "label": "Fax",
                "subPathSegments": [
                  {
                    "key": "from_number",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": " "
              },
              {
                "id": "RESULT",
                "label": "Fax",
                "subPathSegments": [
                  {
                    "key": "caller_name",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ". Textract read "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Read",
                "subPathSegments": [
                  {
                    "key": "pages",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "AB8EF9BF-F4EF-43F3-AF70-6A1369F14BF6"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": " pages.\n\nAnswers to questions about the document:\n"
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Read",
                "subPathSegments": [
                  {
                    "key": "queriesText",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "AB8EF9BF-F4EF-43F3-AF70-6A1369F14BF6"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\n\nTables, row by row:\n"
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Read",
                "subPathSegments": [
                  {
                    "key": "tablesText",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "AB8EF9BF-F4EF-43F3-AF70-6A1369F14BF6"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\n\nLines of text:\n"
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Read",
                "subPathSegments": [
                  {
                    "key": "linesText",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "AB8EF9BF-F4EF-43F3-AF70-6A1369F14BF6"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\n\nCells Textract was unsure of:\n"
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Read",
                "subPathSegments": [
                  {
                    "key": "unsureText",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "AB8EF9BF-F4EF-43F3-AF70-6A1369F14BF6"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Read the fill history",
        "nextElementIds": [
          "4AF33C62-6493-4A73-8EB7-1AF3EF94240E"
        ],
        "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": 907,
            "y": 349
          }
        },
        "flowElementId": "73423CB6-ECD4-4793-9B15-964C18AAFB08",
        "groupId": null,
        "id": "091610A0-D219-4ABE-B545-C400C15E8746",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Textract error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Textract could not start",
        "nextElementIds": [
          "209CBCAA-F4A3-405B-8D5A-71F5075358BA"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "notes": "Fires once for each fax the account receives, after Phaxio has finished receiving it. The event carries the fax record (ID, sender number and name, receiving number, page count, creation and completion times) and its PDF, downloaded and saved to FlowRunner file storage at workspace scope (a poll runs outside a flow execution), returned in \"file\" with the saved file's URL, name, content type and size. When the PDF cannot be downloaded (for example because the account does not keep fax files), the event still fires, with \"file\" empty and the reason in \"fileError\". Optionally only fires for faxes sent to the chosen receiving numbers. Faxes that failed to arrive are skipped. The first poll only records the faxes already there; faxes arriving after it are emitted.",
          "elementId": "EXTENSION:::SHARED:::default:::phaxio:::onNewInboundFax",
          "isFirstElement": true,
          "blockDefinitionId": "EXTENSION:::SHARED:::default:::phaxio:::onNewInboundFax",
          "newElementId": "EXTENSION:::SHARED:::default:::phaxio:::onNewInboundFax",
          "legacyElementId": "JS###v1###Phaxio###onNewInboundFax",
          "methodName": "onNewInboundFax",
          "position": {
            "x": 1689,
            "y": 40
          }
        },
        "flowElementId": "4DEA233D-BD61-4246-86F3-E09E00171FBD",
        "groupId": null,
        "id": "7328738B-DB38-4BB0-91BB-E59F08F3D176",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "connectionId": null,
          "dynamicData": [],
          "eventName": "onNewInboundFax",
          "frequency": {
            "repeat": {
              "every": 300
            },
            "schedule": "custom"
          },
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Fax",
          "serviceId": "phaxio",
          "slaConditions": [],
          "staticData": {},
          "storeResult": true,
          "subtype": "POLLING",
          "type": "CUSTOM"
        },
        "name": "New fax on Phaxio",
        "nextElementIds": [
          "7989CD53-4628-437E-A71B-7A088BEA9995"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "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 every page Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::aws-textract:::startDocumentAnalysis",
          "legacyElementId": "JS###v1###Textract###startDocumentAnalysis",
          "methodName": "startDocumentAnalysis",
          "position": {
            "x": 1302,
            "y": 210
          }
        },
        "flowElementId": "959C3EA9-8D14-4072-8156-7284409CC5EA",
        "groupId": null,
        "id": "2B02CF8B-DF4C-48FE-AEE8-C647D58812AB",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "featureTypes",
              "type": "SIMPLE_LIST",
              "value": [
                {
                  "expression": [
                    {
                      "id": "TEXT",
                      "label": null,
                      "type": "INPUT",
                      "value": "TABLES"
                    }
                  ],
                  "mode": "BASIC",
                  "parseJsonString": false,
                  "resultType": null
                },
                {
                  "expression": [
                    {
                      "id": "TEXT",
                      "label": null,
                      "type": "INPUT",
                      "value": "QUERIES"
                    }
                  ],
                  "mode": "BASIC",
                  "parseJsonString": false,
                  "resultType": null
                }
              ]
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  }
                ],
                "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": "Which pharmacy sent this report?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "PHARMACY"
                          }
                        ],
                        "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 pharmacy's phone number?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "PHARMACY_PHONE"
                          }
                        ],
                        "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 title of this report?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "REPORT_TITLE"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "What date range does this report cover?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "DATE_RANGE"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                }
              ]
            },
            {
              "name": "clientRequestToken",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "phaxio-"
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "jobTag",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "fill-history"
                  }
                ],
                "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": "091610A0-D219-4ABE-B545-C400C15E8746",
          "packageId": "default",
          "resultAlias": "Job",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "aws-textract",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Start reading every page",
        "nextElementIds": [
          "85BEB338-BABD-40C2-8370-F5896B15328A"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1689,
            "y": 219
          }
        },
        "flowElementId": "2150A08F-F726-4A42-9525-C5952E58C57B",
        "groupId": null,
        "id": "7989CD53-4628-437E-A71B-7A088BEA9995",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "d9b98638-4041-4c40-9b31-8a5ff1cb1ce8",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Fax",
                      "subPathSegments": [
                        {
                          "key": "file",
                          "optional": false
                        },
                        {
                          "key": "fileUrl",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "d9b98638-4041-4c40-9b31-8a5ff1cb1ce8"
            ]
          },
          "elseComponent": {
            "componentId": "209CBCAA-F4A3-405B-8D5A-71F5075358BA",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cFile",
          "storeResult": false,
          "thenComponent": {
            "componentId": "2B02CF8B-DF4C-48FE-AEE8-C647D58812AB",
            "componentType": "ELEMENT"
          }
        },
        "name": "Fax PDF saved?",
        "nextElementIds": [
          "209CBCAA-F4A3-405B-8D5A-71F5075358BA",
          "2B02CF8B-DF4C-48FE-AEE8-C647D58812AB"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 918,
            "y": 779
          }
        },
        "flowElementId": "55479456-EE8B-47E0-A539-B865FDAADE98",
        "groupId": null,
        "id": "4AF33C62-6493-4A73-8EB7-1AF3EF94240E",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "77c4e917-6e9b-45d1-a30f-53c228e386b4",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "History",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "isFillHistory",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "77c4e917-6e9b-45d1-a30f-53c228e386b4"
            ]
          },
          "elseComponent": {
            "componentId": "6A2F805C-61D9-4BFF-97BC-37C333DF5382",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cHistory",
          "storeResult": false,
          "thenComponent": {
            "componentId": "8B9CC133-0069-4E1F-A2E0-7AC3AF8885AF",
            "componentType": "ELEMENT"
          }
        },
        "name": "Fill history?",
        "nextElementIds": [
          "8B9CC133-0069-4E1F-A2E0-7AC3AF8885AF",
          "6A2F805C-61D9-4BFF-97BC-37C333DF5382"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1689,
            "y": 949
          }
        },
        "flowElementId": "47FDE2DC-CF39-4C63-8917-EA24E93FBEA3",
        "groupId": null,
        "id": "FC44367F-032A-46F5-8603-9471CD172648",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "8963edef-2f09-4ce7-a689-b872cb6dc5d0",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Match",
                      "subPathSegments": [
                        {
                          "key": "exact",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "D09A4CE9-3FDF-4361-AEAF-FF3FAAA2F585"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "8963edef-2f09-4ce7-a689-b872cb6dc5d0"
            ]
          },
          "elseComponent": {
            "componentId": "009AD397-39A1-48B2-9668-86F02BA5CEBD",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cMatch",
          "storeResult": false,
          "thenComponent": {
            "componentId": "10D065E2-9B7E-401C-B116-3A0A5010B8EE",
            "componentType": "ELEMENT"
          }
        },
        "name": "One clear match?",
        "nextElementIds": [
          "009AD397-39A1-48B2-9668-86F02BA5CEBD",
          "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the question for the coordinator Result"
          },
          "position": {
            "x": 450,
            "y": 1119
          }
        },
        "flowElementId": "0527DF14-8E59-4C35-A899-52262B3467E6",
        "groupId": null,
        "id": "890BF7E3-C82E-4488-ABEC-E358D5D55605",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "match",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Match",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "D09A4CE9-3FDF-4361-AEAF-FF3FAAA2F585"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "exactSearch",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exact search",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "8B9CC133-0069-4E1F-A2E0-7AC3AF8885AF"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "byLast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "By last name",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "009AD397-39A1-48B2-9668-86F02BA5CEBD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "byFirst",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "By first name",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "7940B407-D8C6-4995-92A8-315E5AACA8A2"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "byName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "By name",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "1117C1BD-B3D6-4793-A6AA-BED34C214583"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "first",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientFirstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "last",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dob",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sender",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "pharmacyName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "faxUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "faxId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  }
                ],
                "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 chartLink = 'https://secure.gethealthie.com/users/';\nconst fmt = (d) => { const m = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(d || ''); return m ? `${m[2]}/${m[3]}/${m[1]}` : (d || 'not given'); };\nconst link = (params) => `${answerLink}?execution=${encodeURIComponent(executionId)}&${new URLSearchParams(params).toString()}`;\nconst found = new Map();\nconst add = (result, why) => {\n  for (const p of (result && result.patients) || []) {\n    if (!p || !p.id) continue;\n    const id = String(p.id);\n    const c = found.get(id) || { id, name: p.full_name || [p.first_name, p.last_name].filter(Boolean).join(' '), dob: String(p.dob || '').slice(0, 10), providerId: p.dietitian_id ? String(p.dietitian_id) : '', reasons: [] };\n    if (!c.reasons.includes(why)) c.reasons.push(why);\n    found.set(id, c);\n  }\n};\n// A search with an empty term matches far more widely, so only count a search the fax gave every term for.\nif (first && last && dob) add(exactSearch, 'same name and birth date');\nif (last && dob) add(byLast, 'same last name and birth date');\nif (first && dob) add(byFirst, 'same first name and birth date');\nif (first && last) add(byName, 'same first and last name');\nconst candidates = [...found.values()].sort((a, b) => b.reasons.length - a.reasons.length).slice(0, 5);\nconst name = [first, last].filter(Boolean).join(' ') || 'an unnamed patient';\nconst lines = [`*Pharmacy fill history for ${name}, born ${fmt(dob)}*, from ${sender || 'an unknown pharmacy'}.`, (match && match.reason) || 'No single chart matches.'];\nlines.push(candidates.length ? 'Charts that may be this patient:' : 'No chart in Healthie comes close. The flow never creates a patient from a fill history, so this one needs to be handled by hand.');\nfor (const c of candidates) lines.push(`• <${chartLink}${c.id}|${c.name}>, born ${fmt(c.dob)}: ${c.reasons.join(', ')}`);\nlines.push(`<${faxUrl}|Open the fax> (Phaxio fax ID ${faxId}). Nothing is filed or compared until you pick a chart.`);\nconst buttons = candidates.map((c, i) => ({ type: 'button', ...(i === 0 ? { style: 'primary' } : {}), text: { type: 'plain_text', text: `It is ${c.name}'s chart`.slice(0, 75) }, url: link({ decision: 'chart', patient: c.id }) }));\nbuttons.push({ type: 'button', text: { type: 'plain_text', text: candidates.length ? \"None of these, I'll handle it\" : \"I'll handle it by hand\" }, url: link({ decision: 'none' }) });\nreturn { text: `Fill history for ${name}: which Healthie chart?`, blocks: [{ type: 'section', text: { type: 'mrkdwn', text: lines.join('\\n').slice(0, 2900) } }, { type: 'actions', elements: buttons }], candidates };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Question",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the question for the coordinator",
        "nextElementIds": [
          "62F11C51-F06C-4766-B9CE-A231C17C4F59"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Lists the medications on a patient's Healthie chart: name, dosage, directions, frequency, route, dates and whether each is active.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::listMedications",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get the Healthie medication list Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::listMedications",
          "legacyElementId": null,
          "methodName": "listMedications",
          "position": {
            "x": 472,
            "y": 1280
          }
        },
        "flowElementId": "D68C439C-CD53-483B-82F7-2E957ED180ED",
        "groupId": null,
        "id": "9DC50595-5F53-42A7-8D52-D705883806E9",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "activeOnly",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 100
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "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": "listMedications",
          "onFailElemId": "EC0806B4-F20A-444F-803D-AD755A736F2D",
          "packageId": "default",
          "resultAlias": "Chart meds",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get the Healthie medication list",
        "nextElementIds": [
          "F388F184-76D5-4CE3-AE73-1DCD52EA6C28"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Looks for existing patients by first name, last name, date of birth and email, optionally narrowed by phone number, so an incoming referral is matched to the right chart before a new patient is created. Every term you fill in must match. Healthie does not search by phone number itself, so give at least one other term with it.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the patient in Healthie Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 1295,
            "y": 770
          }
        },
        "flowElementId": "4469BFE1-D8D3-444D-8456-5E67FB60445F",
        "groupId": null,
        "id": "8B9CC133-0069-4E1F-A2E0-7AC3AF8885AF",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientFirstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phoneNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 25
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "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": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Exact search",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the patient in Healthie",
        "nextElementIds": [
          "D09A4CE9-3FDF-4361-AEAF-FF3FAAA2F585"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Downloads a file, such as a faxed or emailed referral PDF, and files it as a document on the patient's Healthie chart, optionally in a folder and shared with the patient. Healthie has no document type list, so use the description and the folder to say what it is.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::uploadDocument",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "File the fill history on the chart Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::uploadDocument",
          "legacyElementId": null,
          "methodName": "uploadDocument",
          "position": {
            "x": 885,
            "y": 1280
          }
        },
        "flowElementId": "FF611AE1-8910-42E0-8892-509A2CE80034",
        "groupId": null,
        "id": "DFB48814-AEE5-43F3-B755-5D0C99FEF214",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Fresh copy",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C37E8D65-9DD5-4847-AAC4-10069CE2043A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "displayName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "description",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Pharmacy fill history from "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "pharmacyName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", faxed "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "created_at",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "folderId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeInCharting",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "shareWithPatient",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "uploadDocument",
          "onFailElemId": "EC0806B4-F20A-444F-803D-AD755A736F2D",
          "packageId": "default",
          "resultAlias": "Filed",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "File the fill history on the chart",
        "nextElementIds": [
          "9DC50595-5F53-42A7-8D52-D705883806E9"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Healthie refused Result"
          },
          "position": {
            "x": 898,
            "y": 2019
          }
        },
        "flowElementId": "F4B7FF17-DAA1-4A23-B9C2-0E47E595D8F7",
        "groupId": null,
        "id": "EC0806B4-F20A-444F-803D-AD755A736F2D",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Healthie error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Healthie or Phaxio refused",
        "nextElementIds": [
          "CDAB63E9-C8F2-4BDA-8E17-7FE6559E22AC"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 1272,
            "y": 1119
          }
        },
        "flowElementId": "A88F9703-B05A-4245-A35F-C81E92BE1C6D",
        "groupId": null,
        "id": "4EC8AE20-DFB9-4D7D-B5CF-511D454963DE",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "resultAlias": "Coordinator answer",
          "slaConditions": [],
          "storeResult": true,
          "type": "CALLBACK"
        },
        "name": "Wait for the coordinator's answer",
        "nextElementIds": [
          "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Looks for existing patients by first name, last name, date of birth and email, optionally narrowed by phone number, so an incoming referral is matched to the right chart before a new patient is created. Every term you fill in must match. Healthie does not search by phone number itself, so give at least one other term with it.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Search by last name and birth date Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 1268,
            "y": 940
          }
        },
        "flowElementId": "59C6EB8B-5535-4ABB-ADBB-6F475E670DBF",
        "groupId": null,
        "id": "009AD397-39A1-48B2-9668-86F02BA5CEBD",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phoneNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 25
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "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": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "By last name",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by last name and birth date",
        "nextElementIds": [
          "7940B407-D8C6-4995-92A8-315E5AACA8A2"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1689,
            "y": 1289
          }
        },
        "flowElementId": "B476ADE3-D23C-4971-8431-7EB2012FEA53",
        "groupId": null,
        "id": "0A593336-3B0B-4A75-AF6D-149782F7CE6D",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "bb477f9e-1e3f-4ba9-a979-dedbe251c3d4",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Chart",
                      "subPathSegments": [
                        {
                          "key": "patientId",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "bb477f9e-1e3f-4ba9-a979-dedbe251c3d4"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cPicked",
          "storeResult": false,
          "thenComponent": {
            "componentId": "C37E8D65-9DD5-4847-AAC4-10069CE2043A",
            "componentType": "ELEMENT"
          }
        },
        "name": "Chart picked?",
        "nextElementIds": [
          "C37E8D65-9DD5-4847-AAC4-10069CE2043A"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": false,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Compare with the chart Result"
          },
          "tools": {},
          "position": {
            "x": 499,
            "y": 1849
          }
        },
        "flowElementId": "17C209AE-DF7B-471F-BEF8-356EFD266CB5",
        "groupId": null,
        "id": "F388F184-76D5-4CE3-AE73-1DCD52EA6C28",
        "metaInfo": {
          "aiApiKey": null,
          "aiModel": "claude-sonnet-5",
          "aiProvider": "ANTHROPIC",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "dynamicAiApiKey": {
            "expression": [
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Anthropic key",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Anthropic key"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "files": [],
          "forceParsedOutput": true,
          "langSmithSettings": {
            "enabled": false,
            "apiKey": null,
            "projectName": null,
            "label": "FlowRunner AI-Agent",
            "accountCluster": "US"
          },
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "messagesHistoryEnabled": false,
          "messagesHistoryLimit": 15,
          "onFailElemId": "E063D967-0D96-4E47-9368-7AE36294D213",
          "resultAlias": "Compare",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "You compare the fills on a pharmacy fill history with the medications on the patient's Healthie chart, so the prescriber can decide which ones to add. You get the fills read from the fax and the chart's current medications as JSON. Reply with JSON only, with these fields:\nnotOnChart: one entry per medication in the fills that the chart does not list at the same strength. Combine repeated fills of the same drug and strength into one entry. Each entry has name (the drug, strength and form as printed, such as Lisinopril 20 mg tablet), drug, strength, quantity and daysSupply (from the latest fill), directions (as printed), lastFillDate, fillCount, prescriber, pharmacy, unsure (true if any of its rows was unsure) and chartNote (empty text, or a short note naming the chart entry when the chart has the same drug at another strength or something that looks similar)\nonChart: one entry per drug in the fills that the chart already lists at the same strength, each with drug (as printed in the fills) and chartMedication (the chart's name for it)\nRules: a brand and its generic with the same active ingredient and strength count as the same medication. When you are not sure two entries are the same medication, put it in notOnChart with a chartNote. Copy names, strengths, quantities, dates and directions exactly as printed in the fills. Never leave out a fill, never judge whether a medication is right for the patient, and never suggest a dose."
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "Fills read from the fax sent by "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "History",
                "subPathSegments": [
                  {
                    "key": "output",
                    "optional": false
                  },
                  {
                    "key": "pharmacyName",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ":\n"
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "History",
                "subPathSegments": [
                  {
                    "key": "output",
                    "optional": false
                  },
                  {
                    "key": "fills",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\n\nCurrent medications on the Healthie chart:\n"
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Chart meds",
                "subPathSegments": [
                  {
                    "key": "medications",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "9DC50595-5F53-42A7-8D52-D705883806E9"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Compare with the chart",
        "nextElementIds": [
          "D247FD33-C846-469C-AB91-D589F6283345"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Looks for existing patients by first name, last name, date of birth and email, optionally narrowed by phone number, so an incoming referral is matched to the right chart before a new patient is created. Every term you fill in must match. Healthie does not search by phone number itself, so give at least one other term with it.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Search by name without birth date Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 462,
            "y": 940
          }
        },
        "flowElementId": "18A177F3-BB05-4D7A-BD30-73582A25C63F",
        "groupId": null,
        "id": "1117C1BD-B3D6-4793-A6AA-BED34C214583",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientFirstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phoneNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 25
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "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": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "By name",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by name without birth date",
        "nextElementIds": [
          "890BF7E3-C82E-4488-ABEC-E358D5D55605"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check the match Result"
          },
          "position": {
            "x": 1689,
            "y": 779
          }
        },
        "flowElementId": "B195FF56-7F15-4FFF-8F69-77ED24BE4E0D",
        "groupId": null,
        "id": "D09A4CE9-3FDF-4361-AEAF-FF3FAAA2F585",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exact search",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "8B9CC133-0069-4E1F-A2E0-7AC3AF8885AF"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "first",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientFirstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "last",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dob",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const norm = (s) => String(s || '').toLowerCase().replace(/[^a-z]/g, '');\nconst day = (d) => String(d || '').slice(0, 10);\nconst patients = (search && search.patients) || [];\nconst same = dob ? patients.filter((p) => day(p.dob) === day(dob) && norm(p.first_name) === norm(first) && norm(p.last_name) === norm(last)) : [];\nif (same.length === 1) {\n  const p = same[0];\n  return { exact: true, patientId: String(p.id), name: p.full_name || [p.first_name, p.last_name].filter(Boolean).join(' '), dob: day(p.dob), providerId: p.dietitian_id ? String(p.dietitian_id) : '' };\n}\nreturn { exact: false, sameCount: same.length, reason: same.length > 1 ? `${same.length} charts in Healthie have this name and birth date.` : (dob ? 'No chart in Healthie has this exact name and birth date.' : 'The fax shows no birth date, so it cannot be matched on name and birth date.') };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Match",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Check the match",
        "nextElementIds": [
          "FC44367F-032A-46F5-8603-9471CD172648"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Settle on the chart Result"
          },
          "position": {
            "x": 1689,
            "y": 1119
          }
        },
        "flowElementId": "BF7882F4-F43D-429F-A200-2886C2658011",
        "groupId": null,
        "id": "10D065E2-9B7E-401C-B116-3A0A5010B8EE",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "match",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Match",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "D09A4CE9-3FDF-4361-AEAF-FF3FAAA2F585"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "question",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Question",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "890BF7E3-C82E-4488-ABEC-E358D5D55605"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answer",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Coordinator answer",
                    "subPathSegments": null,
                    "type": "TRIGGER_DATA",
                    "value": "4EC8AE20-DFB9-4D7D-B5CF-511D454963DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "let chart = null;\nif (match && match.exact) chart = { patientId: match.patientId, name: match.name, dob: match.dob, providerId: match.providerId, how: 'exact match on name and birth date' };\nelse if (answer && answer.decision === 'chart') {\n  const c = ((question && question.candidates) || []).find((x) => String(x.id) === String(answer.patient));\n  if (c) chart = { patientId: c.id, name: c.name, dob: c.dob, providerId: c.providerId, how: 'picked by the intake coordinator' };\n}\nreturn chart || { patientId: '', providerId: '', how: 'left for intake to handle by hand' };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Chart",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Settle on the chart",
        "nextElementIds": [
          "0A593336-3B0B-4A75-AF6D-149782F7CE6D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 893,
            "y": 1849
          }
        },
        "flowElementId": "21AC9095-588A-4D14-8432-039C2B009CDA",
        "groupId": null,
        "id": "D247FD33-C846-469C-AB91-D589F6283345",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "c0c6a787-0818-448c-ad12-f888d6a9903d",
                "nestedOperation": null,
                "operation": "arrayIsNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Compare",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "notOnChart",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "F388F184-76D5-4CE3-AE73-1DCD52EA6C28"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "ARRAY",
                "values": []
              }
            ],
            "grouping": [
              "c0c6a787-0818-448c-ad12-f888d6a9903d"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cNew",
          "storeResult": false,
          "thenComponent": {
            "componentId": "D1B8752C-1A65-46FC-8E9D-4FAFC932A878",
            "componentType": "ELEMENT"
          }
        },
        "name": "Anything new for the chart?",
        "nextElementIds": [
          "D1B8752C-1A65-46FC-8E9D-4FAFC932A878"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "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 coordinator Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 898,
            "y": 1110
          }
        },
        "flowElementId": "C0EA57D1-2F39-42A3-849F-2F8CABE83EAC",
        "groupId": null,
        "id": "62F11C51-F06C-4766-B9CE-A231C17C4F59",
        "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": "Question",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "890BF7E3-C82E-4488-ABEC-E358D5D55605"
                  }
                ],
                "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": "Question",
                    "subPathSegments": [
                      {
                        "key": "blocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "890BF7E3-C82E-4488-ABEC-E358D5D55605"
                  }
                ],
                "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 coordinator",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Ask the intake coordinator",
        "nextElementIds": [
          "4EC8AE20-DFB9-4D7D-B5CF-511D454963DE"
        ],
        "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 coordinator: Healthie refused Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 480,
            "y": 2010
          }
        },
        "flowElementId": "AA1D5529-3301-41F3-A381-2F811CAAEFAC",
        "groupId": null,
        "id": "CDAB63E9-C8F2-4BDA-8E17-7FE6559E22AC",
        "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 fill history for "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", born "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "dob",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "*, from "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "pharmacyName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Step: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Healthie error",
                    "subPathSegments": [
                      {
                        "key": "source",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "EC0806B4-F20A-444F-803D-AD755A736F2D"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". The service said: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Healthie error",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "EC0806B4-F20A-444F-803D-AD755A736F2D"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Nothing was added to the medication list. Please file it and check the medications by hand. Phaxio fax ID "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "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": "Healthie refusal note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the coordinator: not filed",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Looks for existing patients by first name, last name, date of birth and email, optionally narrowed by phone number, so an incoming referral is matched to the right chart before a new patient is created. Every term you fill in must match. Healthie does not search by phone number itself, so give at least one other term with it.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Search by first name and birth date Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 868,
            "y": 940
          }
        },
        "flowElementId": "C4BD2F37-C624-43C4-A500-2EDA43CE8CF3",
        "groupId": null,
        "id": "7940B407-D8C6-4995-92A8-315E5AACA8A2",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientFirstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phoneNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 25
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "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": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "By first name",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by first name and birth date",
        "nextElementIds": [
          "1117C1BD-B3D6-4793-A6AA-BED34C214583"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 1277,
            "y": 2539
          }
        },
        "flowElementId": "5777848E-0642-4634-9FEB-2484702AF151",
        "groupId": null,
        "id": "4047B31A-C319-48BB-AA50-E2BD6F43A6AB",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "resultAlias": "Prescriber answer",
          "slaConditions": [],
          "storeResult": true,
          "type": "CALLBACK"
        },
        "name": "Wait for the prescriber's answer",
        "nextElementIds": [
          "A37C6256-A48E-4F02-9BE3-6B2588F9CFED"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Filters users based on a search string. Matches Slack ID or email exactly, and username or display name partially, all case-insensitive.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::findMembers",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the prescriber in Slack Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::findMembers",
          "legacyElementId": "JS###v1###Slack###findMembers",
          "methodName": "findMembers",
          "position": {
            "x": 1665,
            "y": 1840
          }
        },
        "flowElementId": "730B887C-BB0D-41E5-9615-9D8D69FE03CD",
        "groupId": null,
        "id": "01B8EC51-FE3D-470A-94B9-41C738D18FBE",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Provider",
                    "subPathSegments": [
                      {
                        "key": "email",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D1B8752C-1A65-46FC-8E9D-4FAFC932A878"
                  }
                ],
                "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": "findMembers",
          "onFailElemId": "4030F14D-0E33-4368-A7DA-B559FF57CCDF",
          "packageId": "default",
          "resultAlias": "Members",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the prescriber in Slack",
        "nextElementIds": [
          "2A95AEE6-E47F-4618-9293-B4D092267675"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 509,
            "y": 2539
          }
        },
        "flowElementId": "C0C33D26-3716-4FAB-AE85-1EC9ECCECD28",
        "groupId": null,
        "id": "E434B5E4-0386-4C98-A95B-E4AA8C8AB338",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "25558539-a911-494e-99ff-1d31e2e0d148",
                "nestedOperation": null,
                "operation": ">",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Confirmed",
                      "subPathSegments": [
                        {
                          "key": "count",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "A37C6256-A48E-4F02-9BE3-6B2588F9CFED"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 0
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "25558539-a911-494e-99ff-1d31e2e0d148"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cAdd",
          "storeResult": false,
          "thenComponent": {
            "componentId": "6A5F5BCB-1B38-4EF8-B393-25E77513449D",
            "componentType": "GROUP"
          }
        },
        "name": "Any to add?",
        "nextElementIds": [],
        "nextGroupIds": [
          "6A5F5BCB-1B38-4EF8-B393-25E77513449D"
        ],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "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 coordinator: not added Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 114,
            "y": 1870
          }
        },
        "flowElementId": "5A138408-A10A-4369-A965-D711BB2BAF27",
        "groupId": "6A5F5BCB-1B38-4EF8-B393-25E77513449D",
        "id": "CCFF5BD9-1F41-42A4-8FB2-FB5E813B2CEE",
        "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": "*Healthie did not add "
                  },
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "6A5F5BCB-1B38-4EF8-B393-25E77513449D"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " to the chart of "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", born "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "dob",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ".* It was confirmed in Slack from the fill history, which is filed on the chart. Healthie said: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Add error",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "F133F208-0F4C-4B52-BCFF-FE5B6EC8AA4E"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Please add it by hand. Phaxio fax ID "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "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": "Not added note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the coordinator: not added",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends a direct message to a user on Slack with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendDirectMessage",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Ask the prescriber Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendDirectMessage",
          "legacyElementId": "JS###v1###Slack###sendDirectMessage",
          "methodName": "sendDirectMessage",
          "position": {
            "x": 1689,
            "y": 2530
          }
        },
        "flowElementId": "9AED2BE1-F35F-40E5-BFC5-6F2639D0744E",
        "groupId": null,
        "id": "2C77DF0F-A0BA-4F0B-A2B9-63CB7ECB1024",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "userId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card",
                    "subPathSegments": [
                      {
                        "key": "memberId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "2A95AEE6-E47F-4618-9293-B4D092267675"
                  }
                ],
                "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": "2A95AEE6-E47F-4618-9293-B4D092267675"
                  }
                ],
                "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": "2A95AEE6-E47F-4618-9293-B4D092267675"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendDirectMessage",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Question to prescriber",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Ask the prescriber",
        "nextElementIds": [
          "4047B31A-C319-48BB-AA50-E2BD6F43A6AB"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Prescriber not found Result"
          },
          "position": {
            "x": 2052,
            "y": 1719
          }
        },
        "flowElementId": "EC70EE78-DC15-4A12-B726-29124E5F0BA6",
        "groupId": null,
        "id": "4030F14D-0E33-4368-A7DA-B559FF57CCDF",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Prescriber error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Prescriber not found",
        "nextElementIds": [
          "2A95AEE6-E47F-4618-9293-B4D092267675"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "notes": "Gets a provider or staff member of your Healthie organization: name, contact details, NPI, license number, qualifications and primary taxonomy code, and the organization's name and group NPI, for example to send the NPI with an insurance eligibility check.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::getProvider",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get the patient's prescriber Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::getProvider",
          "legacyElementId": null,
          "methodName": "getProvider",
          "position": {
            "x": 1292,
            "y": 1840
          }
        },
        "flowElementId": "F1BC44A8-53C8-485B-AD27-3842EA288512",
        "groupId": null,
        "id": "D1B8752C-1A65-46FC-8E9D-4FAFC932A878",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "providerId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "providerId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  }
                ],
                "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": "getProvider",
          "onFailElemId": "4030F14D-0E33-4368-A7DA-B559FF57CCDF",
          "packageId": "default",
          "resultAlias": "Provider",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get the patient's prescriber",
        "nextElementIds": [
          "01B8EC51-FE3D-470A-94B9-41C738D18FBE"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Healthie refused the medication Result"
          },
          "position": {
            "x": 110,
            "y": 1749
          }
        },
        "flowElementId": "D69D6462-AA4E-4DA2-BBBE-CA8F08B7B624",
        "groupId": "6A5F5BCB-1B38-4EF8-B393-25E77513449D",
        "id": "F133F208-0F4C-4B52-BCFF-FE5B6EC8AA4E",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Add error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Healthie refused the medication",
        "nextElementIds": [
          "CCFF5BD9-1F41-42A4-8FB2-FB5E813B2CEE"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "notes": "Adds a medication to a patient's Healthie chart, such as one on a pharmacy fax or a specialty referral. This records the medication history; it does not prescribe.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::addMedication",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Add the medication in Healthie Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::addMedication",
          "legacyElementId": null,
          "methodName": "addMedication",
          "position": {
            "x": 114,
            "y": 1610
          }
        },
        "flowElementId": "1D8BFB3E-B03D-4B21-B8D9-8707E0138453",
        "groupId": "6A5F5BCB-1B38-4EF8-B393-25E77513449D",
        "id": "584A6729-9F98-45E1-9D76-5B5C85BD2E43",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "name",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "6A5F5BCB-1B38-4EF8-B393-25E77513449D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dosage",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "dosage",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "6A5F5BCB-1B38-4EF8-B393-25E77513449D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "directions",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "directions",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "6A5F5BCB-1B38-4EF8-B393-25E77513449D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "frequency",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "route",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "comment",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "comment",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "6A5F5BCB-1B38-4EF8-B393-25E77513449D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "startDate",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "endDate",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "active",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "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": "addMedication",
          "onFailElemId": "F133F208-0F4C-4B52-BCFF-FE5B6EC8AA4E",
          "packageId": "default",
          "resultAlias": "Added",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Add the medication in Healthie",
        "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 confirmed medications Result"
          },
          "position": {
            "x": 881,
            "y": 2539
          }
        },
        "flowElementId": "531F5518-5510-48C5-A14C-36CE5811C981",
        "groupId": null,
        "id": "A37C6256-A48E-4F02-9BE3-6B2588F9CFED",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "card",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "2A95AEE6-E47F-4618-9293-B4D092267675"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answer",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Prescriber answer",
                    "subPathSegments": null,
                    "type": "TRIGGER_DATA",
                    "value": "4047B31A-C319-48BB-AA50-E2BD6F43A6AB"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "history",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "receivedAt",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "created_at",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const s = (v) => String(v == null ? '' : v).trim();\nconst meds = (card && card.meds) || [];\nconst d = s(answer && answer.decision);\nlet chosen = [];\nif (d === 'all') chosen = meds;\nelse if (d === 'one') { const m = meds[Number(answer.item) - 1]; if (m) chosen = [m]; }\nconst by = card && card.memberId ? ` by ${card.prescriber}` : '';\nconst source = `the ${s(history && history.pharmacyName) || 'pharmacy'} fill history faxed ${s(receivedAt).slice(0, 10)}`;\nreturn {\n  decision: d,\n  count: chosen.length,\n  meds: chosen.map((m) => ({\n    name: s(m.name) || s(m.drug),\n    dosage: s(m.strength),\n    directions: s(m.directions),\n    comment: `From ${source}. Last filled ${s(m.lastFillDate) || 'on a date not printed'}${s(m.prescriber) ? `, prescribed by ${s(m.prescriber)}` : ''}. Confirmed in Slack${by}.`,\n  })),\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Confirmed",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Pick the confirmed medications",
        "nextElementIds": [
          "E434B5E4-0386-4C98-A95B-E4AA8C8AB338"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 2053,
            "y": 2539
          }
        },
        "flowElementId": "5F1E6FD7-FA2D-4055-ACB0-6783DDC9FCFC",
        "groupId": null,
        "id": "C63211BE-D747-4316-A659-950829458180",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "9b7c119c-1c98-4c56-b47b-b96406faf567",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Card",
                      "subPathSegments": [
                        {
                          "key": "memberId",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "2A95AEE6-E47F-4618-9293-B4D092267675"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "9b7c119c-1c98-4c56-b47b-b96406faf567"
            ]
          },
          "elseComponent": {
            "componentId": "737B9EEB-F755-4CF8-B41A-16AE3021FE23",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cSlack",
          "storeResult": false,
          "thenComponent": {
            "componentId": "2C77DF0F-A0BA-4F0B-A2B9-63CB7ECB1024",
            "componentType": "ELEMENT"
          }
        },
        "name": "Prescriber in Slack?",
        "nextElementIds": [
          "2C77DF0F-A0BA-4F0B-A2B9-63CB7ECB1024",
          "737B9EEB-F755-4CF8-B41A-16AE3021FE23"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the card for the prescriber Result"
          },
          "position": {
            "x": 2012,
            "y": 1849
          }
        },
        "flowElementId": "3A3FBF8D-1069-4A23-99C1-A76DCDB7B063",
        "groupId": null,
        "id": "2A95AEE6-E47F-4618-9293-B4D092267675",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "chart",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "history",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "History",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "compare",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Compare",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "F388F184-76D5-4CE3-AE73-1DCD52EA6C28"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "provider",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Provider",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "D1B8752C-1A65-46FC-8E9D-4FAFC932A878"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "members",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Members",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "01B8EC51-FE3D-470A-94B9-41C738D18FBE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "faxUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Fresh copy",
                    "subPathSegments": [
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C37E8D65-9DD5-4847-AAC4-10069CE2043A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answerLink",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Prescriber answer link",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Prescriber 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).trim();\nconst link = (params) => `${answerLink}?execution=${encodeURIComponent(executionId)}&${new URLSearchParams(params).toString()}`;\nconst fmt = (d) => { const m = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(s(d)); return m ? `${m[2]}/${m[3]}/${m[1]}` : (s(d) || 'not printed'); };\nconst p = (provider && (provider.provider || provider.user || provider)) || {};\nconst email = s(p.email).toLowerCase();\nconst pool = Array.isArray(members) ? members : ((members && (members.members || members.users || members.results || members.items)) || []);\n// Find Members returns userId. Only a person whose email matches exactly counts; bots never do.\nconst member = email ? pool.find((m) => m && !m.isBot && !m.botId && s(m.userId) && [m.email, m.profile && m.profile.email].some((e) => s(e).toLowerCase() === email)) : null;\nconst memberId = member ? s(member.userId) : '';\nconst prescriber = s(p.full_name || [p.first_name, p.last_name].filter(Boolean).join(' ')) || \"the patient's provider\";\nconst all = (compare && compare.notOnChart) || [];\nconst meds = all.slice(0, 20);\nconst chartLink = `https://secure.gethealthie.com/users/${chart.patientId}`;\nconst title = `*Pharmacy fill history for <${chartLink}|${chart.name}>, born ${fmt(chart.dob)}*`;\nconst from = `From ${s(history.pharmacyName) || 'a pharmacy'}${s(history.pharmacyPhone) ? ` (${s(history.pharmacyPhone)})` : ''}. <${faxUrl}|Open the fax>. It is filed on the chart.`;\nconst listLine = `${all.length === 1 ? 'This medication is' : 'These medications are'} on the fill history and not on the Healthie medication list.`;\nconst askHead = [title, from, `${listLine} Nothing is added until you choose.`].join('\\n');\nconst infoHead = [title, from, `${listLine} ${prescriber} could not be found in Slack, so nothing is added from here. A Healthie task asks for the list to be reviewed and any medication added by hand.`].join('\\n');\nconst items = meds.map((m, i) => {\n  const parts = [\n    `*${i + 1}. ${s(m.name) || s(m.drug)}*`,\n    [s(m.directions) && `Directions: ${s(m.directions)}`, s(m.quantity) && `Qty ${s(m.quantity)}`, s(m.daysSupply) && `${s(m.daysSupply)} days supply`, `last filled ${fmt(m.lastFillDate)}`].filter(Boolean).join(', '),\n    [s(m.prescriber) && `Prescriber: ${s(m.prescriber)}`, s(m.pharmacy) && `Pharmacy: ${s(m.pharmacy)}`].filter(Boolean).join(', '),\n  ];\n  if (m.unsure) parts.push('_Textract was unsure of part of this row. Check the fax._');\n  if (s(m.chartNote)) parts.push(`_On the chart: ${s(m.chartNote)}_`);\n  return parts.filter(Boolean).join('\\n');\n});\nif (all.length > meds.length) items.push(`${all.length - meds.length} more are on the fax and not listed here. Add those by hand in Healthie.`);\nconst onChart = ((compare && compare.onChart) || []).map((m) => s(m.drug)).filter(Boolean);\nif (onChart.length) items.push(`Already on the chart: ${onChart.join(', ')}.`);\nconst sectionsFor = (head) => { const out = []; let buf = head; for (const t of items) { if ((buf + '\\n\\n' + t).length > 2800) { out.push(buf); buf = t; } else buf += '\\n\\n' + t; } out.push(buf); return out.map((t) => ({ type: 'section', text: { type: 'mrkdwn', text: t } })); };\nconst btn = (text, params, style) => ({ type: 'button', ...(style ? { style } : {}), text: { type: 'plain_text', text: text.slice(0, 75) }, url: link(params) });\nconst buttons = [btn(meds.length === 1 ? 'Add it' : `Add all ${meds.length}`, { decision: 'all' }, 'primary')];\nif (meds.length > 1) meds.forEach((m, i) => buttons.push(btn(`Add only ${i + 1}: ${s(m.name) || s(m.drug)}`, { decision: 'one', item: String(i + 1) })));\nbuttons.push(btn('Add none', { decision: 'none' }));\nif (meds.length > 1) buttons.push(btn(\"Some of them: I'll add them in Healthie\", { decision: 'manual' }));\nconst blocks = sectionsFor(askHead);\nfor (let i = 0; i < buttons.length; i += 25) blocks.push({ type: 'actions', elements: buttons.slice(i, i + 25) });\nconst infoBlocks = sectionsFor(infoHead);\nconst names = all.map((m) => s(m.name) || s(m.drug)).filter(Boolean).join(', ');\nconst taskContent = `Review the pharmacy fill history faxed for ${chart.name} (${s(history.pharmacyName) || 'pharmacy not named'}). It is filed on the chart. Not on the Healthie medication list: ${names}. ${prescriber} could not be found in Slack, so add any medication you confirm by hand.`.slice(0, 1000);\nreturn { memberId, prescriber, meds, text: `Fill history for ${chart.name}: ${all.length} medication${all.length === 1 ? '' : 's'} not on the chart`, blocks, infoBlocks, taskContent, assignees: s(chart.providerId) ? [s(chart.providerId)] : [] };"
              }
            ],
            "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 prescriber",
        "nextElementIds": [
          "C63211BE-D747-4316-A659-950829458180"
        ],
        "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 clinical team Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1688,
            "y": 2660
          }
        },
        "flowElementId": "3BA92304-6DBA-48A1-9586-43C1E1A61543",
        "groupId": null,
        "id": "737B9EEB-F755-4CF8-B41A-16AE3021FE23",
        "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": "2A95AEE6-E47F-4618-9293-B4D092267675"
                  }
                ],
                "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": "infoBlocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "2A95AEE6-E47F-4618-9293-B4D092267675"
                  }
                ],
                "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 clinical team",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the clinical team",
        "nextElementIds": [
          "EF6412B9-C716-499A-9750-051BBA3DDB6C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Downloads the stored document for a fax and saves it to FlowRunner file storage, returning a URL you can pass to later steps. Returns the full PDF by default, or a small (129x167) or large (300x388) JPEG thumbnail. The document is only available while long-term file storage is enabled on the account.",
          "elementId": "EXTENSION:::SHARED:::default:::phaxio:::downloadFaxDocument",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get a fresh copy of the fax Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::phaxio:::downloadFaxDocument",
          "legacyElementId": "JS###v1###Phaxio###downloadFaxDocument",
          "methodName": "downloadFaxDocument",
          "position": {
            "x": 1296,
            "y": 1280
          }
        },
        "flowElementId": "9C7219E5-C238-4332-A57D-C9EB2CED51AC",
        "groupId": null,
        "id": "C37E8D65-9DD5-4847-AAC4-10069CE2043A",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "faxId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "format",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "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": "downloadFaxDocument",
          "onFailElemId": "EC0806B4-F20A-444F-803D-AD755A736F2D",
          "packageId": "default",
          "resultAlias": "Fresh copy",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "phaxio",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get a fresh copy of the fax",
        "nextElementIds": [
          "DFB48814-AEE5-43F3-B755-5D0C99FEF214"
        ],
        "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": 469
          }
        },
        "flowElementId": "4023E4C5-A7E4-4B1D-B4B7-F4D510E715AB",
        "groupId": "55C6A403-141A-4B3A-B9CF-A5B0B85C8877",
        "id": "8BF06B55-04FA-4104-8E7B-309E224A84D1",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Check error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Textract returned an error",
        "nextElementIds": [
          "56F90300-4EBD-44A8-AF24-1E576E2E8D1E"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "099577aa-de95-4ea1-aeb3-350976cf3d08",
            "Reading error": "816c89b4-0717-4ec4-baac-741a28204657"
          },
          "position": {
            "x": 1088,
            "y": 469
          }
        },
        "flowElementId": "04D20CDC-883B-4D81-94B9-DB3FED4C75BF",
        "groupId": "55C6A403-141A-4B3A-B9CF-A5B0B85C8877",
        "id": "56F90300-4EBD-44A8-AF24-1E576E2E8D1E",
        "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": "8BF06B55-04FA-4104-8E7B-309E224A84D1"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "stopErr",
          "storeResult": true
        },
        "name": "Keep the error",
        "nextElementIds": [
          "FEA879FB-9BD8-4889-BA1F-E946A3033F58"
        ],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "notes": "Creates a to-do in Healthie for your staff, such as \"Call patient to schedule intake\", optionally linked to a patient, assigned to team members and given a due date.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::createTask",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Task: review the list by hand Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::createTask",
          "legacyElementId": null,
          "methodName": "createTask",
          "position": {
            "x": 1289,
            "y": 2400
          }
        },
        "flowElementId": "5372B22D-8E0F-42AF-B923-FB1343B02A85",
        "groupId": null,
        "id": "EF6412B9-C716-499A-9750-051BBA3DDB6C",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "content",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card",
                    "subPathSegments": [
                      {
                        "key": "taskContent",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "2A95AEE6-E47F-4618-9293-B4D092267675"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "10D065E2-9B7E-401C-B116-3A0A5010B8EE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "assigneeIds",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card",
                    "subPathSegments": [
                      {
                        "key": "assignees",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "2A95AEE6-E47F-4618-9293-B4D092267675"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dueDate",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "highPriority",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createTask",
          "onFailElemId": "EC0806B4-F20A-444F-803D-AD755A736F2D",
          "packageId": "default",
          "resultAlias": "Review task",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Task: review the list by hand",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "break-repeat",
          "isFirstElement": false,
          "blockDefinitionId": "break-repeat",
          "position": {
            "x": 1402,
            "y": 469
          }
        },
        "flowElementId": "6B61E0E7-DDA6-42B7-9276-A1917DC19677",
        "groupId": "55C6A403-141A-4B3A-B9CF-A5B0B85C8877",
        "id": "FEA879FB-9BD8-4889-BA1F-E946A3033F58",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "brk2",
          "storeResult": true
        },
        "name": "Stop reading",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "BREAK"
      },
      {
        "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 coordinator: not compared Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1268,
            "y": 1450
          }
        },
        "flowElementId": "2FF3951B-89CB-4739-9B88-E1A18CC55196",
        "groupId": null,
        "id": "E07B2706-F1D2-4075-A8F7-E9BB58F41BED",
        "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 Phaxio line was not checked against the chart.* The AI step failed. Step: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "AI error",
                    "subPathSegments": [
                      {
                        "key": "source",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E063D967-0D96-4E47-9368-7AE36294D213"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". It said: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "AI error",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E063D967-0D96-4E47-9368-7AE36294D213"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". It came from "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "from_number",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "caller_name",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " (Phaxio fax ID "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "). If it is a pharmacy fill history, please check it against the chart by hand. Nothing was added to any chart. "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "fileUrl",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7328738B-DB38-4BB0-91BB-E59F08F3D176"
                  }
                ],
                "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": "AI note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the coordinator: not compared",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1317,
            "y": 649
          }
        },
        "flowElementId": "56C49BE8-F726-4123-9A1C-3ECAC0A14F35",
        "groupId": null,
        "id": "6A2F805C-61D9-4BFF-97BC-37C333DF5382",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "c58b3769-eed0-46f7-a501-12d348b18dd0",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "History",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "readable",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "1272C74A-3D24-45D6-B4C8-59A5F1B7B9DE"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "c58b3769-eed0-46f7-a501-12d348b18dd0"
            ]
          },
          "elseComponent": {
            "componentId": "209CBCAA-F4A3-405B-8D5A-71F5075358BA",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cReadable",
          "storeResult": false,
          "thenComponent": null
        },
        "name": "Could it be read?",
        "nextElementIds": [
          "209CBCAA-F4A3-405B-8D5A-71F5075358BA"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "AI step failed Result"
          },
          "position": {
            "x": 918,
            "y": 1459
          }
        },
        "flowElementId": "CC08C88F-5177-4A80-8953-7B68A8876E26",
        "groupId": null,
        "id": "E063D967-0D96-4E47-9368-7AE36294D213",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "AI error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "AI step failed",
        "nextElementIds": [
          "E07B2706-F1D2-4075-A8F7-E9BB58F41BED"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      }
    ],
    "firstElementId": "7328738B-DB38-4BB0-91BB-E59F08F3D176",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "repeat",
          "isFirstElement": false,
          "blockDefinitionId": "repeat",
          "viewport": {
            "x": -57.96437659033079,
            "y": -253.89312977099235,
            "zoom": 0.89
          },
          "position": {
            "x": 492,
            "y": 219
          }
        },
        "flowElementId": "5E02DDD4-9BD6-4B39-8904-E562277FBB4F",
        "groupId": null,
        "id": "55C6A403-141A-4B3A-B9CF-A5B0B85C8877",
        "loopType": "REPEAT",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "2b81fa36-13f7-4f4e-9494-8381b5a096e7",
                "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": [
              "2b81fa36-13f7-4f4e-9494-8381b5a096e7"
            ]
          },
          "enabled": true,
          "firstElementId": "3B145B35-728B-4C26-A774-2CB25AFD72D1",
          "maxIterations": 90,
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "Wait for Textract to finish",
        "nextElementIds": [
          "AB8EF9BF-F4EF-43F3-AF70-6A1369F14BF6"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      },
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": -70,
            "y": -1570,
            "zoom": 1
          },
          "position": {
            "x": 471,
            "y": 2839
          }
        },
        "flowElementId": "2CBD3A40-04D9-4C25-8609-149C449D3E44",
        "groupId": null,
        "id": "6A5F5BCB-1B38-4EF8-B393-25E77513449D",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "enabled": true,
          "firstElementId": "584A6729-9F98-45E1-9D76-5B5C85BD2E43",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "Confirmed",
                "subPathSegments": [
                  {
                    "key": "meds",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "A37C6256-A48E-4F02-9BE3-6B2588F9CFED"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "each",
          "storeResult": true
        },
        "name": "Add each confirmed medication",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "F8C8CD8F-7612-4AC3-A00C-791ADC2AB241",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": null,
        "valid": true
      },
      "errorMessage": null,
      "executionStaticData": [
        {
          "description": "The Anthropic key the two AI steps use.",
          "error": null,
          "name": "Anthropic key",
          "type": "API_KEY",
          "value": null
        },
        {
          "description": "Cells Textract read with less confidence than this (0 to 100) are marked unsure on the prescriber's card.",
          "error": null,
          "name": "Confidence floor",
          "type": "INT",
          "value": ""
        },
        {
          "description": "The URL of the block Wait for the coordinator's answer. The coordinator's Slack buttons open it.",
          "error": null,
          "name": "Answer link",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The URL of the block Wait for the prescriber's answer. The prescriber's Slack buttons open it.",
          "error": null,
          "name": "Prescriber 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:10.840Z"
}
