{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "D78759E0-455A-4B9E-851A-2CEF8DFCDC68",
    "name": "AWS Textract: faxed lab report into DrChrono"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -16.194125159642404,
        "y": 19.565772669220944,
        "zoom": 0.51
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a lab report arrives by fax on Documo, 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 DrChrono 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 doctor a review task listing flagged values, values outside the printed range and cells Textract was unsure of.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "Reads every page of a lab report faxed to Documo with Textract, matches the patient in DrChrono on name and birth date, records the result with each value, gives the ordering doctor a review task, and sends any lab-flagged value to Slack right away.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "a461eb3a-a62a-4709-9738-56108576e9c0",
            "Textract result": "9177500a-c4b9-432b-bb4a-5b3f59468d08"
          },
          "position": {
            "x": 1714,
            "y": 349
          }
        },
        "flowElementId": "FAEDE55A-936D-4C8B-8C02-C1761A291381",
        "groupId": null,
        "id": "07D5564D-4370-47B2-9F75-10AE85095E9F",
        "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": [
          "B2185E9E-F598-4B9B-B60E-860236A35A4E"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "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 fax for Textract Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::s3:::uploadObjectFromUrl",
          "legacyElementId": "JS###v1###S3CompatibleStorage###uploadObjectFromUrl",
          "methodName": "uploadObjectFromUrl",
          "position": {
            "x": 1332,
            "y": 40
          }
        },
        "flowElementId": "5985D691-AFB2-4853-86CC-949B6FEA04B1",
        "groupId": null,
        "id": "70CFC35E-4CF4-425A-B37D-A862F10F5600",
        "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-faxes/"
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ".pdf"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sourceUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "contentType",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "application/pdf"
                  }
                ],
                "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 fax for Textract",
        "nextElementIds": [
          "3DCD0A3F-9420-4569-BD54-8429CCE5FD96"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "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": 1699,
            "y": 40
          }
        },
        "flowElementId": "861ED7A8-A597-435F-AF1D-26B34C54A2EC",
        "groupId": null,
        "id": "3DCD0A3F-9420-4569-BD54-8429CCE5FD96",
        "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": "70CFC35E-4CF4-425A-B37D-A862F10F5600"
                  }
                ],
                "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": "70CFC35E-4CF4-425A-B37D-A862F10F5600"
                  }
                ],
                "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": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "jobTag",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "lab-fax"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "startDocumentAnalysis",
          "onFailElemId": 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": [
          "07D5564D-4370-47B2-9F75-10AE85095E9F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Fires when Documo finishes receiving a fax. The event carries the fax record (message ID, status, result code, fax number, caller ID, CSID, pages, times) and, for a successful fax, its PDF saved to FlowRunner file storage at workspace scope in \"file\" (URL, name, content type, size). \"file\" is null for a failed fax, or when the PDF could not be fetched, with the reason in \"fileError\"; use Download Fax with the message ID then. Optionally only fires for one receiving number or one outcome.",
          "elementId": "EXTENSION:::SHARED:::default:::documo:::onNewInboundFax",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-trigger",
          "newElementId": "EXTENSION:::SHARED:::default:::documo:::onNewInboundFax",
          "legacyElementId": null,
          "methodName": "onNewInboundFax",
          "position": {
            "x": 539,
            "y": 40
          }
        },
        "flowElementId": "BA5317F4-BC20-4F4D-BAD6-E7EE90F1B0AE",
        "groupId": null,
        "id": "88805DA6-A6B6-4343-852D-EF498B689FA3",
        "metaInfo": {
          "callbackUrl": null,
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "connectionId": null,
          "eventName": "onNewInboundFax",
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Fax",
          "scope": "SINGLE_APP",
          "serviceId": "documo",
          "slaConditions": [],
          "staticData": {
            "status": null
          },
          "storeResult": true,
          "subtype": "REALTIME",
          "type": "CUSTOM"
        },
        "name": "New lab fax",
        "nextElementIds": [
          "8AA425EA-E107-4CB2-9F39-D8723E572347"
        ],
        "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": 670
          }
        },
        "flowElementId": "B7ED3930-124A-443D-971A-D5829D67030F",
        "groupId": "B2185E9E-F598-4B9B-B60E-860236A35A4E",
        "id": "9C435853-A18A-41A7-8D8A-371E74A14892",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "jobId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Job",
                    "subPathSegments": [
                      {
                        "key": "jobId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "3DCD0A3F-9420-4569-BD54-8429CCE5FD96"
                  }
                ],
                "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": [
          "6C9E4DD3-A6BB-487B-AB91-00AD4F5B3162"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Reading done": "a8aac092-25ba-4fa7-b83b-65fc62002273",
            "Textract result": "58707e60-ba77-46c5-911a-a4f4605286ef"
          },
          "position": {
            "x": 1034,
            "y": 679
          }
        },
        "flowElementId": "E4D3B966-71D6-4F78-90CF-3693495A6F80",
        "groupId": "B2185E9E-F598-4B9B-B60E-860236A35A4E",
        "id": "3FBEA352-477B-4B64-A64E-EFE4E8C4E301",
        "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": "9C435853-A18A-41A7-8D8A-371E74A14892"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "keep",
          "storeResult": true
        },
        "name": "Keep what Textract read",
        "nextElementIds": [
          "0554C2B8-9EB4-49CD-A3A3-9CCCCF4164AD"
        ],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "break-repeat",
          "isFirstElement": false,
          "blockDefinitionId": "break-repeat",
          "position": {
            "x": 1049,
            "y": 849
          }
        },
        "flowElementId": "6E0311EE-3CED-4D6D-B31E-2E63B0B9CEC8",
        "groupId": "B2185E9E-F598-4B9B-B60E-860236A35A4E",
        "id": "0554C2B8-9EB4-49CD-A3A3-9CCCCF4164AD",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "brk",
          "storeResult": true
        },
        "name": "Done reading",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "BREAK"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 734,
            "y": 679
          }
        },
        "flowElementId": "0EFCDB3D-0223-4A7B-A0B3-38C3CD412B67",
        "groupId": "B2185E9E-F598-4B9B-B60E-860236A35A4E",
        "id": "6C9E4DD3-A6BB-487B-AB91-00AD4F5B3162",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "0379ed6c-59ae-4a5d-90c0-8e8166820aed",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Analysis",
                      "subPathSegments": [
                        {
                          "key": "jobStatus",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "9C435853-A18A-41A7-8D8A-371E74A14892"
                    }
                  ],
                  "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": [
              "0379ed6c-59ae-4a5d-90c0-8e8166820aed"
            ]
          },
          "elseComponent": {
            "componentId": "3FBEA352-477B-4B64-A64E-EFE4E8C4E301",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "still",
          "storeResult": false,
          "thenComponent": null
        },
        "name": "Still reading?",
        "nextElementIds": [
          "3FBEA352-477B-4B64-A64E-EFE4E8C4E301"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "wait",
          "isFirstElement": true,
          "blockDefinitionId": "wait",
          "mode": "SIMPLE",
          "position": {
            "x": 110,
            "y": 679
          }
        },
        "flowElementId": "EDD5C558-C426-4292-B43A-1B0AFCD07D71",
        "groupId": "B2185E9E-F598-4B9B-B60E-860236A35A4E",
        "id": "7C0D0C79-7A4D-4A92-A01B-1958A1AF527F",
        "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": [
          "9C435853-A18A-41A7-8D8A-371E74A14892"
        ],
        "nextGroupIds": [],
        "type": "WAIT"
      },
      {
        "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 intake it could not be read Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 125,
            "y": 340
          }
        },
        "flowElementId": "9084B6FF-F82E-4674-AAA5-2276F376AA79",
        "groupId": null,
        "id": "DDF678B7-9E9A-4428-A476-0D49C899A063",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "The fax from "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "faxCallerId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " at "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "createdAt",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " ("
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "pagesCount",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " pages) was not recorded: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Read",
                    "subPathSegments": [
                      {
                        "key": "problem",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "22DF0DE8-C0FB-4433-B9E5-3E1A79729073"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". <"
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "|Open the fax> 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 intake it was not read",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Gather what Textract read Result"
          },
          "position": {
            "x": 934,
            "y": 349
          }
        },
        "flowElementId": "A60EC6C6-D194-401E-BED4-126B6D3C61B3",
        "groupId": null,
        "id": "22DF0DE8-C0FB-4433-B9E5-3E1A79729073",
        "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": [
          "742692C3-0413-4B6F-8B95-9AD713060CF2"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 539,
            "y": 349
          }
        },
        "flowElementId": "797B1326-859B-4E00-8F68-3F031C2FBA3C",
        "groupId": null,
        "id": "742692C3-0413-4B6F-8B95-9AD713060CF2",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "d0119bce-2e81-4d70-b6b8-825f9a5a8c10",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Read",
                      "subPathSegments": [
                        {
                          "key": "status",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "22DF0DE8-C0FB-4433-B9E5-3E1A79729073"
                    }
                  ],
                  "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": [
              "d0119bce-2e81-4d70-b6b8-825f9a5a8c10"
            ]
          },
          "elseComponent": {
            "componentId": "DDF678B7-9E9A-4428-A476-0D49C899A063",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "readok",
          "storeResult": false,
          "thenComponent": {
            "componentId": "C1200303-CC2B-40C8-B31A-10217CD095E0",
            "componentType": "ELEMENT"
          }
        },
        "name": "Read every page?",
        "nextElementIds": [
          "DDF678B7-9E9A-4428-A476-0D49C899A063",
          "C1200303-CC2B-40C8-B31A-10217CD095E0"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 954,
            "y": 649
          }
        },
        "flowElementId": "C67D0F3B-9CDE-41A4-AF7E-15ABBC3C451D",
        "groupId": null,
        "id": "D836349A-EB83-49B5-BE76-E181D9B2E39C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "6ba16cd7-c12d-4620-b9d2-520c733bd746",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Report",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "isLabResult",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "6ba16cd7-c12d-4620-b9d2-520c733bd746"
            ]
          },
          "elseComponent": {
            "componentId": "7D94777B-D2FC-4328-A27D-829266F99AB9",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "islab",
          "storeResult": false,
          "thenComponent": {
            "componentId": "96F430E7-37CE-4C07-98A2-C0262CBED1F9",
            "componentType": "ELEMENT"
          }
        },
        "name": "Lab result?",
        "nextElementIds": [
          "96F430E7-37CE-4C07-98A2-C0262CBED1F9",
          "7D94777B-D2FC-4328-A27D-829266F99AB9"
        ],
        "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": 539,
            "y": 649
          }
        },
        "flowElementId": "0D09FCE7-A408-40E3-AE18-DC4E440A5EF4",
        "groupId": null,
        "id": "C1200303-CC2B-40C8-B31A-10217CD095E0",
        "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": "A fax came in from caller ID "
              },
              {
                "id": "RESULT",
                "label": "Fax",
                "subPathSegments": [
                  {
                    "key": "faxCallerId",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": " at "
              },
              {
                "id": "RESULT",
                "label": "Fax",
                "subPathSegments": [
                  {
                    "key": "createdAt",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ". Textract read all "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Read",
                "subPathSegments": [
                  {
                    "key": "pages",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "22DF0DE8-C0FB-4433-B9E5-3E1A79729073"
              },
              {
                "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": "22DF0DE8-C0FB-4433-B9E5-3E1A79729073"
              },
              {
                "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": "22DF0DE8-C0FB-4433-B9E5-3E1A79729073"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Line up the results",
        "nextElementIds": [
          "D836349A-EB83-49B5-BE76-E181D9B2E39C"
        ],
        "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": "Send other faxes to intake Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1329,
            "y": 510
          }
        },
        "flowElementId": "E458DF70-0AED-4EE9-897E-DEDBD44EE586",
        "groupId": null,
        "id": "7D94777B-D2FC-4328-A27D-829266F99AB9",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "A fax from "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "faxCallerId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " on the lab results line is not a lab result, so nothing was recorded. <"
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "|Open the fax> and file 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": "Other note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Send other faxes to intake",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Finds patients by name, date of birth, email or chart ID. Name matching is partial and ignores case. Each patient carries chartUrl, the link to their chart in the DrChrono web app. Returns one page of results; pass Next Page Cursor to read the next one.",
          "elementId": "EXTENSION:::SHARED:::default:::drchrono:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Search by last name Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 539,
            "y": 810
          }
        },
        "flowElementId": "6F1E37FD-6DD5-46B7-9852-FDA21BE44501",
        "groupId": null,
        "id": "AC7ABDC9-CFF4-48B8-858F-EBDD018E9D8D",
        "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": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                  }
                ],
                "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": "chartId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "doctor",
              "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": "Block: 'Search by last name', 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": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Last name search",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by last name",
        "nextElementIds": [
          "25F3CADE-C1A5-4884-BA81-6B882EF2F9FF"
        ],
        "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 doctors now Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 2034,
            "y": 640
          }
        },
        "flowElementId": "1347D9B8-74A3-4B68-99FC-3787DE6555F0",
        "groupId": null,
        "id": "17962564-8FC1-4B41-9970-1E18F982199B",
        "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": "96F430E7-37CE-4C07-98A2-C0262CBED1F9"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "\n<"
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "|Open the faxed 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 doctors now",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1693,
            "y": 649
          }
        },
        "flowElementId": "7570930C-4880-4757-B34D-0E53BE87557A",
        "groupId": null,
        "id": "542AFDDE-F8FB-4081-9563-842626E4078B",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "8a1f572e-b69c-4355-95d9-a980e7d07e8d",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Checked",
                      "subPathSegments": [
                        {
                          "key": "anyFlagged",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "96F430E7-37CE-4C07-98A2-C0262CBED1F9"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "8a1f572e-b69c-4355-95d9-a980e7d07e8d"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "anyflag",
          "storeResult": false,
          "thenComponent": {
            "componentId": "17962564-8FC1-4B41-9970-1E18F982199B",
            "componentType": "ELEMENT"
          }
        },
        "name": "Any value the lab flagged?",
        "nextElementIds": [
          "17962564-8FC1-4B41-9970-1E18F982199B"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 142,
            "y": 989
          }
        },
        "flowElementId": "04B04CE2-5612-4479-9661-5614227121B0",
        "groupId": null,
        "id": "36DE611B-F2AB-40BF-9AFF-6A72B27B4354",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "30381997-a119-42a5-ad36-d16f3c6eab31",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Match",
                      "subPathSegments": [
                        {
                          "key": "matched",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "25F3CADE-C1A5-4884-BA81-6B882EF2F9FF"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "30381997-a119-42a5-ad36-d16f3c6eab31"
            ]
          },
          "elseComponent": {
            "componentId": "860D73E3-DB47-4901-8E45-492B73138536",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "one",
          "storeResult": false,
          "thenComponent": {
            "componentId": "4FA2FD31-704C-4092-B3F2-864E60ACEDA0",
            "componentType": "ELEMENT"
          }
        },
        "name": "One exact match?",
        "nextElementIds": [
          "4FA2FD31-704C-4092-B3F2-864E60ACEDA0",
          "860D73E3-DB47-4901-8E45-492B73138536"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check every value Result"
          },
          "position": {
            "x": 1349,
            "y": 649
          }
        },
        "flowElementId": "7C7260B1-B682-4B58-A608-E52272417221",
        "groupId": null,
        "id": "96F430E7-37CE-4C07-98A2-C0262CBED1F9",
        "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": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "read",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Read",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "22DF0DE8-C0FB-4433-B9E5-3E1A79729073"
                  }
                ],
                "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 DrChrono chart once the chart is matched on name and birth date, and the ordering doctor 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": [
          "542AFDDE-F8FB-4081-9563-842626E4078B",
          "56E4763B-9945-49EF-A3C6-C850E9D7E92B"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Finds patients by name, date of birth, email or chart ID. Name matching is partial and ignores case. Each patient carries chartUrl, the link to their chart in the DrChrono web app. Returns one page of results; pass Next Page Cursor to read the next one.",
          "elementId": "EXTENSION:::SHARED:::default:::drchrono:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the patient in DrChrono Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 1322,
            "y": 810
          }
        },
        "flowElementId": "6622A0CC-3FB5-4984-A305-092832D93447",
        "groupId": null,
        "id": "56E4763B-9945-49EF-A3C6-C850E9D7E92B",
        "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": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                  }
                ],
                "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": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                  }
                ],
                "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": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "chartId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "doctor",
              "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": "Block: 'Find the patient in DrChrono', 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": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Exact search",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the patient in DrChrono",
        "nextElementIds": [
          "3143261F-C5AC-42A1-BB2A-9E809BC110E3"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Finds patients by name, date of birth, email or chart ID. Name matching is partial and ignores case. Each patient carries chartUrl, the link to their chart in the DrChrono web app. Returns one page of results; pass Next Page Cursor to read the next one.",
          "elementId": "EXTENSION:::SHARED:::default:::drchrono:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Search by birth date Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 954,
            "y": 810
          }
        },
        "flowElementId": "3777DDDB-AED9-4EB9-81DC-1BE15BC9A1EE",
        "groupId": null,
        "id": "3143261F-C5AC-42A1-BB2A-9E809BC110E3",
        "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": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "chartId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "doctor",
              "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": "Block: 'Search by birth date', 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": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Birth date search",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by birth date",
        "nextElementIds": [
          "AC7ABDC9-CFF4-48B8-858F-EBDD018E9D8D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "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": 110,
            "y": 819
          }
        },
        "flowElementId": "D294D7F5-82AC-4840-8E37-64D531799FB8",
        "groupId": null,
        "id": "25F3CADE-C1A5-4884-BA81-6B882EF2F9FF",
        "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": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "exact",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Exact search",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "56E4763B-9945-49EF-A3C6-C850E9D7E92B"
                  }
                ],
                "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": "3143261F-C5AC-42A1-BB2A-9E809BC110E3"
                  }
                ],
                "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": "AC7ABDC9-CFF4-48B8-858F-EBDD018E9D8D"
                  }
                ],
                "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.results) || []).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.date_of_birth) === dob) why.push('same birth date');\n  return { id: String(p.id), name: `${p.first_name || ''} ${p.last_name || ''}`.trim(), dob: day(p.date_of_birth), chartUrl: p.chartUrl || '', doctor: p.doctor || null, 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": [
          "36DE611B-F2AB-40BF-9AFF-6A72B27B4354"
        ],
        "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": 480,
            "y": 989
          }
        },
        "flowElementId": "E95ED2C8-1810-4693-9291-B030A001363D",
        "groupId": null,
        "id": "860D73E3-DB47-4901-8E45-492B73138536",
        "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": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "match",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Match",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "25F3CADE-C1A5-4884-BA81-6B882EF2F9FF"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "faxUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  }
                ],
                "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 DrChrono chart has this name and birth date. Which chart is it?',\n  near: 'No DrChrono chart matches this name and birth date exactly. These charts look close:',\n  none: 'No DrChrono chart matches this name and birth date, and none looks close.',\n}[match && match.situation] || 'Which chart is it?';\nconst lines = [\n  `*Faxed 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 faxed 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 DrChrono: I will handle it' }, url: link({ decision: 'manual' }) });\nreturn {\n  text: `Faxed lab result for ${name}: which DrChrono 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": [
          "6F13A218-4FE3-400E-9C80-4D67E12A3460"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Records a lab result that arrived outside an electronic lab interface, for example by fax: creates a lab order and its test, files the result PDF as the order's result document, adds each result value, and marks the order Results Received. Writing needs DrChrono's Lab Vendor permission on your API application (requested from api@drchrono.com) and the Lab Vendor Access config option. Without result values only the PDF is filed.",
          "elementId": "EXTENSION:::SHARED:::default:::drchrono:::recordLabResult",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Record the result in DrChrono Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::recordLabResult",
          "legacyElementId": null,
          "methodName": "recordLabResult",
          "position": {
            "x": 507,
            "y": 1320
          }
        },
        "flowElementId": "DDDE2BB5-EC8C-439D-919A-584260FA620A",
        "groupId": null,
        "id": "84A79781-5916-48E0-8823-C4D0345C95A9",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "patient",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "4FA2FD31-704C-4092-B3F2-864E60ACEDA0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "doctor",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "doctor",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sublab",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "sublab",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "fileName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "testName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "testName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "testCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "testCode",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "collectionDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "collectionDate",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "status",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "testPerformed",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "testPerformed",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "specimenReceived",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "specimenReceived",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "results",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Checked",
                    "subPathSegments": [
                      {
                        "key": "drchronoResults",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "96F430E7-37CE-4C07-98A2-C0262CBED1F9"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "accessionNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "accessionNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "orderNotes",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "orderNotes",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Record the result in DrChrono', 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": "recordLabResult",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Recorded",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Record the result in DrChrono",
        "nextElementIds": [
          "67E79667-B495-4BDE-B2FF-40DB981E7501"
        ],
        "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": 141,
            "y": 1159
          }
        },
        "flowElementId": "2852D56D-D610-4576-AC14-DBECF50D8BCA",
        "groupId": null,
        "id": "A5C984A7-A649-4723-8578-91BB9EB319D5",
        "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": "C1200303-CC2B-40C8-B31A-10217CD095E0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "chart",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "4FA2FD31-704C-4092-B3F2-864E60ACEDA0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "checked",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Checked",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "96F430E7-37CE-4C07-98A2-C0262CBED1F9"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sublabs",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Sublabs",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "A6D56C05-3952-4699-B003-3B67D9631AAA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "doctors",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Ordering doctors",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Ordering doctors"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "defaultSublab",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Default sublab",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Default sublab"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "callerId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "faxCallerId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "file",
                        "optional": false
                      },
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const s = (v) => String(v == null ? '' : v).trim();\nconst dt = (v) => { const m = /^(\\d{4}-\\d{2}-\\d{2})(?:[T ](\\d{2}:\\d{2})(?::(\\d{2}))?)?/.exec(s(v)); return m ? `${m[1]}T${m[2] || '00:00'}:${m[3] || '00'}` : ''; };\nconst collected = dt(report.collectionDate);\nconst received = dt(report.receivedDate);\nconst reported = dt(report.reportedDate);\nconst testPerformed = reported || received || collected || new Date().toISOString().slice(0, 19);\nconst map = doctors && typeof doctors === 'object' ? doctors : {};\nconst provider = s(report.orderingProvider).toLowerCase();\nconst key = Object.keys(map).find((k) => k !== 'default' && k.trim() && provider.includes(k.trim().toLowerCase()));\nconst pick = (key && map[key]) || map.default || {};\nconst doctor = Number(pick.doctor) || Number(chart.doctor) || 0;\nconst assigneeUser = s(pick.user);\nconst labName = s(report.labName).toLowerCase();\nconst subs = (sublabs && sublabs.results) || [];\nconst sub = labName ? subs.find((x) => [x.name, x.vendor_name, x.facility_code].some((v) => s(v) && (labName.includes(s(v).toLowerCase()) || s(v).toLowerCase().includes(labName)))) : null;\nconst sublab = (sub && Number(sub.id)) || Number(defaultSublab) || (subs.length === 1 ? Number(subs[0].id) : 0);\nconst status = /prelim/i.test(report.reportStatus) ? 'P' : (/correct|amend/i.test(report.reportStatus) ? 'C' : 'F');\nconst panel = s(report.panelName) || 'Lab result';\nconst name = s(chart.name);\nconst header = [\n  `${panel} from ${s(report.labName) || 'the lab'}, received by fax from ${s(callerId) || 'an unknown number'}.`,\n  `Ordering provider on the report: ${s(report.orderingProvider) || 'not printed'}.`,\n  `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 problems = [];\nif (!doctor || !assigneeUser) problems.push(`there is no DrChrono doctor and user for the ordering provider \"${s(report.orderingProvider) || 'not printed'}\" and no default in the flow setting Ordering doctors`);\nif (!sublab) problems.push(`there is no DrChrono sublab for the lab \"${s(report.labName) || 'not printed'}\" and no Default sublab`);\nconst problemText = problems.length ? `*Lab result for ${name} was not recorded in DrChrono*: ${problems.join(', and ')}. ${chart.chartUrl ? `<${chart.chartUrl}|Open the chart>` : ''} ${fileUrl ? `<${fileUrl}|Open the faxed report>` : ''} Record it by hand and fill in the flow setting so the next one records itself.`.replace(/\\s+/g, ' ').trim() : '';\nreturn {\n  ok: problems.length === 0, problemText,\n  doctor, assigneeUser, sublab, status, testPerformed,\n  collectionDate: collected, specimenReceived: received,\n  testName: panel.slice(0, 200), testCode: s(report.panelCode), accessionNumber: s(report.accessionNumber).slice(0, 70),\n  fileName: `lab-result-${(s(report.accessionNumber) || 'fax').replace(/[^A-Za-z0-9-]/g, '')}.pdf`,\n  orderNotes: `Recorded from a faxed report read by FlowRunner.${collected ? '' : ' The report prints no collection date.'}`,\n  priority: checked.anyCritical ? '40' : (checked.anyFlagged ? '30' : '20'),\n  title: `Review lab result: ${panel} for ${name}`.slice(0, 200),\n  note: `${header}\\n\\n${checked.reviewText}`,\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": [
          "F5B7723F-56F8-4F3D-9736-11C8D3546326"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1349,
            "y": 1159
          }
        },
        "flowElementId": "9E775428-11E5-4276-8606-2E8C28E4813C",
        "groupId": null,
        "id": "A467939D-00D7-4B45-94B6-386E0F1EA2AF",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "97b6538c-2ad2-4dc2-8940-257ab942454e",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Coordinator answer",
                      "subPathSegments": [
                        {
                          "key": "decision",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "E1024AF6-192A-466C-9706-921D30878343"
                    }
                  ],
                  "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": [
              "97b6538c-2ad2-4dc2-8940-257ab942454e"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "picked",
          "storeResult": false,
          "thenComponent": {
            "componentId": "4FA2FD31-704C-4092-B3F2-864E60ACEDA0",
            "componentType": "ELEMENT"
          }
        },
        "name": "Chart picked?",
        "nextElementIds": [
          "4FA2FD31-704C-4092-B3F2-864E60ACEDA0"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Lists the labs registered by your lab vendor application, with the ID that Record Lab Result takes as Sublab. Needs DrChrono's Lab Vendor permission on your API application (requested from api@drchrono.com) and the Lab Vendor Access config option.",
          "elementId": "EXTENSION:::SHARED:::default:::drchrono:::listSublabs",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "List your labs Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::listSublabs",
          "legacyElementId": null,
          "methodName": "listSublabs",
          "position": {
            "x": 539,
            "y": 1150
          }
        },
        "flowElementId": "4D40AF78-0439-4B5A-B07E-F88757B03A80",
        "groupId": null,
        "id": "A6D56C05-3952-4699-B003-3B67D9631AAA",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 100
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'List your labs', 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": "listSublabs",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Sublabs",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "List your labs",
        "nextElementIds": [
          "A5C984A7-A649-4723-8578-91BB9EB319D5"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 1304,
            "y": 989
          }
        },
        "flowElementId": "EAAF012E-C12C-4692-97CF-579592A4EFDA",
        "groupId": null,
        "id": "E1024AF6-192A-466C-9706-921D30878343",
        "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": [
          "A467939D-00D7-4B45-94B6-386E0F1EA2AF"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Settle on the chart Result"
          },
          "position": {
            "x": 954,
            "y": 1159
          }
        },
        "flowElementId": "792ECC7C-BE5B-4259-9987-92E1C2D1F2B0",
        "groupId": null,
        "id": "4FA2FD31-704C-4092-B3F2-864E60ACEDA0",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "match",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Match",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "25F3CADE-C1A5-4884-BA81-6B882EF2F9FF"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answer",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Coordinator answer",
                    "subPathSegments": null,
                    "type": "TRIGGER_DATA",
                    "value": "E1024AF6-192A-466C-9706-921D30878343"
                  }
                ],
                "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": [
          "A6D56C05-3952-4699-B003-3B67D9631AAA"
        ],
        "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": 933,
            "y": 980
          }
        },
        "flowElementId": "B8322923-92D9-4835-997C-AD30F77E6D07",
        "groupId": null,
        "id": "6F13A218-4FE3-400E-9C80-4D67E12A3460",
        "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": "860D73E3-DB47-4901-8E45-492B73138536"
                  }
                ],
                "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": "860D73E3-DB47-4901-8E45-492B73138536"
                  }
                ],
                "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": [
          "E1024AF6-192A-466C-9706-921D30878343"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Creates a task in DrChrono's task center, assigned to a user or a group and linked to a patient, appointment or document. A referral is usually filed as a document plus a task.",
          "elementId": "EXTENSION:::SHARED:::default:::drchrono:::createTask",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Review task for the ordering doctor Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::createTask",
          "legacyElementId": null,
          "methodName": "createTask",
          "position": {
            "x": 903,
            "y": 1320
          }
        },
        "flowElementId": "6B68CB12-305D-4CE1-B68C-5559BAE9650A",
        "groupId": null,
        "id": "67E79667-B495-4BDE-B2FF-40DB981E7501",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "title",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "title",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "category",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "assigneeUser",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "assigneeUser",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "assigneeGroup",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "priority",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "priority",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dueTime",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "patient",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "4FA2FD31-704C-4092-B3F2-864E60ACEDA0"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "appointment",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "document",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "note",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ready",
                    "subPathSegments": [
                      {
                        "key": "note",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Review task for the ordering doctor', Error: Status is required",
            "valid": false
          },
          "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": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Review task for the ordering doctor",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 954,
            "y": 49
          }
        },
        "flowElementId": "883759D2-0460-4466-8019-9C17268C3F29",
        "groupId": null,
        "id": "8AA425EA-E107-4CB2-9F39-D8723E572347",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "d655b39e-633b-45bc-aa9e-1cbd5e5c77d8",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Fax",
                      "subPathSegments": [
                        {
                          "key": "file",
                          "optional": false
                        },
                        {
                          "key": "url",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "d655b39e-633b-45bc-aa9e-1cbd5e5c77d8"
            ]
          },
          "elseComponent": {
            "componentId": "E7234587-DB20-4BE0-8C61-03F8769B9191",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "haspdf",
          "storeResult": false,
          "thenComponent": {
            "componentId": "70CFC35E-4CF4-425A-B37D-A862F10F5600",
            "componentType": "ELEMENT"
          }
        },
        "name": "Fax PDF saved?",
        "nextElementIds": [
          "70CFC35E-4CF4-425A-B37D-A862F10F5600",
          "E7234587-DB20-4BE0-8C61-03F8769B9191"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 134,
            "y": 1329
          }
        },
        "flowElementId": "F081C28E-3649-485C-9FA3-9A1C19A3887E",
        "groupId": null,
        "id": "F5B7723F-56F8-4F3D-9736-11C8D3546326",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "bec7aaba-4145-4d80-b01d-976ff8bc9f9c",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Ready",
                      "subPathSegments": [
                        {
                          "key": "ok",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "bec7aaba-4145-4d80-b01d-976ff8bc9f9c"
            ]
          },
          "elseComponent": {
            "componentId": "A8CAE461-32F8-4A10-BEC0-52F0C3306710",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "okrec",
          "storeResult": false,
          "thenComponent": {
            "componentId": "84A79781-5916-48E0-8823-C4D0345C95A9",
            "componentType": "ELEMENT"
          }
        },
        "name": "Doctor and lab known?",
        "nextElementIds": [
          "A8CAE461-32F8-4A10-BEC0-52F0C3306710",
          "84A79781-5916-48E0-8823-C4D0345C95A9"
        ],
        "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 intake the fax has no PDF Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1318,
            "y": 170
          }
        },
        "flowElementId": "FC558810-81C3-4B2E-8F9C-B0EB6044853D",
        "groupId": null,
        "id": "E7234587-DB20-4BE0-8C61-03F8769B9191",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "A fax from "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "faxCallerId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " at "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "createdAt",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " on the lab results line came in with no readable PDF (Documo status "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "status",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "resultInfo",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "fileError",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "), so nothing was read or recorded. Find message "
                  },
                  {
                    "id": "RESULT",
                    "label": "Fax",
                    "subPathSegments": [
                      {
                        "key": "messageId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "88805DA6-A6B6-4343-852D-EF498B689FA3"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " in Documo, or ask the sender to fax it again, 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": "No PDF note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell intake the fax has no PDF",
        "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 coordinator it was not recorded Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 474,
            "y": 1450
          }
        },
        "flowElementId": "11D2AF92-0F6F-40E7-9B98-D53C31708CBD",
        "groupId": null,
        "id": "A8CAE461-32F8-4A10-BEC0-52F0C3306710",
        "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": "A5C984A7-A649-4723-8578-91BB9EB319D5"
                  }
                ],
                "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"
      }
    ],
    "firstElementId": "88805DA6-A6B6-4343-852D-EF498B689FA3",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "repeat",
          "isFirstElement": false,
          "blockDefinitionId": "repeat",
          "viewport": {
            "x": -70,
            "y": -630,
            "zoom": 1
          },
          "position": {
            "x": 1331,
            "y": 349
          }
        },
        "flowElementId": "F0BE6B49-60BC-4A8D-A56F-1D0C29FCCB95",
        "groupId": null,
        "id": "B2185E9E-F598-4B9B-B60E-860236A35A4E",
        "loopType": "REPEAT",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "51303c1a-131a-45e5-ad02-58381ce6d925",
                "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": [
              "51303c1a-131a-45e5-ad02-58381ce6d925"
            ]
          },
          "enabled": true,
          "firstElementId": "7C0D0C79-7A4D-4A92-A01B-1958A1AF527F",
          "maxIterations": 90,
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "Wait for Textract to finish",
        "nextElementIds": [
          "22DF0DE8-C0FB-4433-B9E5-3E1A79729073"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "894C6FEB-E0F8-4CB2-9CFE-EAFAB05EF0CD",
    "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 fax 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": "The URL of the block Wait for the coordinator's answer. The Slack buttons open it.",
          "error": null,
          "name": "Answer link",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "For each ordering provider, keyed by the last name printed on reports: their DrChrono doctor ID (doctor) and the DrChrono user ID that gets the review task (user). default is used when the name on the report is not listed.",
          "error": null,
          "name": "Ordering doctors",
          "type": "OBJECT",
          "value": ""
        },
        {
          "description": "The DrChrono sublab ID used when the lab named on the report matches none of your sublabs. 0 uses your only sublab when there is just one.",
          "error": null,
          "name": "Default sublab",
          "type": "INT",
          "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:44.735Z"
}
