bonFHIR icon

bonFHIR

Perform operations on FHIR resources

Overview

This node provides integration with a FHIR (Fast Healthcare Interoperability Resources) server, enabling various operations on FHIR resources. Specifically for the Search operation under the Default resource, it performs searches against the FHIR server API to retrieve resources matching specified criteria.

Common scenarios where this node is beneficial include:

  • Querying patient records or clinical data from a FHIR server.
  • Retrieving all instances of a particular FHIR resource type that meet certain search parameters.
  • Paginating through large result sets by optionally retrieving all pages of results.
  • Extracting specific data from the search results using FHIRPath expressions.

Practical examples:

  • Searching for all patients with a given last name.
  • Retrieving all observations for a specific encounter.
  • Fetching all medication requests for a patient and extracting medication names via FHIRPath.

Properties

Name Meaning
Authentication The method used to authenticate with the FHIR server. Options: Basic Auth, Custom Auth, Digest Auth, Header Auth, None, OAuth1, OAuth2, Query Auth.
Base URL The base URL of the FHIR server API to which requests will be sent.
Retrieve All Pages? Whether to automatically retrieve all pages of search results. Use with caution as this may result in large data volumes.
Normalize Next URL to Base URL When retrieving multiple pages, whether to normalize the "next" page URL to use the configured base URL. Useful if the next URL points to a different base URL.
Error if More than One Result If enabled, the node will throw an error if the search returns more than one result in the Bundle. This is useful when expecting a single resource only.
Resource Type The type of FHIR resource to search for (e.g., Patient, Observation, MedicationRequest). A comprehensive list of standard FHIR resource types is provided, plus a custom option.
Custom Resource Type If "Custom" resource type is selected, specify the custom resource type string here.
Specify Query Parameters How to specify query parameters for the search: either as key-value pairs or as a JSON object.
Query Parameters Key-value pairs representing the search query parameters (used if "Using Fields Below" is selected).
JSON JSON object representing the search query parameters (used if "Using JSON" is selected).
FHIR Path A FHIRPath expression to extract specific data from the search output. If provided, the node evaluates this expression on the response and outputs the result instead of the full resource bundle.
Ignore SSL Issues Whether to allow connections even if SSL certificate validation fails (e.g., self-signed certificates).

Output

The node outputs JSON data representing the FHIR resources returned by the search operation. The structure depends on the search results:

  • If the response is a FHIR Bundle, each entry's resource is output as a separate item.
  • If a FHIRPath expression is specified, the output is the evaluation result of that expression on the response.
  • If pagination is enabled, the node retrieves all pages and outputs combined results.

Binary data is not produced by this node.

Each output item includes:

  • json: The JSON representation of the FHIR resource or extracted data.
  • pairedItem: Metadata linking the output to the input item index.

Dependencies

  • Requires access to a FHIR server endpoint specified by the Base URL.
  • Supports various authentication methods; appropriate credentials must be configured in n8n.
  • Uses internal HTTP request utilities with authentication support.
  • Utilizes a FHIRPath evaluation library to process FHIRPath expressions.
  • No external environment variables are required beyond credential configuration.

Troubleshooting

Common Issues

  • More than one result error: If "Error if More than One Result" is enabled and the search returns multiple resources, the node throws an error. To fix, either disable this option or refine the search query to return a single resource.
  • Invalid Base URL or connection errors: Ensure the Base URL is correct and accessible. If using HTTPS with self-signed certificates, enable "Ignore SSL Issues" if appropriate.
  • Authentication failures: Verify that the chosen authentication method and credentials are correctly configured.
  • Malformed query parameters: When specifying query parameters as JSON, ensure valid JSON syntax.
  • FHIRPath evaluation errors: Invalid FHIRPath expressions can cause evaluation failures. Validate expressions before use.

Error Messages

  • "The operation \"Search\" is not supported": Indicates an unsupported operation was requested.
  • "The search returned more than one result (N)": Triggered when multiple results are found but only one was expected.
  • "JSON parameter need to be an valid JSON": Occurs if the JSON query parameter is malformed.
  • Network or SSL errors related to connectivity or certificate validation.

Links and References


This summary is based solely on static analysis of the provided source code and property definitions, without runtime execution or internal credential details.

Discussion