{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "5CA10294-591D-4E53-8F54-C543ABB9C49C",
    "name": "AWS Textract: lab portal reports into Healthie"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -16.194125159642404,
        "y": 19.565772669220944,
        "zoom": 0.51
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When staff save a lab report from a lab portal into a Google Drive folder, stores it in S3 so Textract reads every page, lines up each value with its units, range and the lab's flag, and sends any lab-flagged value to Slack at once. It matches the patient in Healthie on name and birth date, asks the intake coordinator in Slack on a near, double or missing match, records the result with Record Lab Result and gives the ordering provider a review task listing flagged values, values outside the printed range and cells Textract was unsure of.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "Reads every page of each lab report staff save from a lab portal into a Google Drive folder with Textract, matches the patient in Healthie on name and birth date, records the result with each value and gives the ordering provider a review task.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "wait",
          "isFirstElement": true,
          "blockDefinitionId": "wait",
          "mode": "SIMPLE",
          "position": {
            "x": 110,
            "y": 49
          }
        },
        "flowElementId": "895E1A16-4A64-4B20-9240-DA1E89D8D513",
        "groupId": "A345233E-163A-401D-8584-46A47E209445",
        "id": "DEA6BB8D-40DC-4C1F-8D00-BFBD72D531CC",
        "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": [
          "F3B4E8C7-A13F-4ED5-8729-C342CFB1B3E0"
        ],
        "nextGroupIds": [],
        "type": "WAIT"
      },
      {
        "clientMetadata": {
          "elementId": "break-repeat",
          "isFirstElement": false,
          "blockDefinitionId": "break-repeat",
          "position": {
            "x": 1049,
            "y": 219
          }
        },
        "flowElementId": "A2714C5B-AD8C-491D-9BFF-12DFBF5C44FA",
        "groupId": "A345233E-163A-401D-8584-46A47E209445",
        "id": "A906734E-87C6-4E6B-81D4-46798705698C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "brk",
          "storeResult": true
        },
        "name": "Done reading",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "BREAK"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "58898e3a-1a9d-46e3-bb49-7d0414c89e36",
            "Textract result": "196bf697-227f-4e6e-a96c-f3a88ed62a49"
          },
          "position": {
            "x": 1402,
            "y": 349
          }
        },
        "flowElementId": "DBB6041B-3266-436C-80AB-50EE0949B8F9",
        "groupId": null,
        "id": "6378A0F1-6A23-4E2B-9F6D-5DF44F2F03BA",
        "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
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "bucket0",
          "storeResult": true
        },
        "name": "Not read yet",
        "nextElementIds": [],
        "nextGroupIds": [
          "A345233E-163A-401D-8584-46A47E209445"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "notes": "Starts an asynchronous document analysis job over a document stored 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. The document must be in an S3 bucket in the same region as this integration.",
          "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": 1789,
            "y": 340
          }
        },
        "flowElementId": "6252947D-32A5-4E91-9B53-1F8B3FEDC338",
        "groupId": null,
        "id": "4DB98028-893D-40C2-8D4E-A7537ACE73B6",
        "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": "s3Bucket",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Stored",
                    "subPathSegments": [
                      {
                        "key": "bucketName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "F7734020-1C66-4AED-8EA1-A1F8559BB1E8"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "s3Name",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Stored",
                    "subPathSegments": [
                      {
                        "key": "objectKey",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "F7734020-1C66-4AED-8EA1-A1F8559BB1E8"
                  }
                ],
                "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": "Who is the ordering provider or physician?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "ORDERING_PROVIDER"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "Which laboratory performed the tests?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "LAB_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 accession number or specimen ID?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "ACCESSION"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "When was the specimen collected?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "COLLECTED"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "When did the lab receive the specimen?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "RECEIVED"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "When was the report released or reported?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "REPORTED"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                },
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "Text",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "Is the report final, preliminary or corrected?"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "Alias",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "TEXT",
                            "label": null,
                            "type": "INPUT",
                            "value": "REPORT_STATUS"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                }
              ]
            },
            {
              "name": "clientRequestToken",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "jobTag",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "lab-portal"
                  }
                ],
                "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": null,
          "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": [
          "6378A0F1-6A23-4E2B-9F6D-5DF44F2F03BA"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Downloads a file from Google Drive and saves it to the Files.",
          "elementId": "EXTENSION:::SHARED:::default:::google-drive-api:::downloadFile",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Download the report Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::google-drive-api:::downloadFile",
          "legacyElementId": "JS###v1###GoogleDrive###downloadFile",
          "methodName": "downloadFile",
          "position": {
            "x": 1402,
            "y": 40
          }
        },
        "flowElementId": "6A40EC50-FB4E-48BD-9DD1-083501F26355",
        "groupId": null,
        "id": "9D0480D0-25E3-4B62-87E1-E8EC7DFC9B0B",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "fileId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "targetDirectory",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Download the report', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "downloadFile",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Report file",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "google-drive-api",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Download the report",
        "nextElementIds": [
          "F7734020-1C66-4AED-8EA1-A1F8559BB1E8"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Monitors Google Drive for new files and triggers AI workflows when content is added, uploaded, or moved. Perfect for automated processing of incoming documents, immediate analysis of uploaded files, or triggering workflows when users add new content to specific folders. Supports recursive scanning of subfolders with separate trigger calls for each new file/folder. Polling interval can be customized (minimum 30 seconds).",
          "elementId": "EXTENSION:::SHARED:::default:::google-drive-api:::onNewFile",
          "isFirstElement": true,
          "blockDefinitionId": "EXTENSION:::SHARED:::default:::google-drive-api:::onNewFile",
          "newElementId": "EXTENSION:::SHARED:::default:::google-drive-api:::onNewFile",
          "legacyElementId": "JS###v1###GoogleDrive###onNewFile",
          "methodName": "onNewFile",
          "position": {
            "x": 539,
            "y": 40
          }
        },
        "flowElementId": "87AC04B4-DC62-40C4-899C-7016D34BC165",
        "groupId": null,
        "id": "ECD7C4AD-E861-4C59-AED1-1AED43484B26",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'New report in the lab results folder', Error: OAuth Connection is required",
            "valid": false
          },
          "condition": null,
          "connectionId": null,
          "dynamicData": [],
          "eventName": "onNewFile",
          "frequency": {
            "repeat": {
              "every": 120
            },
            "schedule": "custom"
          },
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "New file",
          "serviceId": "google-drive-api",
          "slaConditions": [],
          "staticData": {
            "triggerConfiguration": "files_only",
            "processRecursively": false
          },
          "storeResult": true,
          "subtype": "POLLING",
          "type": "CUSTOM"
        },
        "name": "New report in the lab results folder",
        "nextElementIds": [
          "48E757FC-A326-45C4-B75B-C57B01430588"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "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": 40
          }
        },
        "flowElementId": "8A6EF52B-E16B-4213-BF81-BC5965702357",
        "groupId": "A345233E-163A-401D-8584-46A47E209445",
        "id": "F3B4E8C7-A13F-4ED5-8729-C342CFB1B3E0",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "jobId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Job",
                    "subPathSegments": [
                      {
                        "key": "jobId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "4DB98028-893D-40C2-8D4E-A7537ACE73B6"
                  }
                ],
                "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": null,
          "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": [
          "F889C0E5-CEC9-4B56-A17A-DE8A6792DA8A"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 734,
            "y": 49
          }
        },
        "flowElementId": "18627EF0-A62D-48BA-A4E6-25F096C4446A",
        "groupId": "A345233E-163A-401D-8584-46A47E209445",
        "id": "F889C0E5-CEC9-4B56-A17A-DE8A6792DA8A",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "5824951f-c3cd-4af7-9176-ed901451bc98",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Analysis",
                      "subPathSegments": [
                        {
                          "key": "jobStatus",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "F3B4E8C7-A13F-4ED5-8729-C342CFB1B3E0"
                    }
                  ],
                  "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": [
              "5824951f-c3cd-4af7-9176-ed901451bc98"
            ]
          },
          "elseComponent": {
            "componentId": "D51E5711-4BAB-4863-927A-FB9B32BED38B",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "still",
          "storeResult": false,
          "thenComponent": null
        },
        "name": "Still reading?",
        "nextElementIds": [
          "D51E5711-4BAB-4863-927A-FB9B32BED38B"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 995,
            "y": 49
          }
        },
        "flowElementId": "6671A105-A1F0-4EB3-AC4E-24F38DCF1101",
        "groupId": null,
        "id": "48E757FC-A326-45C4-B75B-C57B01430588",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "2a7031ee-fb6f-4ea8-8a5a-bc5b57614001",
                "nestedOperation": null,
                "operation": "contains",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "New file",
                      "subPathSegments": [
                        {
                          "key": "mimeType",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "pdf"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              },
              {
                "id": "b2f8dd04-cccd-41fa-be9c-e2ea3afdacd9",
                "nestedOperation": null,
                "operation": "startsWith",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "New file",
                      "subPathSegments": [
                        {
                          "key": "mimeType",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "image/"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "2a7031ee-fb6f-4ea8-8a5a-bc5b57614001",
              "OR",
              "b2f8dd04-cccd-41fa-be9c-e2ea3afdacd9"
            ]
          },
          "elseComponent": {
            "componentId": "CB21209D-0E62-4080-8490-325A7E77BC48",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "kind",
          "storeResult": false,
          "thenComponent": {
            "componentId": "9D0480D0-25E3-4B62-87E1-E8EC7DFC9B0B",
            "componentType": "ELEMENT"
          }
        },
        "name": "PDF or image?",
        "nextElementIds": [
          "9D0480D0-25E3-4B62-87E1-E8EC7DFC9B0B",
          "CB21209D-0E62-4080-8490-325A7E77BC48"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Downloads a file from a given URL and uploads it to an S3 bucket. Useful for transferring files from external sources directly into S3 without manual download steps.",
          "elementId": "EXTENSION:::SHARED:::default:::s3:::uploadObjectFromUrl",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Store the report for Textract Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::s3:::uploadObjectFromUrl",
          "legacyElementId": "JS###v1###S3CompatibleStorage###uploadObjectFromUrl",
          "methodName": "uploadObjectFromUrl",
          "position": {
            "x": 1777,
            "y": 40
          }
        },
        "flowElementId": "E4112E65-9D6A-4F5A-AB97-E4F9093D83D8",
        "groupId": null,
        "id": "F7734020-1C66-4AED-8EA1-A1F8559BB1E8",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "bucketName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "S3 bucket",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "S3 bucket"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "objectKey",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "lab-portal/"
                  },
                  {
                    "id": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sourceUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report file",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9D0480D0-25E3-4B62-87E1-E8EC7DFC9B0B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "contentType",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "mimeType",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "storageClass",
              "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": "uploadObjectFromUrl",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Stored",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "s3",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Store the report for Textract",
        "nextElementIds": [
          "4DB98028-893D-40C2-8D4E-A7537ACE73B6"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "eadf6279-a33d-4b95-9141-b19e28d19042",
            "Textract result": "74e1c146-4fe6-4a8e-8ea4-852342ffc33e"
          },
          "position": {
            "x": 1034,
            "y": 49
          }
        },
        "flowElementId": "E024A18E-A8DE-4B2E-AD51-14887E4A742B",
        "groupId": "A345233E-163A-401D-8584-46A47E209445",
        "id": "D51E5711-4BAB-4863-927A-FB9B32BED38B",
        "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": "F3B4E8C7-A13F-4ED5-8729-C342CFB1B3E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "keep",
          "storeResult": true
        },
        "name": "Keep what Textract read",
        "nextElementIds": [
          "A906734E-87C6-4E6B-81D4-46798705698C"
        ],
        "nextGroupIds": [],
        "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,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the results clerk it is not a result Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1750,
            "y": 510
          }
        },
        "flowElementId": "0D8236D4-118F-4CAF-8B4E-F7BCA22EBB3E",
        "groupId": null,
        "id": "AC25D4EB-4010-4DCC-94D9-AC2AFECF0348",
        "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": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " in the lab results folder does not read as a lab result, so nothing was recorded in Healthie. <https://drive.google.com/file/d/"
                  },
                  {
                    "id": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "/view|Open the file> to check it."
                  }
                ],
                "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": "Other note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the results clerk it is not a result",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1402,
            "y": 649
          }
        },
        "flowElementId": "B905FCA4-0A25-4182-90FB-2E0201270E4E",
        "groupId": null,
        "id": "70C9D877-4DE9-4C23-8E9C-78E826C49205",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "9a138b80-7814-4a5b-a209-bda48246c16b",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Report",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "isLabResult",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "9a138b80-7814-4a5b-a209-bda48246c16b"
            ]
          },
          "elseComponent": {
            "componentId": "AC25D4EB-4010-4DCC-94D9-AC2AFECF0348",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "islab",
          "storeResult": false,
          "thenComponent": {
            "componentId": "343FA0F4-6B15-456A-9189-10741E97A94C",
            "componentType": "ELEMENT"
          }
        },
        "name": "Lab result?",
        "nextElementIds": [
          "343FA0F4-6B15-456A-9189-10741E97A94C",
          "AC25D4EB-4010-4DCC-94D9-AC2AFECF0348"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": false,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Line up the results Result"
          },
          "tools": {},
          "position": {
            "x": 995,
            "y": 649
          }
        },
        "flowElementId": "A2F20DCA-026E-4714-B30E-6E11E119707A",
        "groupId": null,
        "id": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952",
        "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": null,
          "resultAlias": "Report",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "You arrange a lab report that Amazon Textract has already read. You get Textract's answers to questions about the report and every table it found, row by row, with cells separated by |. Reply with JSON only, with these fields:\nisLabResult: true if the document is a lab result report with test values; false for anything else, such as a lab order or requisition, a specimen rejection notice or a cover sheet\npatientFirstName: the patient's first name as printed\npatientLastName: the patient's last name as printed\npatientDateOfBirth: the patient's date of birth as YYYY-MM-DD, or empty text if it is not printed\norderingProvider: the ordering provider's full name as printed, without titles such as Dr. or MD, or empty text\nlabName: the lab that performed the tests, such as Quest Diagnostics, or empty text\npanelName: the panel or test that was ordered, such as Comprehensive Metabolic Panel; several panels joined with a comma\npanelCode: the lab's code for that panel if it is printed, otherwise empty text\naccessionNumber: the accession number or specimen ID, or empty text\ncollectionDate, receivedDate, reportedDate: each as YYYY-MM-DDTHH:MM:SS in the time printed on the report, or empty text when it is not printed\nreportStatus: final, preliminary or corrected, as printed, or empty text\nresults: one entry per result row in the tables, in the order printed, each with test (the name as printed), code (a LOINC or lab code only when the row prints one, otherwise empty text), value (the result exactly as printed, without its flag), units, range (the reference range exactly as printed), flag (the abnormal or critical flag exactly as printed in the row, such as H, L, HH, LL, A or CRIT, or empty text when the row has none)\nRules: copy every value, unit, range and flag exactly as Textract gives it. Never correct, convert or round a value. When a value and its flag share a cell, such as 182 H, put 182 in value and H in flag. Never add a flag the report does not print, and never say whether a value is normal. Leave out header rows, comments and footers. Never guess a value that is not in the text."
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "Staff saved "
              },
              {
                "id": "RESULT",
                "label": "New file",
                "subPathSegments": [
                  {
                    "key": "name",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": " from a lab portal. Textract read all "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Read",
                "subPathSegments": [
                  {
                    "key": "pages",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "524C56DF-04F0-458D-9D26-8DA702E82DA5"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": " pages.\n\nAnswers to questions about the report:\n"
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Read",
                "subPathSegments": [
                  {
                    "key": "queriesText",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "524C56DF-04F0-458D-9D26-8DA702E82DA5"
              },
              {
                "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": "524C56DF-04F0-458D-9D26-8DA702E82DA5"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Line up the results",
        "nextElementIds": [
          "70C9D877-4DE9-4C23-8E9C-78E826C49205"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check every value Result"
          },
          "position": {
            "x": 1804,
            "y": 649
          }
        },
        "flowElementId": "CE5FEA42-D7D6-443E-8605-23C4B8CF1F2C",
        "groupId": null,
        "id": "343FA0F4-6B15-456A-9189-10741E97A94C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "report",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "read",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Read",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "524C56DF-04F0-458D-9D26-8DA702E82DA5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "alertNote",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "The result goes on the patient's Healthie chart once the chart is matched on name and birth date, and the ordering provider then gets a review task."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const r0 = report || {};\nconst norm = (s) => String(s == null ? '' : s).replace(/\\s+/g, ' ').trim();\nconst key = (s) => norm(s).toLowerCase();\nconst cellSet = new Set(((read && read.cells) || []).map(key));\nconst unsureCells = (read && read.unsureCells) || [];\nconst unsureSet = new Set(unsureCells.map((c) => key(c.text)));\nconst num = (s) => { const m = /^[<>]?=?\\s*(-?\\d+(?:\\.\\d+)?)$/.exec(norm(s).replace(/,/g, '')); return m ? Number(m[1]) : null; };\nconst bounds = (range) => {\n  const r = norm(range).replace(/,/g, '');\n  let m = /^(-?\\d+(?:\\.\\d+)?)\\s*(?:-|–|to)\\s*(-?\\d+(?:\\.\\d+)?)/i.exec(r);\n  if (m) return { low: Number(m[1]), high: Number(m[2]) };\n  m = /^(<=|≤|<|less than|under)\\s*(-?\\d+(?:\\.\\d+)?)/i.exec(r);\n  if (m) return { high: Number(m[2]), highOpen: !/=|≤/.test(m[1]) };\n  m = /^(>=|≥|>|greater than|over)\\s*(-?\\d+(?:\\.\\d+)?)/i.exec(r);\n  if (m) return { low: Number(m[2]), lowOpen: !/=|≥/.test(m[1]) };\n  return null;\n};\nconst outside = (value, range) => {\n  if (/^[<>]/.test(norm(value))) return false;\n  const v = num(value); const b = bounds(range);\n  if (v === null || !b) return false;\n  if (b.low != null && (b.lowOpen ? v <= b.low : v < b.low)) return true;\n  if (b.high != null && (b.highOpen ? v >= b.high : v > b.high)) return true;\n  return false;\n};\nconst DRCHRONO_FLAGS = ['N', 'L', 'LL', 'H', 'HH', '<', '>', 'A', 'AA', 'S', 'R', 'I', 'NEG', 'POS'];\nconst results = (Array.isArray(r0.results) ? r0.results : []).filter((r) => norm(r.test) && norm(r.value)).map((r) => {\n  const flag = norm(r.flag);\n  const value = norm(r.value);\n  const labFlagged = !/^(n|normal)?$/i.test(flag);\n  const critical = /\\b(HH|LL|AA)\\b|crit|panic/i.test(flag);\n  const asPrinted = [value, flag ? `${value} ${flag}` : '', flag ? `${value}${flag}` : ''].filter(Boolean).some((s) => cellSet.has(key(s)));\n  const unsureHere = [r.test, value, r.units, r.range, flag].filter((s) => norm(s)).some((s) => unsureSet.has(key(s)));\n  return {\n    test: norm(r.test), code: norm(r.code), value, units: norm(r.units), range: norm(r.range), flag,\n    labFlagged, critical, outsideRange: outside(value, r.range), asPrinted,\n    needsCheck: !asPrinted || unsureHere,\n    why: !asPrinted ? 'not found as printed in the tables Textract read' : (unsureHere ? 'Textract was unsure of this cell' : ''),\n  };\n});\nconst line = (r) => `${r.test}: ${r.value}${r.units ? ' ' + r.units : ''}${r.range ? ` (lab range ${r.range})` : ''}${r.flag ? `, lab flag ${r.flag}` : ''}`;\nconst flagged = results.filter((r) => r.labFlagged);\nconst critical = results.filter((r) => r.critical);\nconst outsideOnly = results.filter((r) => r.outsideRange && !r.labFlagged);\nconst toCheck = results.filter((r) => r.needsCheck);\nconst used = new Set(results.flatMap((r) => [r.test, r.value, r.units, r.range, r.flag]).filter(Boolean).map(key));\nconst otherUnsure = unsureCells.filter((c) => !used.has(key(c.text))).slice(0, 15);\nconst sections = [];\nif (critical.length) sections.push('Flagged critical by the lab:\\n' + critical.map((r) => '- ' + line(r)).join('\\n'));\nconst flaggedOnly = flagged.filter((r) => !r.critical);\nif (flaggedOnly.length) sections.push('Flagged by the lab:\\n' + flaggedOnly.map((r) => '- ' + line(r)).join('\\n'));\nif (outsideOnly.length) sections.push('Outside the lab\\'s printed range, with no lab flag:\\n' + outsideOnly.map((r) => '- ' + line(r)).join('\\n'));\nconst notFound = results.filter((r) => !r.asPrinted);\nif (notFound.length) sections.push('Not recorded as values, because they could not be matched to the tables Textract read. Check them against the page:\\n' + notFound.map((r) => '- ' + line(r)).join('\\n'));\nconst unsureRows = toCheck.filter((r) => r.asPrinted);\nif (unsureRows.length || otherUnsure.length) sections.push('Check these against the page:\\n' + unsureRows.map((r) => `- ${line(r)} (${r.why})`).concat(otherUnsure.map((c) => `- \"${c.text}\" on page ${c.page} (Textract was ${c.confidence}% sure)`)).join('\\n'));\nsections.push('Every value on the report:\\n' + results.map((r) => '- ' + line(r)).join('\\n'));\nconst who = `${norm(r0.patientFirstName)} ${norm(r0.patientLastName)}`.trim() || 'a patient';\nconst dob = norm(r0.patientDateOfBirth) || 'birth date not printed';\nconst alertLines = [\n  `*${critical.length ? 'Critical lab value' : 'Lab-flagged value'}* for ${who}, born ${dob}`,\n  `${norm(r0.panelName) || 'Lab result'} from ${norm(r0.labName) || 'the lab'}${norm(r0.orderingProvider) ? `, ordered by ${norm(r0.orderingProvider)}` : ''}${norm(r0.collectionDate) ? `, collected ${norm(r0.collectionDate)}` : ''}`,\n  ...critical.map((r) => '• ' + line(r)),\n  ...flagged.filter((r) => !r.critical).map((r) => '• ' + line(r)),\n];\nif (flagged.some((r) => r.needsCheck)) alertLines.push('Some of these cells were hard to read. Check them against the report.');\nalertLines.push('The values are copied from the report with the lab\\'s own flags. ' + (alertNote || ''));\nreturn {\n  results, count: results.length,\n  anyFlagged: flagged.length > 0, anyCritical: critical.length > 0, anyToCheck: toCheck.length + otherUnsure.length > 0,\n  reviewText: sections.join('\\n\\n'),\n  alertText: alertLines.join('\\n'),\n  drchronoResults: results.filter((r) => r.asPrinted).map((r) => {\n    const b = bounds(r.range);\n    const two = b && b.low != null && b.high != null && !b.lowOpen && !b.highOpen;\n    const flagUpper = r.flag.toUpperCase();\n    return {\n      observationCode: r.code, observationDescription: r.test, value: r.value,\n      valueIsNumeric: num(r.value) !== null && !/^[<>]/.test(r.value),\n      unit: r.units, normalRange: two ? `${b.low} ${b.high}` : '',\n      abnormalStatus: !r.labFlagged ? '' : (DRCHRONO_FLAGS.includes(flagUpper) ? flagUpper : (r.critical ? 'AA' : 'A')),\n      isAbnormal: r.labFlagged,\n      comments: [r.range && !two ? `Lab range as printed: ${r.range}` : '', r.flag && !DRCHRONO_FLAGS.includes(flagUpper) ? `Lab flag as printed: ${r.flag}` : '', r.needsCheck ? `Check against the report: ${r.why}` : ''].filter(Boolean).join('. '),\n    };\n  }),\n  healthieResults: results.filter((r) => r.asPrinted).map((r) => ({\n    analyte: r.test,\n    value: num(r.value) !== null && !/^[<>]/.test(r.value) ? r.value : '',\n    qualitativeResult: num(r.value) !== null && !/^[<>]/.test(r.value) ? '' : r.value,\n    units: r.units, referenceRange: r.range, abnormalFlag: r.labFlagged ? r.flag : '',\n    notes: r.needsCheck ? `Check against the report: ${r.why}` : '',\n  })),\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Checked",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Check every value",
        "nextElementIds": [
          "8E09EDC4-06A5-4D01-AAE6-C0DCBEF5D944",
          "6E73789F-0BE2-4638-A4EA-9E7DBF18D6F6"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 588,
            "y": 649
          }
        },
        "flowElementId": "E9843BF8-9A67-4353-9865-7D98E82CAF07",
        "groupId": null,
        "id": "544CC4BF-DE78-48D2-9388-04B7FE8901FA",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "0c924d77-914c-4c71-a91f-61e70f1471a6",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Read",
                      "subPathSegments": [
                        {
                          "key": "status",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "524C56DF-04F0-458D-9D26-8DA702E82DA5"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "SUCCEEDED"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "0c924d77-914c-4c71-a91f-61e70f1471a6"
            ]
          },
          "elseComponent": {
            "componentId": "7471D9E6-4AF9-49A9-B066-F878F409D02D",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "readok",
          "storeResult": false,
          "thenComponent": {
            "componentId": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952",
            "componentType": "ELEMENT"
          }
        },
        "name": "Read every page?",
        "nextElementIds": [
          "C8B1A75A-E3FA-4BE9-89A0-EA7918516952",
          "7471D9E6-4AF9-49A9-B066-F878F409D02D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Gather what Textract read Result"
          },
          "position": {
            "x": 568,
            "y": 349
          }
        },
        "flowElementId": "C1F0FEA3-CAAD-4D11-BB38-8A9E9EA587AC",
        "groupId": null,
        "id": "524C56DF-04F0-458D-9D26-8DA702E82DA5",
        "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
              }
            }
          ],
          "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 cells = tables.flat(2).filter(Boolean);\nconst tablesText = tables.map((rows, i) => `Table ${i + 1}\\n` + rows.map((r) => r.join(' | ')).join('\\n')).join('\\n\\n');\nconst queries = a.queries || {};\nconst queriesText = Object.keys(queries).map((k) => `${k}: ${queries[k] == null ? '(no answer)' : queries[k]}`).join('\\n');\nconst status = a.jobStatus || '';\nconst 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, so the reading timed out'));\nreturn { status, problem, pages: a.pages || 0, tableCount: tables.length, tablesText, queriesText, cells, unsureCells };\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": [
          "544CC4BF-DE78-48D2-9388-04B7FE8901FA"
        ],
        "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,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the results clerk it could not be read Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 944,
            "y": 770
          }
        },
        "flowElementId": "F4BA8EF5-44BB-4F7D-A8D0-F11839FB5447",
        "groupId": null,
        "id": "7471D9E6-4AF9-49A9-B066-F878F409D02D",
        "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": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " from the lab results folder was not recorded in Healthie: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Read",
                    "subPathSegments": [
                      {
                        "key": "problem",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "524C56DF-04F0-458D-9D26-8DA702E82DA5"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". <https://drive.google.com/file/d/"
                  },
                  {
                    "id": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "/view|Open the file> and record it by hand."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Unread note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the results clerk it was not read",
        "nextElementIds": [],
        "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,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "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": 1382,
            "y": 1110
          }
        },
        "flowElementId": "4B868C68-7E10-45EF-89A0-BB184D1844B0",
        "groupId": null,
        "id": "094564F8-B784-4CCD-AA01-5943AE35369E",
        "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 card",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "472B23D2-C6B8-4631-826A-65763616B2F9"
                  }
                ],
                "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 card",
                    "subPathSegments": [
                      {
                        "key": "blocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "472B23D2-C6B8-4631-826A-65763616B2F9"
                  }
                ],
                "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": [
          "6E00D64F-8616-4D12-A349-815702A4C913"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 588,
            "y": 1119
          }
        },
        "flowElementId": "18783450-87B8-4EB0-ABF6-1A55D57BA368",
        "groupId": null,
        "id": "3C6F1CDB-E792-4C0B-80E3-CF1A58DC0D72",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "f0814685-220e-46e9-969e-7c4f80e2990e",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Match",
                      "subPathSegments": [
                        {
                          "key": "matched",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "8D6341C5-C6C2-46E0-AA92-97AB51286096"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "f0814685-220e-46e9-969e-7c4f80e2990e"
            ]
          },
          "elseComponent": {
            "componentId": "472B23D2-C6B8-4631-826A-65763616B2F9",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "one",
          "storeResult": false,
          "thenComponent": {
            "componentId": "62DD758D-A120-4CF7-BC07-E45865B49382",
            "componentType": "ELEMENT"
          }
        },
        "name": "One exact match?",
        "nextElementIds": [
          "62DD758D-A120-4CF7-BC07-E45865B49382",
          "472B23D2-C6B8-4631-826A-65763616B2F9"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1804,
            "y": 1289
          }
        },
        "flowElementId": "4AAC9D65-1599-4C88-A189-FB0BF68077DD",
        "groupId": null,
        "id": "70868019-F624-4FC1-9B45-EB5FB8330B9F",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "b477568f-12f8-421c-a6ab-75c82d528cea",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Coordinator answer",
                      "subPathSegments": [
                        {
                          "key": "decision",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "6E00D64F-8616-4D12-A349-815702A4C913"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "existing"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "b477568f-12f8-421c-a6ab-75c82d528cea"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "picked",
          "storeResult": false,
          "thenComponent": {
            "componentId": "62DD758D-A120-4CF7-BC07-E45865B49382",
            "componentType": "ELEMENT"
          }
        },
        "name": "Chart picked?",
        "nextElementIds": [
          "62DD758D-A120-4CF7-BC07-E45865B49382"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 2157,
            "y": 649
          }
        },
        "flowElementId": "1F3B0CBC-B3A0-4B79-814E-834DDB7610AB",
        "groupId": null,
        "id": "6E73789F-0BE2-4638-A4EA-9E7DBF18D6F6",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "0af5d02b-6a18-4f1d-ba46-00e4b34012f5",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Checked",
                      "subPathSegments": [
                        {
                          "key": "anyFlagged",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "343FA0F4-6B15-456A-9189-10741E97A94C"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "0af5d02b-6a18-4f1d-ba46-00e4b34012f5"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "anyflag",
          "storeResult": false,
          "thenComponent": {
            "componentId": "3FC17D03-AFD0-49BC-9085-F08856F92618",
            "componentType": "ELEMENT"
          }
        },
        "name": "Any value the lab flagged?",
        "nextElementIds": [
          "3FC17D03-AFD0-49BC-9085-F08856F92618"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "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 birth date Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 1402,
            "y": 940
          }
        },
        "flowElementId": "2471ED1D-C048-495B-AFAA-6A0E086E5DDE",
        "groupId": null,
        "id": "BED37FE7-7450-4245-8557-297056042D74",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "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": "Report",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                  }
                ],
                "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": 50
                  }
                ],
                "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": "Birth date search",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by birth date",
        "nextElementIds": [
          "6E4741B9-2BEC-494F-9B79-499850834902"
        ],
        "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": 1402,
            "y": 1289
          }
        },
        "flowElementId": "EEBC583C-6EE0-489E-898B-29A7FD467585",
        "groupId": null,
        "id": "62DD758D-A120-4CF7-BC07-E45865B49382",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "match",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Match",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "8D6341C5-C6C2-46E0-AA92-97AB51286096"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answer",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Coordinator answer",
                    "subPathSegments": null,
                    "type": "TRIGGER_DATA",
                    "value": "6E00D64F-8616-4D12-A349-815702A4C913"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "if (match && match.matched && match.patient) return { ...match.patient, source: 'exact match on name and birth date' };\nif (answer && answer.decision === 'existing' && answer.patient) {\n  const picked = ((match && match.candidates) || []).find((c) => String(c.id) === String(answer.patient));\n  if (!picked) throw new Error('The chart in the answer is not one of the charts offered in Slack.');\n  return { ...picked, source: 'chart picked by the intake coordinator' };\n}\nthrow new Error('No chart to record the result on.');\n"
              }
            ],
            "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": [
          "DFA74AEA-093B-4594-A799-16027F4C38C1"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get the record ready Result"
          },
          "position": {
            "x": 994,
            "y": 1289
          }
        },
        "flowElementId": "1286CAC1-7DF5-4B61-B2C3-139A8CE4D5C0",
        "groupId": null,
        "id": "DFA74AEA-093B-4594-A799-16027F4C38C1",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "report",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "chart",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "62DD758D-A120-4CF7-BC07-E45865B49382"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "checked",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Checked",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "343FA0F4-6B15-456A-9189-10741E97A94C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "providers",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Ordering providers",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Ordering providers"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report file",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9D0480D0-25E3-4B62-87E1-E8EC7DFC9B0B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const s = (v) => String(v == null ? '' : v).trim();\nconst map = providers && typeof providers === 'object' ? providers : {};\nconst provider = s(report.orderingProvider).toLowerCase();\nconst key = Object.keys(map).find((k) => k !== 'default' && k.trim() && provider.includes(k.trim().toLowerCase()));\nconst ordererId = s((key && map[key]) || chart.provider || map.default);\nconst panel = s(report.panelName) || 'Lab result';\nconst lab = s(report.labName);\nconst header = [\n  `Review lab result: ${panel} for ${s(chart.name)}`,\n  `From ${lab || 'a lab not named on the report'}, ordered by ${s(report.orderingProvider) || 'a provider not printed on the report'}${s(report.collectionDate) ? `, collected ${s(report.collectionDate)}` : ''}${s(report.accessionNumber) ? `, accession ${s(report.accessionNumber)}` : ''}.`,\n  `Downloaded from a lab portal as ${s(fileName)}. Chart: ${chart.source}.`,\n  checked.count ? '' : 'No values could be read from the tables on this report. Read the report itself.',\n].filter(Boolean).join('\\n');\nconst problemText = ordererId ? '' : `*Lab result for ${s(chart.name)} was not recorded in Healthie*: there is no Healthie provider for the ordering provider \"${s(report.orderingProvider) || 'not printed'}\", the patient has no provider of their own, and the flow setting Ordering providers has no default. <${chart.chartUrl}|Open the chart> <${fileUrl}|Open the report> Record it by hand and fill in the flow setting so the next one records itself.`;\nreturn {\n  ok: Boolean(ordererId), problemText,\n  ordererId,\n  lab: panel.slice(0, 200),\n  labCompany: lab || 'Lab not named on the report',\n  description: `${panel} result from ${lab || 'the lab'}, downloaded from the lab portal (${s(fileName)})`.slice(0, 250),\n  content: `${header}\\n\\n${checked.reviewText}`,\n  assignees: ordererId ? [ordererId] : [],\n  highPriority: Boolean(checked.anyFlagged),\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Ready",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Get the record ready",
        "nextElementIds": [
          "383583CA-2F8B-43FC-BBE3-4F78C49248AC"
        ],
        "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 last name Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 995,
            "y": 940
          }
        },
        "flowElementId": "6FB061CE-47CF-4C52-AFB3-08641C8B9960",
        "groupId": null,
        "id": "6E4741B9-2BEC-494F-9B79-499850834902",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                  }
                ],
                "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": 50
                  }
                ],
                "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": "Last name search",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by last name",
        "nextElementIds": [
          "8D6341C5-C6C2-46E0-AA92-97AB51286096"
        ],
        "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": 1782,
            "y": 940
          }
        },
        "flowElementId": "AE2D725B-6A68-44D5-A388-19CBC90289B2",
        "groupId": null,
        "id": "8E09EDC4-06A5-4D01-AAE6-C0DCBEF5D944",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientFirstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "patientDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                  }
                ],
                "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": [
          "BED37FE7-7450-4245-8557-297056042D74"
        ],
        "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,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the providers now Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 2498,
            "y": 640
          }
        },
        "flowElementId": "8149BDEA-B541-42DE-9EAC-5730FCEF163B",
        "groupId": null,
        "id": "3FC17D03-AFD0-49BC-9085-F08856F92618",
        "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": "Checked",
                    "subPathSegments": [
                      {
                        "key": "alertText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "343FA0F4-6B15-456A-9189-10741E97A94C"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "\n<"
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report file",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9D0480D0-25E3-4B62-87E1-E8EC7DFC9B0B"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "|Open the report>"
                  }
                ],
                "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": "Alert",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the providers now",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 1759,
            "y": 1119
          }
        },
        "flowElementId": "A823452A-D2DE-4BFB-843A-3A6E430EC90B",
        "groupId": null,
        "id": "6E00D64F-8616-4D12-A349-815702A4C913",
        "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": [
          "70868019-F624-4FC1-9B45-EB5FB8330B9F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Match on name and birth date Result"
          },
          "position": {
            "x": 556,
            "y": 949
          }
        },
        "flowElementId": "77D36626-24C4-4077-A849-7EFD78AF9B15",
        "groupId": null,
        "id": "8D6341C5-C6C2-46E0-AA92-97AB51286096",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "report",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "exact",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exact search",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "8E09EDC4-06A5-4D01-AAE6-C0DCBEF5D944"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "byBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Birth date search",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "BED37FE7-7450-4245-8557-297056042D74"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "byLast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Last name search",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "6E4741B9-2BEC-494F-9B79-499850834902"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const n = (s) => String(s == null ? '' : s).toLowerCase().replace(/[^a-z]/g, '');\nconst day = (s) => String(s == null ? '' : s).slice(0, 10);\nconst first = n(report.patientFirstName);\nconst last = n(report.patientLastName);\nconst dob = day(report.patientDateOfBirth);\nconst pool = new Map();\n[exact, byBirth, byLast].forEach((list) => ((list && list.patients) || []).forEach((p) => pool.set(String(p.id), p)));\nconst toCandidate = (p) => {\n  const why = [];\n  const pl = n(p.last_name);\n  const pf = n(p.first_name);\n  if (last && pl === last) why.push('same last name');\n  else if (last && pl && (pl.includes(last) || last.includes(pl))) why.push('similar last name');\n  if (first && pf === first) why.push('same first name');\n  else if (first && pf && pf[0] === first[0]) why.push('same first initial');\n  if (dob && day(p.dob) === dob) why.push('same birth date');\n  return { id: String(p.id), name: `${p.first_name || ''} ${p.last_name || ''}`.trim(), dob: day(p.dob), chartUrl: `https://secure.gethealthie.com/users/${p.id}`, provider: p.dietitian_id ? String(p.dietitian_id) : '', why };\n};\nconst all = [...pool.values()].map(toCandidate);\nconst exactHits = all.filter((c) => first && last && dob && c.why.includes('same first name') && c.why.includes('same last name') && c.why.includes('same birth date'));\nif (exactHits.length === 1) return { matched: true, situation: 'exact', patient: exactHits[0], candidates: exactHits };\nconst named = (c) => c.why.some((w) => /name|initial/.test(w));\nconst candidates = exactHits.length > 1 ? exactHits : all\n  .filter((c) => (c.why.includes('same birth date') && named(c)) || ((c.why.includes('same last name') || c.why.includes('similar last name')) && (c.why.includes('same first name') || c.why.includes('same first initial'))))\n  .sort((a, b) => b.why.length - a.why.length)\n  .slice(0, 5);\nreturn { matched: false, situation: exactHits.length > 1 ? 'double' : (candidates.length ? 'near' : 'none'), patient: null, candidates };\n"
              }
            ],
            "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": "Match on name and birth date",
        "nextElementIds": [
          "3C6F1CDB-E792-4C0B-80E3-CF1A58DC0D72"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "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": 936,
            "y": 1119
          }
        },
        "flowElementId": "764958DF-1B45-45D6-9762-39D4041CC83B",
        "groupId": null,
        "id": "472B23D2-C6B8-4631-826A-65763616B2F9",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "report",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C8B1A75A-E3FA-4BE9-89A0-EA7918516952"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "match",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Match",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "8D6341C5-C6C2-46E0-AA92-97AB51286096"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "faxUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report file",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9D0480D0-25E3-4B62-87E1-E8EC7DFC9B0B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answerLink",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Answer link",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Answer link"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "executionId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_ID",
                    "label": null,
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.executionId",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "executionId",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const s = (v) => String(v == null ? '' : v).trim();\nconst link = (params) => `${answerLink}?execution=${encodeURIComponent(executionId)}&${new URLSearchParams(params).toString()}`;\nconst name = `${s(report.patientFirstName)} ${s(report.patientLastName)}`.trim() || 'an unnamed patient';\nconst dob = s(report.patientDateOfBirth) || 'no birth date printed';\nconst list = (match && match.candidates) || [];\nconst intro = {\n  double: 'More than one Healthie chart has this name and birth date. Which chart is it?',\n  near: 'No Healthie chart matches this name and birth date exactly. These charts look close:',\n  none: 'No Healthie chart matches this name and birth date, and none looks close.',\n}[match && match.situation] || 'Which chart is it?';\nconst lines = [\n  `*Lab result for ${name}, born ${dob}*`,\n  `${s(report.panelName) || 'Lab result'} from ${s(report.labName) || 'the lab'}${s(report.orderingProvider) ? `, ordered by ${s(report.orderingProvider)}` : ''}.`,\n  intro,\n  ...list.map((c) => `• ${c.chartUrl ? `<${c.chartUrl}|${c.name}>` : c.name}, born ${c.dob || 'unknown'}: ${c.why.join(', ')}`),\n  faxUrl ? `<${faxUrl}|Open the report>` : '',\n  'Nothing is recorded until you pick a chart.',\n].filter(Boolean);\nconst buttons = list.map((c, i) => ({ type: 'button', ...(i === 0 && list.length === 1 ? { style: 'primary' } : {}), text: { type: 'plain_text', text: `Record on ${c.name}'s chart`.slice(0, 75) }, url: link({ decision: 'existing', patient: c.id }) }));\nbuttons.push({ type: 'button', text: { type: 'plain_text', text: 'Not in Healthie: I will handle it' }, url: link({ decision: 'manual' }) });\nreturn {\n  text: `Lab result for ${name}: which Healthie chart?`,\n  blocks: [\n    { type: 'section', text: { type: 'mrkdwn', text: lines.join('\\n') } },\n    { type: 'actions', elements: buttons },\n  ],\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Question card",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the question for the coordinator",
        "nextElementIds": [
          "094564F8-B784-4CCD-AA01-5943AE35369E"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Records a lab result that arrived as a file, such as a faxed PDF, on a patient's Healthie chart: the file is filed as a chart document, then a lab order is created for it with the panel, the lab company and the ordering provider, and with any result values you give (test, value, units, reference range, abnormal flag). Healthie has no public mutation that adds values to an existing result, so give them here. If the lab order cannot be created, the error names the document already filed.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::recordLabResult",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Record the result in Healthie Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::recordLabResult",
          "legacyElementId": null,
          "methodName": "recordLabResult",
          "position": {
            "x": 561,
            "y": 1450
          }
        },
        "flowElementId": "150E8ADF-2464-4A26-A5E3-74FA39F2EE64",
        "groupId": null,
        "id": "3A95DE21-A49B-457C-BCCC-5C9AA70FE61F",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "62DD758D-A120-4CF7-BC07-E45865B49382"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Report file",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9D0480D0-25E3-4B62-87E1-E8EC7DFC9B0B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lab",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "lab",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "DFA74AEA-093B-4594-A799-16027F4C38C1"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "labCompany",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "labCompany",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "DFA74AEA-093B-4594-A799-16027F4C38C1"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "ordererId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "ordererId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "DFA74AEA-093B-4594-A799-16027F4C38C1"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "results",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Checked",
                    "subPathSegments": [
                      {
                        "key": "healthieResults",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "343FA0F4-6B15-456A-9189-10741E97A94C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "folderId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "description",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "description",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "DFA74AEA-093B-4594-A799-16027F4C38C1"
                  }
                ],
                "mode": "EXPRESSION",
                "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": "recordLabResult",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Recorded",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Record the result in Healthie",
        "nextElementIds": [
          "1133A9D9-CC45-42C0-8EF8-982DBBCC6226"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "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": "Review task for the ordering provider Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::createTask",
          "legacyElementId": null,
          "methodName": "createTask",
          "position": {
            "x": 939,
            "y": 1450
          }
        },
        "flowElementId": "FACA4647-DB13-4A4D-B6C0-6891BD81907A",
        "groupId": null,
        "id": "1133A9D9-CC45-42C0-8EF8-982DBBCC6226",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "content",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "content",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "DFA74AEA-093B-4594-A799-16027F4C38C1"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "62DD758D-A120-4CF7-BC07-E45865B49382"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "assigneeIds",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "assignees",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "DFA74AEA-093B-4594-A799-16027F4C38C1"
                  }
                ],
                "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": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "highPriority",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "DFA74AEA-093B-4594-A799-16027F4C38C1"
                  }
                ],
                "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": "createTask",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Review task",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Review task for the ordering provider",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 569,
            "y": 1289
          }
        },
        "flowElementId": "19F56058-A63C-4765-9D62-3F3C18454C12",
        "groupId": null,
        "id": "383583CA-2F8B-43FC-BBE3-4F78C49248AC",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "b8941bf5-40aa-464b-8f97-92ade3860b40",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Ready",
                      "subPathSegments": [
                        {
                          "key": "ok",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "DFA74AEA-093B-4594-A799-16027F4C38C1"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "b8941bf5-40aa-464b-8f97-92ade3860b40"
            ]
          },
          "elseComponent": {
            "componentId": "DE091085-93F3-4B3F-965C-8E2118267AA4",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "okrec",
          "storeResult": false,
          "thenComponent": {
            "componentId": "3A95DE21-A49B-457C-BCCC-5C9AA70FE61F",
            "componentType": "ELEMENT"
          }
        },
        "name": "Ordering provider known?",
        "nextElementIds": [
          "3A95DE21-A49B-457C-BCCC-5C9AA70FE61F",
          "DE091085-93F3-4B3F-965C-8E2118267AA4"
        ],
        "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,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the coordinator it was not recorded Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 110,
            "y": 1280
          }
        },
        "flowElementId": "2E9389CD-CEB4-437F-8450-922BF4073314",
        "groupId": null,
        "id": "DE091085-93F3-4B3F-965C-8E2118267AA4",
        "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": "Ready",
                    "subPathSegments": [
                      {
                        "key": "problemText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "DFA74AEA-093B-4594-A799-16027F4C38C1"
                  }
                ],
                "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 recorded note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the coordinator it was not recorded",
        "nextElementIds": [],
        "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,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the results clerk it is not a PDF Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1354,
            "y": 170
          }
        },
        "flowElementId": "B2B61678-E042-4AAF-8132-DB8A90FE3C60",
        "groupId": null,
        "id": "CB21209D-0E62-4080-8490-325A7E77BC48",
        "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": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " was saved to the lab results folder as "
                  },
                  {
                    "id": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "mimeType",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Only PDFs and images can be read, so nothing was recorded in Healthie. <https://drive.google.com/file/d/"
                  },
                  {
                    "id": "RESULT",
                    "label": "New file",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "ECD7C4AD-E861-4C59-AED1-1AED43484B26"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "/view|Open the file>, then save the report as a PDF in the folder or record it by hand."
                  }
                ],
                "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 PDF note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the results clerk it is not a PDF",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "ECD7C4AD-E861-4C59-AED1-1AED43484B26",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "repeat",
          "isFirstElement": false,
          "blockDefinitionId": "repeat",
          "viewport": {
            "x": -70,
            "y": 0,
            "zoom": 1
          },
          "position": {
            "x": 978,
            "y": 349
          }
        },
        "flowElementId": "8C186869-AB39-45D9-8A0A-B9E88367CD05",
        "groupId": null,
        "id": "A345233E-163A-401D-8584-46A47E209445",
        "loopType": "REPEAT",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "91fe7fd1-c4b8-4dff-8c11-ac4f22b8b1f0",
                "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": [
              "91fe7fd1-c4b8-4dff-8c11-ac4f22b8b1f0"
            ]
          },
          "enabled": true,
          "firstElementId": "DEA6BB8D-40DC-4C1F-8D00-BFBD72D531CC",
          "maxIterations": 90,
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "Wait for Textract to finish",
        "nextElementIds": [
          "524C56DF-04F0-458D-9D26-8DA702E82DA5"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "E6B024F6-AEBD-40AA-B5A9-380F92AB6008",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
        "valid": false
      },
      "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
      "executionStaticData": [
        {
          "description": "The Anthropic key the AI step uses.",
          "error": null,
          "name": "Anthropic key",
          "type": "API_KEY",
          "value": null
        },
        {
          "description": "An S3 bucket in the same AWS region as your Textract settings, where each report is stored so Textract can read every page.",
          "error": null,
          "name": "S3 bucket",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "Cells Textract read with less confidence than this (0 to 100) are listed on the review task to check against the page.",
          "error": null,
          "name": "Confidence floor",
          "type": "INT",
          "value": ""
        },
        {
          "description": "Healthie provider IDs keyed by the last name printed on reports as the ordering provider. A name not listed uses the patient's own provider in Healthie, then default.",
          "error": null,
          "name": "Ordering providers",
          "type": "OBJECT",
          "value": ""
        },
        {
          "description": "The URL of the block Wait for the coordinator's answer. The Slack buttons open it.",
          "error": null,
          "name": "Answer link",
          "type": "STRING",
          "value": ""
        }
      ],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-12-02T03:31:57.697Z"
}
