{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "F339445D-AD93-4B99-A890-DACA78326ACE",
    "name": "Formstack: self-referral screened into DrChrono"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -61.2491781722551,
        "y": 3.1821170282708735,
        "zoom": 0.92
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When someone refers themselves on the practice's Formstack form, reads the answers, screens them against the service area, the payers the practice accepts and the age range, finds any existing DrChrono chart, and asks the intake coordinator in Slack whether the patient is a fit. Accepted patients get a DrChrono chart (with the insurance from the form when the chart is new) and an intake task to call and schedule.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When someone refers themselves on the practice's Formstack form, reads the answers, screens them against the service area, the payers the practice accepts and the age range, finds any existing DrChrono chart, and asks the intake coordinator in Slack whether the patient is a fit. Accepted patients get a DrChrono chart (with the insurance from the form when the chart is new) and an intake task to call and schedule.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 528,
            "y": 389
          }
        },
        "flowElementId": "9114435A-C168-42EE-BB92-E434893134F7",
        "groupId": null,
        "id": "D8D68048-45DA-4591-A5E4-FB45A697369E",
        "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": [
          "C8C94BDC-BB5F-4D6B-A1D6-5E6FBE6C4627"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "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": "Create the intake task Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::createTask",
          "legacyElementId": null,
          "methodName": "createTask",
          "position": {
            "x": 164,
            "y": 720
          }
        },
        "flowElementId": "C2B71371-BCA7-4AB1-B8D4-31D197407436",
        "groupId": null,
        "id": "6FA9F6F8-073E-4C6B-999A-C899B005A7AF",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "title",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Call "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "firstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " to schedule a first visit (self-referral)"
                  }
                ],
                "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": [],
                "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": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "20"
                  }
                ],
                "mode": "BASIC",
                "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": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "32598722-4F29-46E8-88CE-83EC305C9164"
                  }
                ],
                "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": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Self-referral from the website form, accepted by the intake coordinator in Slack. Asking for: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "reason",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Screening: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Screen",
                    "subPathSegments": [
                      {
                        "key": "summary",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "95705F8D-AE18-4B43-B9EB-457730730F6A"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "insuranceNote",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "32598722-4F29-46E8-88CE-83EC305C9164"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " Phone "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "phone",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", email "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "email",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Please call to schedule the first visit."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Create the intake task', 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": "Intake task",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Create the intake task",
        "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,
          "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": 149,
            "y": 380
          }
        },
        "flowElementId": "B16D40CB-1D7E-45A2-9004-7451A4A00711",
        "groupId": null,
        "id": "0428EB00-A5A0-4796-B554-B79AF4B19C43",
        "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": "2CFF9231-AE10-47A9-BBC6-D87AC6F5190C"
                  }
                ],
                "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": "EXPRESSION",
                "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": "EXPRESSION",
                "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": "2CFF9231-AE10-47A9-BBC6-D87AC6F5190C"
                  }
                ],
                "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": [
          "D8D68048-45DA-4591-A5E4-FB45A697369E"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 958,
            "y": 559
          }
        },
        "flowElementId": "24715111-5929-4C47-87F9-8F7F2DA0149D",
        "groupId": null,
        "id": "17DA02AC-1BAF-447D-BF64-0D6E7C3A5620",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "3dbf132e-c6ac-4517-bc00-37b41fc61091",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Referral",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "payerName",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              },
              {
                "id": "fbd35dec-76ce-4e18-9915-b0c549968452",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Referral",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "memberId",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "3dbf132e-c6ac-4517-bc00-37b41fc61091",
              "AND",
              "fbd35dec-76ce-4e18-9915-b0c549968452"
            ]
          },
          "elseComponent": {
            "componentId": "32598722-4F29-46E8-88CE-83EC305C9164",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Has insurance",
          "storeResult": false,
          "thenComponent": {
            "componentId": "F8494549-F33E-4FD1-BA19-7781F2197075",
            "componentType": "ELEMENT"
          }
        },
        "name": "Insurance on the form?",
        "nextElementIds": [
          "F8494549-F33E-4FD1-BA19-7781F2197075",
          "32598722-4F29-46E8-88CE-83EC305C9164"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Screen the referral Result"
          },
          "position": {
            "x": 1334,
            "y": 49
          }
        },
        "flowElementId": "BA0C7B4D-B297-40C0-805E-29DA6CD065F7",
        "groupId": null,
        "id": "95705F8D-AE18-4B43-B9EB-457730730F6A",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "referral",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "serviceArea",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Service area",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Service area"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "minAge",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Minimum age",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Minimum age"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxAge",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Maximum age",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Maximum age"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const r = referral || {};\nconst checks = [];\nconst area = String(serviceArea || '').split(',').map((s) => s.trim().toUpperCase()).filter(Boolean);\nconst zip = String(r.zipCode || '').trim().slice(0, 5);\nconst state = String(r.state || '').trim().toUpperCase();\nif (!zip && !state) {\n  checks.push({ name: 'area', pass: false, text: 'service area (no address given)' });\n} else {\n  const inArea = area.includes(state) || (!!zip && area.some((a) => a === zip || (/^\\d{3}$/.test(a) && zip.startsWith(a))));\n  checks.push({ name: 'area', pass: inArea, text: `service area (${[state, zip].filter(Boolean).join(' ')})` });\n}\nif (r.acceptedPayer) checks.push({ name: 'payer', pass: true, text: `payer accepted (${r.acceptedPayer})` });\nelse checks.push({ name: 'payer', pass: false, text: r.payerName ? `payer accepted (${r.payerName} is not on the list)` : 'payer accepted (no insurance given)' });\nlet age = null;\nconst m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(r.dateOfBirth || '');\nif (m) {\n  const now = new Date();\n  const month = now.getUTCMonth() + 1;\n  age = now.getUTCFullYear() - Number(m[1]);\n  if (month < Number(m[2]) || (month === Number(m[2]) && now.getUTCDate() < Number(m[3]))) age -= 1;\n}\nconst lo = Number(minAge);\nconst hi = Number(maxAge);\nif (age === null) checks.push({ name: 'age', pass: false, text: 'age (no date of birth given)' });\nelse checks.push({ name: 'age', pass: age >= lo && age <= hi, text: `age ${lo} to ${hi} (${age})` });\nreturn {\n  age,\n  checks,\n  passesAll: checks.every((c) => c.pass),\n  summary: checks.map((c) => `${c.pass ? 'meets' : 'does not meet'} ${c.text}`).join('; '),\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Screen",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Screen the referral",
        "nextElementIds": [
          "BC9E4270-3B50-4FD3-8A2B-FD72F2F193CE"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves a single form by id, including its full field definitions. The returned fields map each field id to its label and type. This mapping is how you interpret submission data, which stores values keyed by field id (see Get Submission). Uses the Formstack V2025 API (GET /forms/{formId}).",
          "elementId": "EXTENSION:::SHARED:::default:::formstack:::getForm",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get the form's questions Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::formstack:::getForm",
          "legacyElementId": "JS###v1###FormstackService###getForm",
          "methodName": "getForm",
          "position": {
            "x": 558,
            "y": 40
          }
        },
        "flowElementId": "BDA16516-645E-44EB-BA6A-D6D902DDA57E",
        "groupId": null,
        "id": "9C657666-06F5-4288-9C77-88DAD8223684",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "formId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Submission",
                    "subPathSegments": [
                      {
                        "key": "formId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "035CCA5B-A300-4FA3-892F-7D6E4740210B"
                  }
                ],
                "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": "getForm",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Form",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "formstack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get the form's questions",
        "nextElementIds": [
          "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1334,
            "y": 389
          }
        },
        "flowElementId": "A5961506-B804-47F0-A12E-B6CBD63CB396",
        "groupId": null,
        "id": "1531A581-613B-4512-99B6-2694EB0360AA",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "5dc42766-2751-4229-ae48-5374d44a8c69",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Coordinator answer",
                      "subPathSegments": [
                        {
                          "key": "decision",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "D8D68048-45DA-4591-A5E4-FB45A697369E"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "new"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "5dc42766-2751-4229-ae48-5374d44a8c69"
            ]
          },
          "elseComponent": {
            "componentId": "32598722-4F29-46E8-88CE-83EC305C9164",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Is new patient",
          "storeResult": false,
          "thenComponent": {
            "componentId": "ADAC1B40-35A8-4870-91BA-4008A982BDC9",
            "componentType": "ELEMENT"
          }
        },
        "name": "New patient?",
        "nextElementIds": [
          "ADAC1B40-35A8-4870-91BA-4008A982BDC9",
          "32598722-4F29-46E8-88CE-83EC305C9164"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Creates a patient chart. DrChrono refuses a likely duplicate unless Allow Duplicates is on, so search first.",
          "elementId": "EXTENSION:::SHARED:::default:::drchrono:::createPatient",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Open a new chart Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::createPatient",
          "legacyElementId": null,
          "methodName": "createPatient",
          "position": {
            "x": 1334,
            "y": 550
          }
        },
        "flowElementId": "4263753E-1857-4C4F-A56D-15E0D5C67D70",
        "groupId": null,
        "id": "ADAC1B40-35A8-4870-91BA-4008A982BDC9",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "doctor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "firstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "gender",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "gender",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "dateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "middleName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "email",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cellPhone",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "phone",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "homePhone",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "address",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "address",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "city",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "city",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "state",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "state",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "zipCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "zipCode",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "chartId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "referringSource",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Self-referral (website form)"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "allowDuplicates",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Open a new chart', Error: Doctor is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createPatient",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "New patient",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Open a new chart",
        "nextElementIds": [
          "17DA02AC-1BAF-447D-BF64-0D6E7C3A5620"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Saves the primary, secondary or tertiary insurance policy on a patient: payer, plan, member ID, group and subscriber. Fields left blank keep the value on file, so the same step adds a new policy or updates one; to empty a field, pick it in Fields to Clear. DrChrono keeps one policy per slot and overwrites it without history, and changing insurance can make past appointments unbillable.",
          "elementId": "EXTENSION:::SHARED:::default:::drchrono:::upsertPatientInsurance",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Add the insurance Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::upsertPatientInsurance",
          "legacyElementId": null,
          "methodName": "upsertPatientInsurance",
          "position": {
            "x": 573,
            "y": 550
          }
        },
        "flowElementId": "EA69A9D9-9E5D-46C6-9B60-82E1CAAE1FA7",
        "groupId": null,
        "id": "F8494549-F33E-4FD1-BA19-7781F2197075",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "patient",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "New patient",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "ADAC1B40-35A8-4870-91BA-4008A982BDC9"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "priority",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "primary"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "company",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "payerName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "payerId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "planName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "planType",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "memberId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "memberId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "groupNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "groupNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "groupName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "claimOfficePhone",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberIsPatient",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "subscriberIsPatient",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "relationshipToSubscriber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberFirstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "subscriberFirstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberMiddleName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberLastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "subscriberLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberSuffix",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberDateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "subscriberDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberGender",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberAddress",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberCity",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberState",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberZipCode",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subscriberCountry",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Add the insurance', 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": "upsertPatientInsurance",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Insurance",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Add the insurance",
        "nextElementIds": [
          "32598722-4F29-46E8-88CE-83EC305C9164"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Settle on the chart Result"
          },
          "position": {
            "x": 169,
            "y": 559
          }
        },
        "flowElementId": "73B12E91-A597-4F57-AECA-CE36C8C8F7AA",
        "groupId": null,
        "id": "32598722-4F29-46E8-88CE-83EC305C9164",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "referral",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "charts",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Charts",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "950DE039-1685-4D9E-89E6-622B61656442"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answer",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Coordinator answer",
                    "subPathSegments": null,
                    "type": "TRIGGER_DATA",
                    "value": "D8D68048-45DA-4591-A5E4-FB45A697369E"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "created",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "New patient",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "ADAC1B40-35A8-4870-91BA-4008A982BDC9"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const r = referral || {};\nconst insurance = r.payerName ? `${r.payerName}${r.memberId ? `, member ID ${r.memberId}` : ''}${r.groupNumber ? `, group ${r.groupNumber}` : ''}` : 'none given';\nif (created && created.id) {\n  return { patientId: created.id, source: 'new chart', insuranceNote: r.payerName && r.memberId ? `Insurance from the form added as primary: ${insurance}.` : `Insurance on the form: ${insurance}.` };\n}\nif (answer && answer.decision === 'existing' && answer.patient) {\n  const offered = ((charts && charts.candidates) || []).some((c) => String(c.id) === String(answer.patient));\n  if (!offered) throw new Error('The chart in the answer is not one of the charts offered in Slack.');\n  return { patientId: Number(answer.patient), source: 'existing chart', insuranceNote: `Insurance on the form: ${insurance}. It was not added to the existing chart; compare it with the policy on file.` };\n}\nthrow new Error('No chart to put the patient on.');"
              }
            ],
            "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": [
          "6FA9F6F8-073E-4C6B-999A-C899B005A7AF"
        ],
        "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": 110,
            "y": 219
          }
        },
        "flowElementId": "DDC6A3AC-83D3-4399-8EB6-34519F0B43DE",
        "groupId": null,
        "id": "2CFF9231-AE10-47A9-BBC6-D87AC6F5190C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "referral",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "screen",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Screen",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "95705F8D-AE18-4B43-B9EB-457730730F6A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "charts",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Charts",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "950DE039-1685-4D9E-89E6-622B61656442"
                  }
                ],
                "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 fmt = (d) => { const m = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(d || ''); return m ? `${m[2]}/${m[3]}/${m[1]}` : 'not given'; };\nconst link = (params) => `${answerLink}?execution=${encodeURIComponent(executionId)}&${new URLSearchParams(params).toString()}`;\nconst r = referral || {};\nconst c0 = charts || {};\nconst list = c0.candidates || [];\nconst name = [r.firstName, r.lastName].filter(Boolean).join(' ') || 'a person who left no name';\nconst lines = [\n  `*Self-referral from ${name}, born ${fmt(r.dateOfBirth)}*`,\n  `Asking for: ${r.reason || 'no reason given'}`,\n  ...((screen && screen.checks) || []).map((c) => `${c.pass ? 'Meets' : 'Does not meet'}: ${c.text}`),\n];\nif ((r.unanswered || []).length) lines.push(`Not answered on the form: ${r.unanswered.join(', ')}`);\nif (list.length) {\n  lines.push(c0.hasExact ? 'Already has a chart in DrChrono:' : 'No exact match in DrChrono, but these charts share the birth date and a name:');\n  for (const c of list) {\n    const where = [c.city, c.state].filter(Boolean).join(' ');\n    lines.push(`• ${c.name}, born ${fmt(c.dob)}, chart ${c.chartId}${where ? `, ${where}` : ''}`);\n  }\n} else {\n  lines.push('No chart in DrChrono with this name and birth date.');\n}\nlines.push('Is this person a fit for the practice?');\nconst buttons = list.map((c, i) => ({ type: 'button', ...(i === 0 ? { style: 'primary' } : {}), text: { type: 'plain_text', text: `Accept, use chart ${c.chartId}`.slice(0, 75) }, url: link({ decision: 'existing', patient: c.id }) }));\nif (!c0.hasExact) buttons.push({ type: 'button', ...(list.length ? {} : { style: 'primary' }), text: { type: 'plain_text', text: 'Accept as a new patient' }, url: link({ decision: 'new' }) });\nbuttons.push({ type: 'button', style: 'danger', text: { type: 'plain_text', text: 'Decline' }, url: link({ decision: 'decline' }) });\nreturn {\n  text: `Self-referral from ${name}: is this person a fit?`,\n  blocks: [\n    { type: 'section', text: { type: 'mrkdwn', text: lines.join('\\n') } },\n    { type: 'actions', elements: buttons },\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": [
          "0428EB00-A5A0-4796-B554-B79AF4B19C43"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Compare the charts Result"
          },
          "position": {
            "x": 573,
            "y": 219
          }
        },
        "flowElementId": "8D881F1B-04D2-4AE0-9E1E-01F28C9672EA",
        "groupId": null,
        "id": "950DE039-1685-4D9E-89E6-622B61656442",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "referral",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "byLast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "By last name",
                    "subPathSegments": [
                      {
                        "key": "results",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BC9E4270-3B50-4FD3-8A2B-FD72F2F193CE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "byFirst",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "By first name",
                    "subPathSegments": [
                      {
                        "key": "results",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CC32BB33-5C1E-41E2-9AA1-A73DA286F39E"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const norm = (s) => String(s || '').trim().toLowerCase();\nconst r = referral || {};\nconst seen = new Map();\nfor (const p of [...(byLast || []), ...(byFirst || [])]) {\n  if (p && p.id != null && !seen.has(String(p.id))) seen.set(String(p.id), p);\n}\nconst sameBirthDate = r.dateOfBirth ? [...seen.values()].filter((p) => p.date_of_birth === r.dateOfBirth) : [];\nconst exact = sameBirthDate.filter((p) => norm(p.first_name) === norm(r.firstName) && norm(p.last_name) === norm(r.lastName));\nconst pick = (exact.length ? exact : sameBirthDate).slice(0, 3);\nreturn {\n  hasExact: exact.length > 0,\n  exactCount: exact.length,\n  candidates: pick.map((p) => ({ id: p.id, chartId: p.chart_id, name: `${p.first_name} ${p.last_name}`, dob: p.date_of_birth, city: p.city, state: p.state })),\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Charts",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Compare the charts",
        "nextElementIds": [
          "2CFF9231-AE10-47A9-BBC6-D87AC6F5190C"
        ],
        "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. 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 first name and birth date Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 917,
            "y": 210
          }
        },
        "flowElementId": "6702B671-2FDB-4589-96F1-3B059FBE9B2D",
        "groupId": null,
        "id": "CC32BB33-5C1E-41E2-9AA1-A73DA286F39E",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "firstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "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": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "dateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "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: 'Search by first name and 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": "By first name",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by first name and birth date",
        "nextElementIds": [
          "950DE039-1685-4D9E-89E6-622B61656442"
        ],
        "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. 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": "Look for an existing chart Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::drchrono:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 1317,
            "y": 210
          }
        },
        "flowElementId": "E2F76229-C047-4823-AEC1-FA3F4E04FB1A",
        "groupId": null,
        "id": "BC9E4270-3B50-4FD3-8A2B-FD72F2F193CE",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Referral",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "dateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "9A940FE6-DF14-4CAC-8DDE-6506300FA110"
                  }
                ],
                "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: 'Look for an existing chart', 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": "By last name",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "drchrono",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Look for an existing chart",
        "nextElementIds": [
          "CC32BB33-5C1E-41E2-9AA1-A73DA286F39E"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Continuously monitors a Formstack form for new submissions and triggers downstream workflows for each one. Emits the raw submission object, including its field values keyed by field id (use Get Form or List Form Fields to map ids to labels). The first cycle only records a watermark and emits nothing, so the existing backlog is not replayed. Uses the Formstack V2025 API.",
          "elementId": "EXTENSION:::SHARED:::default:::formstack:::onNewSubmission",
          "isFirstElement": true,
          "blockDefinitionId": "EXTENSION:::SHARED:::default:::formstack:::onNewSubmission",
          "newElementId": "EXTENSION:::SHARED:::default:::formstack:::onNewSubmission",
          "legacyElementId": "JS###v1###FormstackService###onNewSubmission",
          "methodName": "onNewSubmission",
          "position": {
            "x": 169,
            "y": 40
          }
        },
        "flowElementId": "6DC1EDF9-0481-4ED9-B3C4-C18991631591",
        "groupId": null,
        "id": "035CCA5B-A300-4FA3-892F-7D6E4740210B",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'New self-referral', Error: Form ID is required",
            "valid": false
          },
          "condition": null,
          "connectionId": null,
          "dynamicData": [],
          "eventName": "onNewSubmission",
          "frequency": {
            "repeat": {
              "every": 300
            },
            "schedule": "custom"
          },
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Submission",
          "serviceId": "formstack",
          "slaConditions": [],
          "staticData": {},
          "storeResult": true,
          "subtype": "POLLING",
          "type": "CUSTOM"
        },
        "name": "New self-referral",
        "nextElementIds": [
          "9C657666-06F5-4288-9C77-88DAD8223684"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": false,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the self-referral Result"
          },
          "tools": {},
          "position": {
            "x": 964,
            "y": 49
          }
        },
        "flowElementId": "735329F2-D759-45F3-A83A-652A10082ACD",
        "groupId": null,
        "id": "9A940FE6-DF14-4CAC-8DDE-6506300FA110",
        "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": "Referral",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "You read a self-referral that a person submitted on a medical practice's website form, asking to become a patient. The submission's answers are keyed by field id; the form's questions give each field id its label. Reply with JSON only, with these fields:\nfirstName: the patient's first name as written\nlastName: the patient's last name as written\ndateOfBirth: the patient's date of birth as YYYY-MM-DD, or empty text\ngender: Male, Female or Other if the form states it, otherwise UNK\nemail: the patient's email address, or empty text\nphone: the patient's phone number with area code, or empty text\naddress: the street address, or empty text\ncity: the city, or empty text\nstate: the two-letter US state, or empty text\nzipCode: the 5-digit ZIP code, or empty text\nreason: why they are asking for care, in one short sentence close to their own words\npayerName: the insurance company as written, or empty text if they gave none or pay for themselves\nacceptedPayer: the name from this list of payers the practice accepts that is the same insurer as payerName, or empty text if none on the list is: "
              },
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Payers we accept",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Payers we accept"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nmemberId: the member ID, or empty text\ngroupNumber: the group number, or empty text\nsubscriberIsPatient: yes if the patient is the policy holder or the form does not say, no if someone else holds the policy\nsubscriberFirstName: the policy holder's first name when it is someone else, otherwise empty text\nsubscriberLastName: the policy holder's last name when it is someone else, otherwise empty text\nsubscriberDateOfBirth: the policy holder's date of birth as YYYY-MM-DD when it is someone else, otherwise empty text\nunanswered: a list of the items the form did not give, chosen from: date of birth, phone or email, ZIP code, insurance\nNever guess a value that is not in the submission. Do not judge whether the person needs care or is a fit; only report what they wrote."
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "Form: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Form",
                "subPathSegments": [
                  {
                    "key": "name",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "9C657666-06F5-4288-9C77-88DAD8223684"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nQuestions on the form: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Form",
                "subPathSegments": [
                  {
                    "key": "fields",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "9C657666-06F5-4288-9C77-88DAD8223684"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nSubmission "
              },
              {
                "id": "RESULT",
                "label": "Submission",
                "subPathSegments": [
                  {
                    "key": "id",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "035CCA5B-A300-4FA3-892F-7D6E4740210B"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ", received "
              },
              {
                "id": "RESULT",
                "label": "Submission",
                "subPathSegments": [
                  {
                    "key": "timestamp",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "035CCA5B-A300-4FA3-892F-7D6E4740210B"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ": "
              },
              {
                "id": "RESULT",
                "label": "Submission",
                "subPathSegments": [
                  {
                    "key": "data",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "035CCA5B-A300-4FA3-892F-7D6E4740210B"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Read the self-referral",
        "nextElementIds": [
          "95705F8D-AE18-4B43-B9EB-457730730F6A"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 967,
            "y": 389
          }
        },
        "flowElementId": "5DC7BD0A-0C0E-41D2-BD87-0BC5B5B18291",
        "groupId": null,
        "id": "C8C94BDC-BB5F-4D6B-A1D6-5E6FBE6C4627",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "13751132-4122-4b81-b3a7-9e677f3f0500",
                "nestedOperation": null,
                "operation": "notEqual",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Coordinator answer",
                      "subPathSegments": [
                        {
                          "key": "decision",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "D8D68048-45DA-4591-A5E4-FB45A697369E"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "decline"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "13751132-4122-4b81-b3a7-9e677f3f0500"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Is accepted",
          "storeResult": false,
          "thenComponent": {
            "componentId": "1531A581-613B-4512-99B6-2694EB0360AA",
            "componentType": "ELEMENT"
          }
        },
        "name": "Accepted?",
        "nextElementIds": [
          "1531A581-613B-4512-99B6-2694EB0360AA"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      }
    ],
    "firstElementId": "035CCA5B-A300-4FA3-892F-7D6E4740210B",
    "groups": [],
    "id": "C3CE7E76-9D17-4D69-A757-357CC79531ED",
    "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 to read the form.",
          "error": null,
          "name": "Anthropic key",
          "type": "API_KEY",
          "value": null
        },
        {
          "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": "The insurance payers you accept, separated by commas.",
          "error": null,
          "name": "Payers we accept",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "Where you take patients, separated by commas: two-letter states, 5-digit ZIP codes, or the first 3 digits of a ZIP code.",
          "error": null,
          "name": "Service area",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The youngest patient you take, in years.",
          "error": null,
          "name": "Minimum age",
          "type": "INT",
          "value": ""
        },
        {
          "description": "The oldest patient you take, in years.",
          "error": null,
          "name": "Maximum age",
          "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-01T03:31:12.696Z"
}
