# FHIR (Beta)

{% hint style="info" %}
The FHIR connector is currently in beta phase. Learn more about the [Beta Program](https://app.gitbook.com/s/jvO5S91EQURCEhbZOuuZ/help-and-faq/beta-program).
{% endhint %}

**FHIR** is integrated with [HAPI-FHIR](https://hapifhir.io/), an open-source library that implements the FHIR (Fast Healthcare Interoperability Resources) specification. Its main goal is to enable seamless communication between healthcare systems by enabling the exchange, retrieval, and management of FHIR-compliant data.

## **Parameters**

Take a look at the configuration parameters for the connector. Parameters supported by [Double Braces expressions](https://docs.digibee.com/documentation/connectors-and-triggers/double-braces/overview) are marked with `(DB)`.

### **General tab**

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Default value</th><th>Data type</th></tr></thead><tbody><tr><td><strong>Account</strong></td><td>The account used by the connector. Supported type: <a href="https://app.gitbook.com/s/jvO5S91EQURCEhbZOuuZ/platform-administration/settings/accounts#accounts-type"><strong>Basic</strong></a>.</td><td>N/A</td><td>Account</td></tr><tr><td><strong>Fail On Error</strong></td><td>If the option is activated, the pipeline's execution with an error will be interrupted. Otherwise, the pipeline execution proceeds, but the result will show a false value for the <code>"success"</code> property.</td><td>False</td><td>Boolean</td></tr></tbody></table>

### **Host tab**

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Default value</th><th>Data type</th></tr></thead><tbody><tr><td><strong>Host</strong> <code>(DB)</code></td><td>The base URL of the FHIR server.</td><td>N/A</td><td>String</td></tr><tr><td><strong>Path</strong></td><td>The specific FHIR resource or endpoint to be accessed. Based on the selected path, additional options may be available for configuring query parameters or other required settings. For details on each endpoint, refer to the <a href="https://hapi.fhir.org/baseR4/swagger-ui/">HAPI FHIR</a> documentation.</td><td>N/A</td><td>String</td></tr><tr><td><strong>Method</strong></td><td>The HTTP method used for the request.</td><td>N/A</td><td>String</td></tr></tbody></table>

### **Settings tab**

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Default value</th><th>Data type</th></tr></thead><tbody><tr><td><strong>Connect Timeout (ms)</strong></td><td>Maximum time allowed for establishing a connection, in milliseconds.</td><td>30000</td><td>Integer</td></tr><tr><td><strong>Read Timeout (ms)</strong></td><td>Maximum time allowed for reading data, in milliseconds.</td><td>30000</td><td>Integer</td></tr><tr><td><strong>Stop on Client Error</strong></td><td>When enabled, stops the pipeline execution if a 4xx HTTP error occurs.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Stop on Server Error</strong></td><td>When enabled, stops the pipeline execution if a 5xx HTTP error occurs.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Override Response Charset</strong></td><td>When enabled, replaces the charset returned by the endpoint with the one specified in the <strong>Response Charset</strong> property. Otherwise, the charset from the <strong>Content-Type</strong> header is used.</td><td>True</td><td>Boolean</td></tr><tr><td><strong>Response Charset</strong></td><td>Defines the charset to be used when <strong>Override Response Charset</strong> is enabled. Default: UTF-8.</td><td>UTF-8</td><td>String</td></tr><tr><td><strong>Advanced Settings</strong></td><td>Enables additional configuration options.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Raw Mode</strong></td><td>When enabled, allows sending or receiving a non-JSON payload.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Save as Local File</strong></td><td>When enabled, saves the response as a file in the local pipeline directory.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Allow Insecure Endpoints</strong></td><td>When enabled, permits calls to HTTPS endpoints without enforcing security checks.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Enable Retries</strong></td><td>When enabled, retries requests in case of server errors.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Compress Body with GZIP</strong></td><td>When enabled, compresses the request body using GZIP.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Force HTTP 1.1</strong></td><td>When enabled, forces the request to use HTTP 1.1.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Disable Connection Pooling</strong></td><td>When enabled, prevents connections from being reused. Recommended for endpoints with connection reuse issues.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Invalidate SSL Sessions on Every Call</strong></td><td>When enabled, invalidates SSL sessions for each request. Recommended for endpoints with SSL session reuse issues. This setting makes the connector single-threaded, meaning all executions will run sequentially for the same REST connector in the pipeline.</td><td>False</td><td>Boolean</td></tr></tbody></table>

### **Documentation tab**

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Default value</th><th>Data type</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td>Section for documenting any necessary information about the connector configuration and business rules.</td><td>N/A</td><td>String</td></tr></tbody></table>

## **FHIR usage examples**

### **Retrieve patient by ID**

#### **Connector’s configuration**

* **Host:** <https://hapi.fhir.org/baseR4/>
* **Path:** `/Patient/{id}`
* **Method:** `GET`
* **Path {id}:** `596573`

#### **Output**

```json
{
  "status": 200,
  "statusMessage": "OK",
  "body": {
    "resourceType": "Patient",
    "id": "596573",
    "meta": {
      "versionId": "1",
      "lastUpdated": "2020-02-02T05:20:18.739+00:00",
      "source": "#0ozhPzMD54KooHNz"
    },
    "text": {
      "status": "generated",
      "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">Atomic <b>DOG </b></div><table class=\"hapiPropertyTable\"><tbody><tr><td>Address</td><td><span>yesLine </span><br/><span>NoDogCatchers </span><span>Land </span><span>Dogville </span></td></tr><tr><td>Date of birth</td><td><span>07 March 3000</span></td></tr></tbody></table></div>"
    },
    "name": [
      {
        "family": "Dog",
        "given": [
          "Atomic"
        ]
      }
    ],
    "telecom": [
      {
        "system": "phone",
        "value": "5555555555",
        "use": "mobile"
      }
    ],
    "gender": "male",
    "birthDate": "3000-03-07T22:00:00.00Z",
    "address": [
      {
        "use": "home",
        "line": [
          "yesLine"
        ],
        "city": "NoDogCatchers",
        "state": "Land",
        "postalCode": "12345",
        "country": "Dogville"
      }
    ]
  },
  "headers": {
    "Connection": "keep-alive",
    "Content-Location": "https://hapi.fhir.org/baseR4/Patient/596573/_history/1",
    "Content-Type": "application/fhir+json;charset=utf-8",
    "Date": "Fri, 21 Feb 2025 12:50:44 GMT",
    "ETag": "W/\"1\"",
    "Last-Modified": "Sun, 02 Feb 2020 05:20:18 GMT",
    "Server": "nginx/1.24.0 (Ubuntu)",
    "Transfer-Encoding": "chunked",
    "X-Powered-By": "HAPI FHIR 7.7.15-SNAPSHOT/3594770bf6/2024-12-21 REST Server (FHIR Server; FHIR 4.0.1/R4)",
    "X-Request-ID": "kVmj43rHoE0xtUfb"
  }
}
```

### **Search patient by name**

#### **Connector’s configuration**

* **Host:** <https://hapi.fhir.org/baseR4/>
* **Path:** `/Patient`
* **Method:** `GET`
* **Query {name}:** `Smith`

#### **Output**

```json
{
  "status": 200,
  "statusMessage": "OK",
  "body": {
    "resourceType": "Bundle",
    "id": "756a0990-9d0f-4e8b-b39b-0dddd683471f",
    "meta": {
      "lastUpdated": "2025-02-21T13:29:38.190+00:00"
    },
    "type": "searchset",
    "link": [
      {
        "relation": "self",
        "url": "https://hapi.fhir.org/baseR4/Patient?name=Smith"
      },
      {
        "relation": "next",
        "url": "https://hapi.fhir.org/baseR4?_getpages=756a0990-9d0f-4e8b-b39b-0dddd683471f&_getpagesoffset=20&_count=20&_pretty=true&_bundletype=searchset"
      }
    ],
    "entry": [
      {
        "fullUrl": "https://hapi.fhir.org/baseR4/Patient/pat2",
        "resource": {
          "resourceType": "Patient",
          "id": "pat2",
          "meta": {
            "versionId": "6",
            "lastUpdated": "2025-02-03T10:47:21.221+00:00",
            "source": "#n1HxCzy7fO78KKI0",
            "security": [
              {
                "system": "http://essai.abcfg.com/",
                "code": "code1",
                "display": "coded1"
              }
            ],
            "tag": [
              {
                "system": "http://essai.abcfg.com/",
                "code": "tag1",
                "display": "tagd1"
              }
            ]
          },
          "text": {
            "status": "generated",
            "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">John <b>SMITH </b></div><table class=\"hapiPropertyTable\"><tbody><tr><td>Date of birth</td><td><span>15 March 1985</span></td></tr></tbody></table></div>"
          },
          "name": [
            {
              "use": "official",
              "family": "Smith",
              "given": [
                "John"
              ]
            }
          ],
          "gender": "male",
          "birthDate": "1985-03-15"
        },
        "search": {
          "mode": "match"
        }
      }
]
  },
  "headers": {
    "Connection": "keep-alive",
    "Content-Type": "application/fhir+json;charset=utf-8",
    "Date": "Fri, 21 Feb 2025 13:29:38 GMT",
    "Last-Modified": "Fri, 21 Feb 2025 13:29:38 GMT",
    "Server": "nginx/1.24.0 (Ubuntu)",
    "Transfer-Encoding": "chunked",
    "X-Powered-By": "HAPI FHIR 7.7.15-SNAPSHOT/3594770bf6/2024-12-21 REST Server (FHIR Server; FHIR 4.0.1/R4)",
    "X-Request-ID": "DysuUQsEQw3PuYNs"
  }
}
```

### **Create a new patient**

#### **Connector’s configuration**

* **Host:** <https://hapi.fhir.org/baseR4/>
* **Path:** `/Patient`
* **Method:** `POST`
* **Full Body**: `True`
* **Body:**

```json
{
  "resourceType": "Patient",
  "name": [
    {
      "family": "Doe",
      "given": ["Jane"]
    }
  ],
  "gender": "female",
  "birthDate": "1992-04-15"
}
```

#### **Output**

```json
{
  "status": 201,
  "statusMessage": "Created",
  "body": {
    "resourceType": "Patient",
    "id": "46273031",
    "meta": {
      "versionId": "1",
      "lastUpdated": "2025-02-21T13:33:27.853+00:00",
      "source": "#2wPqcc0VrXJIvR2o"
    },
    "text": {
      "status": "generated",
      "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">Jane <b>DOE </b></div><table class=\"hapiPropertyTable\"><tbody><tr><td>Date of birth</td><td><span>15 April 1992</span></td></tr></tbody></table></div>"
    },
    "name": [
      {
        "family": "Doe",
        "given": [
          "Jane"
        ]
      }
    ],
    "gender": "female",
    "birthDate": "1992-04-15"
  },
  "headers": {
    "Connection": "keep-alive",
    "Content-Location": "https://hapi.fhir.org/baseR4/Patient/46273031/_history/1",
    "Content-Type": "application/fhir+json;charset=utf-8",
    "Date": "Fri, 21 Feb 2025 13:33:27 GMT",
    "ETag": "W/\"1\"",
    "Last-Modified": "Fri, 21 Feb 2025 13:33:27 GMT",
    "Location": "https://hapi.fhir.org/baseR4/Patient/46273031/_history/1",
    "Server": "nginx/1.24.0 (Ubuntu)",
    "Transfer-Encoding": "chunked",
    "X-Powered-By": "HAPI FHIR 7.7.15-SNAPSHOT/3594770bf6/2024-12-21 REST Server (FHIR Server; FHIR 4.0.1/R4)",
    "X-Request-ID": "2wPqcc0VrXJIvR2o"
  }
}
```
