{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "6FA28BA3-CA2D-48D2-8F9C-7CD05CF1871C",
    "name": "Jotform: new-patient form to a Healthie chart"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -929.8558322411534,
        "y": 19.03014416775885,
        "zoom": 0.52
      },
      "autoSave": false,
      "descriptions": {
        "flow": "Runs the moment a patient submits your Jotform new-patient intake form. Reads the form, finds the patient's Healthie chart by name and birth date or creates it, files the signed form on the chart as a PDF, and adds the insurance from the form as the primary policy when none is on file. A near match on an existing chart goes to the intake coordinator in Slack first, a form that can't be filed becomes a Healthie task, and a card that differs from the policy on file becomes a front desk task.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "Checks your Jotform new-patient intake form for new submissions, reads each one, finds or creates the patient's Healthie chart, and adds the insurance from the form when none is on file. A near match goes to the intake coordinator in Slack; a card that differs from the policy on file becomes a front desk task.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Looks for existing patients by first name, last name, date of birth and email, optionally narrowed by phone number, so an incoming referral is matched to the right chart before a new patient is created. Every term you fill in must match. Healthie does not search by phone number itself, so give at least one other term with it.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the patient's chart Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 2641,
            "y": 40
          }
        },
        "flowElementId": "F029A9E8-2445-4DB2-88A8-BCFC5B501392",
        "groupId": null,
        "id": "6E66DE3B-A06D-4C38-8774-D9900628C87F",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "firstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "dateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phoneNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 25
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Patient match",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the patient's chart",
        "nextElementIds": [
          "5F8E3E54-4A4C-45C6-8D46-942DD80037A0"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": false,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the intake form Result"
          },
          "tools": {},
          "position": {
            "x": 2253,
            "y": 49
          }
        },
        "flowElementId": "A8C33AF6-1A20-4F92-BBDB-2736285DCD13",
        "groupId": null,
        "id": "BE567D45-7E09-4145-B53A-C7767F644DCD",
        "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": "Intake",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "You read a new-patient intake form that a patient filled in on Jotform for a medical practice. The answers follow as question:answer pairs separated by commas. 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\nemail: the patient's email address, or empty text\nphone: the patient's phone number with area code, or empty text\ngender: Male, Female or Other, only if the form states it, otherwise empty text\ntimezone: the IANA time zone of the patient's address, such as America/Chicago; if the form does not show where the patient lives, use "
              },
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Practice time zone",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Practice time zone"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nhasInsurance: true only if the form gives an insurance payer and a member ID; false when the patient chose self-pay or left insurance blank\npayerName: the insurance payer's name, or empty text\npayerSearch: the payer ID if the form gives one, otherwise the payer's name, or empty text\nmemberId: the member ID, or empty text\ngroupNumber: the group number, or empty text\nholderRelationship: how the patient is related to the policy holder: Self, Spouse, Child or Other\nholderFirstName: the policy holder's first name when the holder is not the patient, otherwise empty text\nholderLastName: the policy holder's last name when the holder is not the patient, otherwise empty text\nholderDateOfBirth: the policy holder's date of birth as YYYY-MM-DD when the holder is not the patient, otherwise empty text\nIgnore links to uploaded files and signatures. Never guess a value that is not on the form."
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "New-patient form submitted on Jotform at "
              },
              {
                "id": "RESULT",
                "label": "Form",
                "subPathSegments": [
                  {
                    "key": "created_at",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ", submission "
              },
              {
                "id": "RESULT",
                "label": "Form",
                "subPathSegments": [
                  {
                    "key": "id",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ". Today is "
              },
              {
                "id": "GET_CURRENT_DATE",
                "label": null,
                "type": "GET_CURRENT_DATE_TIME",
                "value": null
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": ".\n\n"
              },
              {
                "id": "RESULT",
                "label": "Form",
                "subPathSegments": [
                  {
                    "key": "pretty",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Read the intake form",
        "nextElementIds": [
          "6E66DE3B-A06D-4C38-8774-D9900628C87F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Looks for existing patients by first name, last name, date of birth and email, optionally narrowed by phone number, so an incoming referral is matched to the right chart before a new patient is created. Every term you fill in must match. Healthie does not search by phone number itself, so give at least one other term with it.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Search by last name and phone Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 2613,
            "y": 210
          }
        },
        "flowElementId": "8445E0E9-12B2-4D7D-8497-701BA9E037FC",
        "groupId": null,
        "id": "635D514E-8525-4BED-A1D3-02DD43F64398",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phoneNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "phone",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 25
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "By phone",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by last name and phone",
        "nextElementIds": [
          "A646923B-158C-498D-8925-1C61694D91A5"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Looks for existing patients by first name, last name, date of birth and email, optionally narrowed by phone number, so an incoming referral is matched to the right chart before a new patient is created. Every term you fill in must match. Healthie does not search by phone number itself, so give at least one other term with it.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Search by last name and birth date Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 2987,
            "y": 210
          }
        },
        "flowElementId": "FED442EB-7D72-44EF-88C3-BAF638D92B46",
        "groupId": null,
        "id": "92B514EA-389C-4816-955E-CAD3D8627306",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "dateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phoneNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 25
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "By birth date",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by last name and birth date",
        "nextElementIds": [
          "635D514E-8525-4BED-A1D3-02DD43F64398"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 3036,
            "y": 49
          }
        },
        "flowElementId": "D9A70B57-9886-4602-AA42-A2E6840B0FEC",
        "groupId": null,
        "id": "5F8E3E54-4A4C-45C6-8D46-942DD80037A0",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "e927b2bf-a011-4269-963d-3ab0d7721c10",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Patient match",
                      "subPathSegments": [
                        {
                          "key": "found",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "6E66DE3B-A06D-4C38-8774-D9900628C87F"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              },
              {
                "id": "3f99c873-8828-4dd8-8edb-d19b396b6fb5",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Intake",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "dateOfBirth",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "e927b2bf-a011-4269-963d-3ab0d7721c10",
              "AND",
              "3f99c873-8828-4dd8-8edb-d19b396b6fb5"
            ]
          },
          "elseComponent": {
            "componentId": "92B514EA-389C-4816-955E-CAD3D8627306",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Chart found",
          "storeResult": false,
          "thenComponent": {
            "componentId": "893301F0-3BA8-400A-9C8A-5DD60C34FF5C",
            "componentType": "ELEMENT"
          }
        },
        "name": "Chart found?",
        "nextElementIds": [
          "893301F0-3BA8-400A-9C8A-5DD60C34FF5C",
          "92B514EA-389C-4816-955E-CAD3D8627306"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Looks for existing patients by first name, last name, date of birth and email, optionally narrowed by phone number, so an incoming referral is matched to the right chart before a new patient is created. Every term you fill in must match. Healthie does not search by phone number itself, so give at least one other term with it.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Search by last name and email Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchPatients",
          "legacyElementId": null,
          "methodName": "searchPatients",
          "position": {
            "x": 2220,
            "y": 210
          }
        },
        "flowElementId": "7F20E8C6-A199-4BC6-8C9F-6F910E4D3181",
        "groupId": null,
        "id": "A646923B-158C-498D-8925-1C61694D91A5",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "email",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phoneNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 25
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "searchPatients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "By email",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search by last name and email",
        "nextElementIds": [
          "96A42B92-7307-4D7D-8343-B4915BDB0226"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1873,
            "y": 389
          }
        },
        "flowElementId": "2296742E-07BB-4B89-8E24-73F9B6E05D75",
        "groupId": null,
        "id": "F7F5A0C3-8FF1-4A7D-A05F-A3ED9BF94F6A",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "bd3a8e87-8774-45db-93b2-98a2f3c045f7",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Likely match",
                      "subPathSegments": [
                        {
                          "key": "found",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "96A42B92-7307-4D7D-8343-B4915BDB0226"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "bd3a8e87-8774-45db-93b2-98a2f3c045f7"
            ]
          },
          "elseComponent": {
            "componentId": "7B93AAD3-C0A0-4FC7-9EFA-8C70A3AB5910",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Has likely match",
          "storeResult": false,
          "thenComponent": {
            "componentId": "124DDD0B-4111-43ED-B7D2-AE892ECEB274",
            "componentType": "ELEMENT"
          }
        },
        "name": "Likely match?",
        "nextElementIds": [
          "7B93AAD3-C0A0-4FC7-9EFA-8C70A3AB5910",
          "124DDD0B-4111-43ED-B7D2-AE892ECEB274"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Pick the likely match Result"
          },
          "position": {
            "x": 1872,
            "y": 219
          }
        },
        "flowElementId": "F34F6313-FC0A-41C4-AC89-A42CE65B899F",
        "groupId": null,
        "id": "96A42B92-7307-4D7D-8343-B4915BDB0226",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "byBirthDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "By birth date",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "92B514EA-389C-4816-955E-CAD3D8627306"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "byPhone",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "By phone",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "635D514E-8525-4BED-A1D3-02DD43F64398"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "byEmail",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "By email",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "A646923B-158C-498D-8925-1C61694D91A5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dob",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "dateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phone",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "phone",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "email",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const found = new Map();\nconst add = (result, why) => {\n  for (const p of (result && result.patients) || []) {\n    if (!p || !p.id) continue;\n    const id = String(p.id);\n    const c = found.get(id) || { id, name: p.full_name || [p.first_name, p.last_name].filter(Boolean).join(' '), dob: p.dob || '', reasons: [] };\n    if (!c.reasons.includes(why)) c.reasons.push(why);\n    found.set(id, c);\n  }\n};\n// A search with an empty term returns everyone with the last name, so only count a search the form gave a value for.\nif (dob) add(byBirthDate, 'same last name and birth date');\nif (phone) add(byPhone, 'same phone number');\nif (email) add(byEmail, 'same email');\nconst candidates = [...found.values()].sort((a, b) => b.reasons.length - a.reasons.length).slice(0, 3);\nreturn { found: candidates.length > 0, candidates, total: found.size };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Likely match",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Pick the likely match",
        "nextElementIds": [
          "F7F5A0C3-8FF1-4A7D-A05F-A3ED9BF94F6A"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 2991,
            "y": 389
          }
        },
        "flowElementId": "6D30C77F-4950-4C9F-9C28-C77D930AC43A",
        "groupId": null,
        "id": "44A24213-2B06-4427-9D00-53603B7B2A0E",
        "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": [
          "5EF638DA-433F-46F9-96A3-A2397470E252"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Creates a new patient in Healthie, assigned to a provider. Leave Email empty for a patient without one; Healthie then records that the email was skipped.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::createPatient",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Create the patient Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::createPatient",
          "legacyElementId": null,
          "methodName": "createPatient",
          "position": {
            "x": 2650,
            "y": 550
          }
        },
        "flowElementId": "C67C3876-CBFF-4378-92EB-749929D503D2",
        "groupId": null,
        "id": "7B93AAD3-C0A0-4FC7-9EFA-8C70A3AB5910",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "firstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "legalName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "dateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "email",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "email",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "phoneNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "phone",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "gender",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "gender",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "providerId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "recordIdentifier",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "timezone",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "timezone",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dontSendWelcome",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "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": "createPatient",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "New patient",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Create the patient",
        "nextElementIds": [
          "893301F0-3BA8-400A-9C8A-5DD60C34FF5C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Finds insurance plans (payers) in Healthie's plan list by payer name or payer ID, so a payer known only when the flow runs, such as the one on a referral or an eligibility check, can be turned into the plan ID that Create and Update Patient Insurance Policy take. The plan whose payer ID or name equals the search is returned first.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::searchInsurancePlans",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the payer in Healthie Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::searchInsurancePlans",
          "legacyElementId": null,
          "methodName": "searchInsurancePlans",
          "position": {
            "x": 3018,
            "y": 1280
          }
        },
        "flowElementId": "2EAEC163-D96B-4BCA-8540-071C515A2C89",
        "groupId": null,
        "id": "7A826B16-16DB-45E6-A267-6AC724404164",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "keywords",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "payerSearch",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "acceptedOnly",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pageSize",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 25
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "searchInsurancePlans",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Payer",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the payer in Healthie",
        "nextElementIds": [
          "4F04EC55-2404-440A-8319-73FB8BDE1098"
        ],
        "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": 2254,
            "y": 559
          }
        },
        "flowElementId": "67022CC0-EDB8-4F7F-B2E3-EC51053D0898",
        "groupId": null,
        "id": "893301F0-3BA8-400A-9C8A-5DD60C34FF5C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "exact",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Patient match",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "6E66DE3B-A06D-4C38-8774-D9900628C87F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "match",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Likely match",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "96A42B92-7307-4D7D-8343-B4915BDB0226"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answer",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Coordinator answer",
                    "subPathSegments": null,
                    "type": "TRIGGER_DATA",
                    "value": "44A24213-2B06-4427-9D00-53603B7B2A0E"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "created",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "New patient",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "7B93AAD3-C0A0-4FC7-9EFA-8C70A3AB5910"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "if (created && created.id) return { patientId: String(created.id), source: 'new chart' };\nif (answer && answer.patient) {\n  const offered = ((match && match.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: String(answer.patient), source: 'chart picked by the intake coordinator' };\n}\nif (exact && exact.found && exact.patient && exact.patient.id) return { patientId: String(exact.patient.id), source: 'matching chart' };\nthrow new Error('No chart for this form.');"
              }
            ],
            "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": [
          "C20F2D78-545C-4708-AB71-DDF07BDD1DE7"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Creates a to-do in Healthie for your staff, such as \"Call patient to schedule intake\", optionally linked to a patient, assigned to team members and given a due date.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::createTask",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Task: add the insurance by hand Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::createTask",
          "legacyElementId": null,
          "methodName": "createTask",
          "position": {
            "x": 2213,
            "y": 1410
          }
        },
        "flowElementId": "D2420BF3-597A-4BEE-BE25-C7644E09C623",
        "groupId": null,
        "id": "2256D487-D03E-465C-BB37-5E8A44F5BA6C",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "content",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Add the insurance from the new-patient form by hand: the payer "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "payerName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " is not in Healthie's insurance plan list under that name or ID. Member ID "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "memberId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", group "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "groupNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Jotform submission "
                  },
                  {
                    "id": "RESULT",
                    "label": "Form",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "893301F0-3BA8-400A-9C8A-5DD60C34FF5C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dueDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "GET_CURRENT_DATE",
                    "label": null,
                    "type": "GET_CURRENT_DATE_TIME",
                    "value": null
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "highPriority",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createTask",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Insurance task",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Task: add the insurance by hand",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Compare with the card on file Result"
          },
          "position": {
            "x": 3005,
            "y": 1159
          }
        },
        "flowElementId": "626F3914-CE99-4270-8776-24AD316B7D64",
        "groupId": null,
        "id": "6FC038A7-3388-489F-A447-3D33F69EE3FF",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "policy",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Insurance on file",
                    "subPathSegments": [
                      {
                        "key": "primary_policy",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "805DDE6A-42B9-470A-853A-44D9167AE32C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "memberId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "memberId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "payerName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "payerName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "groupNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "groupNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const norm = (v) => String(v || '').replace(/[^a-zA-Z0-9]/g, '').toUpperCase();\nconst p = policy || {};\nconst plan = p.insurance_plan || {};\nconst same = norm(p.num) !== '' && norm(p.num) === norm(memberId);\nreturn {\n  same,\n  onFile: `${plan.payer_name || 'payer not set'}, member ID ${p.num || 'none'}${p.group_num ? `, group ${p.group_num}` : ''}`,\n  onForm: `${payerName || 'payer not given'}, member ID ${memberId || 'none'}${groupNumber ? `, group ${groupNumber}` : ''}`,\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Card check",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Compare with the card on file",
        "nextElementIds": [
          "DDD8E2C7-54E5-499E-A563-9FA7A916AF6A"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 3036,
            "y": 559
          }
        },
        "flowElementId": "5D0568BD-6839-4DEE-86AD-67BA74D82E33",
        "groupId": null,
        "id": "5EF638DA-433F-46F9-96A3-A2397470E252",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "88576ee8-a826-4ec8-8376-51993e099650",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Coordinator answer",
                      "subPathSegments": [
                        {
                          "key": "decision",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "44A24213-2B06-4427-9D00-53603B7B2A0E"
                    }
                  ],
                  "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": [
              "88576ee8-a826-4ec8-8376-51993e099650"
            ]
          },
          "elseComponent": {
            "componentId": "893301F0-3BA8-400A-9C8A-5DD60C34FF5C",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Is new patient",
          "storeResult": false,
          "thenComponent": {
            "componentId": "7B93AAD3-C0A0-4FC7-9EFA-8C70A3AB5910",
            "componentType": "ELEMENT"
          }
        },
        "name": "New patient?",
        "nextElementIds": [
          "893301F0-3BA8-400A-9C8A-5DD60C34FF5C",
          "7B93AAD3-C0A0-4FC7-9EFA-8C70A3AB5910"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Creates a to-do in Healthie for your staff, such as \"Call patient to schedule intake\", optionally linked to a patient, assigned to team members and given a due date.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::createTask",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Task: confirm the new card Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::createTask",
          "legacyElementId": null,
          "methodName": "createTask",
          "position": {
            "x": 2231,
            "y": 1150
          }
        },
        "flowElementId": "88DD4B20-C028-40C3-A263-6AF60BFEE152",
        "groupId": null,
        "id": "FA4F1B2B-3D46-4F64-95B0-BA486DA1DFF8",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "content",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "The new-patient form submitted on Jotform at "
                  },
                  {
                    "id": "RESULT",
                    "label": "Form",
                    "subPathSegments": [
                      {
                        "key": "created_at",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " lists different insurance than the policy on file. On the form: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card check",
                    "subPathSegments": [
                      {
                        "key": "onForm",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6FC038A7-3388-489F-A447-3D33F69EE3FF"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". On file: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Card check",
                    "subPathSegments": [
                      {
                        "key": "onFile",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6FC038A7-3388-489F-A447-3D33F69EE3FF"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Confirm with the patient and update the policy if it changed."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "893301F0-3BA8-400A-9C8A-5DD60C34FF5C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dueDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "GET_CURRENT_DATE",
                    "label": null,
                    "type": "GET_CURRENT_DATE_TIME",
                    "value": null
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "highPriority",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createTask",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Card task",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Task: confirm the new card",
        "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": 2630,
            "y": 380
          }
        },
        "flowElementId": "916B672C-D3A7-4DC0-9F06-D75CC2DC5357",
        "groupId": null,
        "id": "DFB863BC-9572-4A84-92D1-7C56599889DB",
        "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": "124DDD0B-4111-43ED-B7D2-AE892ECEB274"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Question card",
                    "subPathSegments": [
                      {
                        "key": "blocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "124DDD0B-4111-43ED-B7D2-AE892ECEB274"
                  }
                ],
                "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": [
          "44A24213-2B06-4427-9D00-53603B7B2A0E"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 3407,
            "y": 1159
          }
        },
        "flowElementId": "0E235451-591A-4D0C-AD56-9FE27545E391",
        "groupId": null,
        "id": "13A763B6-6D9E-4895-BD21-383B1810BD7C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "64785822-e457-4073-a345-b8c67b2f126b",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Insurance on file",
                      "subPathSegments": [
                        {
                          "key": "has_insurance",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "805DDE6A-42B9-470A-853A-44D9167AE32C"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "64785822-e457-4073-a345-b8c67b2f126b"
            ]
          },
          "elseComponent": {
            "componentId": "7A826B16-16DB-45E6-A267-6AC724404164",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Has policy",
          "storeResult": false,
          "thenComponent": {
            "componentId": "6FC038A7-3388-489F-A447-3D33F69EE3FF",
            "componentType": "ELEMENT"
          }
        },
        "name": "Policy on file?",
        "nextElementIds": [
          "6FC038A7-3388-489F-A447-3D33F69EE3FF",
          "7A826B16-16DB-45E6-A267-6AC724404164"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Adds an insurance policy to a patient's Healthie profile, such as the coverage on a referral: payer, member ID, group number, priority and the policy holder. Healthie keeps one primary policy per patient.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::createPatientInsurancePolicy",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Add the policy as primary Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::createPatientInsurancePolicy",
          "legacyElementId": null,
          "methodName": "createPatientInsurancePolicy",
          "position": {
            "x": 2237,
            "y": 1280
          }
        },
        "flowElementId": "3D4141BB-410F-40AA-A3D8-80783F04641C",
        "groupId": null,
        "id": "B0DD8E08-6369-4F3A-BABE-3C5BF5249251",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "893301F0-3BA8-400A-9C8A-5DD60C34FF5C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "insurancePlanId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Payer",
                    "subPathSegments": [
                      {
                        "key": "plan",
                        "optional": false
                      },
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "7A826B16-16DB-45E6-A267-6AC724404164"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "memberId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "memberId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "groupNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "groupNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "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": "holderRelationship",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "holderRelationship",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "holderFirstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "holderFirstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "holderMiddleInitial",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "holderLastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "holderLastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "holderDateOfBirth",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "holderDateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "holderGender",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "holderPhone",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "billingMethod",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "copayCents",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "coinsurancePercent",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createPatientInsurancePolicy",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "New policy",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Add the policy as primary",
        "nextElementIds": [],
        "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": 2195,
            "y": 389
          }
        },
        "flowElementId": "1EFC544E-6EC4-4BC8-BBA6-58CDA6120F75",
        "groupId": null,
        "id": "124DDD0B-4111-43ED-B7D2-AE892ECEB274",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "firstName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "firstName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lastName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "lastName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dob",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Intake",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "dateOfBirth",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "submittedAt",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Form",
                    "subPathSegments": [
                      {
                        "key": "created_at",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "candidates",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Likely match",
                    "subPathSegments": [
                      {
                        "key": "candidates",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "96A42B92-7307-4D7D-8343-B4915BDB0226"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answerLink",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Answer link",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Answer link"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "executionId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_ID",
                    "label": null,
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.executionId",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "executionId",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const chartLink = 'https://secure.gethealthie.com/users/';\nconst fmt = (d) => { const m = /^([0-9]{4})-([0-9]{2})-([0-9]{2})/.exec(d || ''); return m ? `${m[2]}/${m[3]}/${m[1]}` : (d || 'not given'); };\nconst link = (params) => `${answerLink}?execution=${encodeURIComponent(executionId)}&${new URLSearchParams(params).toString()}`;\nconst name = [firstName, lastName].filter(Boolean).join(' ');\nconst list = candidates || [];\nconst lines = [\n  `*New-patient form from ${name}, born ${fmt(dob)}*, submitted on Jotform ${submittedAt}.`,\n  list.length === 1 ? 'No exact match in Healthie, but this chart looks like the same person:' : 'No exact match in Healthie, but these charts look like the same person:',\n  ...list.map((c) => `• <${chartLink}${c.id}|${c.name}>, born ${fmt(c.dob)}: ${c.reasons.join(', ')}`),\n  'Use an existing chart for this patient, or create a new patient?',\n];\nconst buttons = list.map((c, i) => ({ type: 'button', ...(i === 0 ? { style: 'primary' } : {}), text: { type: 'plain_text', text: `Use ${c.name}'s chart`.slice(0, 75) }, url: link({ decision: 'existing', patient: c.id }) }));\nbuttons.push({ type: 'button', text: { type: 'plain_text', text: 'Create a new patient' }, url: link({ decision: 'new' }) });\nreturn {\n  text: `New-patient form from ${name}: possible existing chart in Healthie`,\n  blocks: [\n    { type: 'section', text: { type: 'mrkdwn', text: lines.join(String.fromCharCode(10)) } },\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": [
          "DFB863BC-9572-4A84-92D1-7C56599889DB"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Gets the insurance on file for a patient: payer, member ID, group number, policy holder, effective dates and card images, with the primary policy picked out.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::getPatientInsurance",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Check the insurance on file Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::getPatientInsurance",
          "legacyElementId": null,
          "methodName": "getPatientInsurance",
          "position": {
            "x": 3384,
            "y": 850
          }
        },
        "flowElementId": "BCBEA0F9-BAF8-4CBF-AE65-299584323336",
        "groupId": null,
        "id": "805DDE6A-42B9-470A-853A-44D9167AE32C",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "893301F0-3BA8-400A-9C8A-5DD60C34FF5C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "activeOnly",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getPatientInsurance",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Insurance on file",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Check the insurance on file",
        "nextElementIds": [
          "13A763B6-6D9E-4895-BD21-383B1810BD7C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 3027,
            "y": 859
          }
        },
        "flowElementId": "04194191-9006-4A35-87C6-C7AB8A66A65F",
        "groupId": null,
        "id": "140DEC9A-8479-41E3-99C8-5ACC097D4366",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "4689544d-ae66-4492-b151-2cb830d2ba79",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Intake",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "hasInsurance",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "BE567D45-7E09-4145-B53A-C7767F644DCD"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "4689544d-ae66-4492-b151-2cb830d2ba79"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Form has insurance",
          "storeResult": false,
          "thenComponent": {
            "componentId": "805DDE6A-42B9-470A-853A-44D9167AE32C",
            "componentType": "ELEMENT"
          }
        },
        "name": "Insurance on the form?",
        "nextElementIds": [
          "805DDE6A-42B9-470A-853A-44D9167AE32C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 2650,
            "y": 1289
          }
        },
        "flowElementId": "879176D2-2FF1-443D-9A43-CAE415267E22",
        "groupId": null,
        "id": "4F04EC55-2404-440A-8319-73FB8BDE1098",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "105f98e3-b39c-4ee3-889a-605db65dedfa",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Payer",
                      "subPathSegments": [
                        {
                          "key": "found",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "7A826B16-16DB-45E6-A267-6AC724404164"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "105f98e3-b39c-4ee3-889a-605db65dedfa"
            ]
          },
          "elseComponent": {
            "componentId": "2256D487-D03E-465C-BB37-5E8A44F5BA6C",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Payer found",
          "storeResult": false,
          "thenComponent": {
            "componentId": "B0DD8E08-6369-4F3A-BABE-3C5BF5249251",
            "componentType": "ELEMENT"
          }
        },
        "name": "Payer found?",
        "nextElementIds": [
          "2256D487-D03E-465C-BB37-5E8A44F5BA6C",
          "B0DD8E08-6369-4F3A-BABE-3C5BF5249251"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 2650,
            "y": 1159
          }
        },
        "flowElementId": "48BB5E57-94CA-4B1D-94A8-E602F5ED2C05",
        "groupId": null,
        "id": "DDD8E2C7-54E5-499E-A563-9FA7A916AF6A",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "7688928e-09ad-4254-a237-386538e2aed2",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Card check",
                      "subPathSegments": [
                        {
                          "key": "same",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "6FC038A7-3388-489F-A447-3D33F69EE3FF"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "7688928e-09ad-4254-a237-386538e2aed2"
            ]
          },
          "elseComponent": {
            "componentId": "FA4F1B2B-3D46-4F64-95B0-BA486DA1DFF8",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Is same card",
          "storeResult": false,
          "thenComponent": null
        },
        "name": "Same card?",
        "nextElementIds": [
          "FA4F1B2B-3D46-4F64-95B0-BA486DA1DFF8"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Fires when someone submits the chosen form, through a webhook Jotform calls instantly. The event is the submission as Get Form Submissions returns it (answers by question id, each with its text, type and answer), plus the form title, the answers as one line of text (pretty) and as Jotform posted them (rawRequest, keyed q<id>_<name>). File upload answers hold the file URLs for Download Submission File.",
          "elementId": "EXTENSION:::SHARED:::default:::jotform:::onNewSubmission",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-trigger",
          "newElementId": "EXTENSION:::SHARED:::default:::jotform:::onNewSubmission",
          "legacyElementId": "JS###v1###Jotform###onNewSubmission",
          "methodName": "onNewSubmission",
          "position": {
            "x": 1850,
            "y": 40
          }
        },
        "flowElementId": "A2C9F416-334E-4154-9616-F00B8D98E667",
        "groupId": null,
        "id": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D",
        "metaInfo": {
          "callbackUrl": null,
          "clientValidationState": {
            "errorMessage": "Block: 'New intake form submitted', Error: Form is required",
            "valid": false
          },
          "condition": null,
          "connectionId": null,
          "eventName": "onNewSubmission",
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Form",
          "scope": "SINGLE_APP",
          "serviceId": "jotform",
          "slaConditions": [],
          "staticData": {},
          "storeResult": true,
          "subtype": "REALTIME",
          "type": "CUSTOM"
        },
        "name": "New intake form submitted",
        "nextElementIds": [
          "BE567D45-7E09-4145-B53A-C7767F644DCD"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Creates a to-do in Healthie for your staff, such as \"Call patient to schedule intake\", optionally linked to a patient, assigned to team members and given a due date.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::createTask",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Task: file the form by hand Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::createTask",
          "legacyElementId": null,
          "methodName": "createTask",
          "position": {
            "x": 3386,
            "y": 720
          }
        },
        "flowElementId": "1CBE80E4-C570-4099-9545-C85BA16506E3",
        "groupId": null,
        "id": "28285C49-B5F4-4A84-9FF8-ED093F8C9FBC",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "content",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "The new-patient form submitted on Jotform at "
                  },
                  {
                    "id": "RESULT",
                    "label": "Form",
                    "subPathSegments": [
                      {
                        "key": "created_at",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " (submission "
                  },
                  {
                    "id": "RESULT",
                    "label": "Form",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ") could not be filed on this chart: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Filing failed",
                    "subPathSegments": [
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D6C7B978-21DB-4738-A0E6-553ECF1C375A"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Download it from Jotform and upload it to the chart."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "893301F0-3BA8-400A-9C8A-5DD60C34FF5C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dueDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "GET_CURRENT_DATE",
                    "label": null,
                    "type": "GET_CURRENT_DATE_TIME",
                    "value": null
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "highPriority",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createTask",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Filing task",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Task: file the form by hand",
        "nextElementIds": [
          "140DEC9A-8479-41E3-99C8-5ACC097D4366"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Downloads a file, such as a faxed or emailed referral PDF, and files it as a document on the patient's Healthie chart, optionally in a folder and shared with the patient. Healthie has no document type list, so use the description and the folder to say what it is.",
          "elementId": "EXTENSION:::SHARED:::default:::healthie:::uploadDocument",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "File the form on the chart Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::healthie:::uploadDocument",
          "legacyElementId": null,
          "methodName": "uploadDocument",
          "position": {
            "x": 2634,
            "y": 850
          }
        },
        "flowElementId": "1DD533CA-6C87-4902-AA6D-84E9C10F05A2",
        "groupId": null,
        "id": "6496B817-B91E-41D7-BCD8-E69011623E45",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "patientId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Chart",
                    "subPathSegments": [
                      {
                        "key": "patientId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "893301F0-3BA8-400A-9C8A-5DD60C34FF5C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Signed form",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C20F2D78-545C-4708-AB71-DDF07BDD1DE7"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "displayName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "New-patient intake form"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "description",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "New-patient intake form submitted on Jotform "
                  },
                  {
                    "id": "RESULT",
                    "label": "Form",
                    "subPathSegments": [
                      {
                        "key": "created_at",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", submission "
                  },
                  {
                    "id": "RESULT",
                    "label": "Form",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "folderId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeInCharting",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "shareWithPatient",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "uploadDocument",
          "onFailElemId": "D6C7B978-21DB-4738-A0E6-553ECF1C375A",
          "packageId": "default",
          "resultAlias": "Filed form",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "healthie",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "File the form on the chart",
        "nextElementIds": [
          "140DEC9A-8479-41E3-99C8-5ACC097D4366"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Saves a submission as a filled PDF of the form to FlowRunner file storage and returns its URL. Uses Jotform's PDF route GET /pdf-converter/{formID}/fill-pdf, which Jotform support gives out but its API reference does not document, so it may change without notice; some accounts have reported \"not authorized\" from it.",
          "elementId": "EXTENSION:::SHARED:::default:::jotform:::downloadSubmissionPdf",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Save the signed form as a PDF Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::jotform:::downloadSubmissionPdf",
          "legacyElementId": "JS###v1###Jotform###downloadSubmissionPdf",
          "methodName": "downloadSubmissionPdf",
          "position": {
            "x": 2220,
            "y": 850
          }
        },
        "flowElementId": "87664C72-7D02-4764-972B-CE3F4F659875",
        "groupId": null,
        "id": "C20F2D78-545C-4708-AB71-DDF07BDD1DE7",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "formId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Form",
                    "subPathSegments": [
                      {
                        "key": "form_id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "submissionId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Form",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileOptions",
              "type": "OBJECT",
              "value": [
                {
                  "name": "scope",
                  "type": "SIMPLE",
                  "value": {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "FLOW"
                      }
                    ],
                    "mode": "BASIC",
                    "parseJsonString": false,
                    "resultType": null
                  }
                }
              ]
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "downloadSubmissionPdf",
          "onFailElemId": "D6C7B978-21DB-4738-A0E6-553ECF1C375A",
          "packageId": "default",
          "resultAlias": "Signed form",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "jotform",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Save the signed form as a PDF",
        "nextElementIds": [
          "6496B817-B91E-41D7-BCD8-E69011623E45"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Couldn't file the form Result"
          },
          "position": {
            "x": 3033,
            "y": 989
          }
        },
        "flowElementId": "51AC28C0-731E-404D-8FD0-053559FF265F",
        "groupId": null,
        "id": "D6C7B978-21DB-4738-A0E6-553ECF1C375A",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Filing failed",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Couldn't file the form",
        "nextElementIds": [
          "28285C49-B5F4-4A84-9FF8-ED093F8C9FBC"
        ],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      }
    ],
    "firstElementId": "B1ECB97E-DB78-4C14-8C8A-4F70A9D30C8D",
    "groups": [],
    "id": "9F9A16BE-68CE-48BA-9B84-B97AEF5C3ED7",
    "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 intake form.",
          "error": null,
          "name": "Anthropic key",
          "type": "API_KEY",
          "value": null
        },
        {
          "description": "Your practice's time zone as an IANA name, used when the form does not show where the patient lives.",
          "error": null,
          "name": "Practice time zone",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The URL of the block Wait for the coordinator's answer. The Slack buttons open it.",
          "error": null,
          "name": "Answer link",
          "type": "STRING",
          "value": ""
        }
      ],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-12-01T05:36:23.854Z"
}
