bonFHIR icon

bonFHIR

Perform operations on FHIR resources

Overview

This node provides integration with a FHIR (Fast Healthcare Interoperability Resources) server, allowing users to perform various operations on FHIR resources. Specifically, the VRead operation retrieves a specific version of a FHIR resource by its ID and version ID. This is useful in healthcare scenarios where historical versions of patient data or clinical documents need to be accessed for auditing, compliance, or analysis purposes.

Common use cases include:

  • Accessing a previous version of a patient's record.
  • Retrieving a specific revision of a clinical document or observation.
  • Auditing changes over time in healthcare data.

For example, a user might want to fetch version 3 of a Patient resource with ID "12345" from a FHIR server at "http://example.com/fhir".

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. Example: http://example.com/fhir
Resource Type The type of FHIR resource to operate on. Includes standard FHIR resource types like Patient, Observation, etc., plus a custom option.
Custom Resource Type If "Resource Type" is set to custom, this string specifies the custom resource type name.
ID The ID of the FHIR resource to operate on. Required for operations like Delete, History, Patch, Read, Update, VRead.
Version ID The version ID of the resource to retrieve. Required for the VRead operation.
Patch Parameters For Patch operation: a collection of JSON Patch parameters specifying operations like add, remove, replace, etc.
Specify Query Parameters How query parameters are specified: either as key-value pairs or as raw JSON.
Query Parameters Key-value pairs for query parameters when using keypair mode.
JSON Query Raw JSON object for query parameters when using JSON mode.
FHIR Path A FHIRPath expression to extract specific data from the output.
Ignore SSL Issues Whether to ignore SSL certificate validation errors (useful for self-signed certificates).

Output

The node outputs the JSON response from the FHIR server corresponding to the requested operation. For the VRead operation, the output will be the JSON representation of the specific version of the requested FHIR resource.

If a FHIRPath expression is provided, the output will be the result of evaluating that expression against the returned resource, which can be a subset or transformed data extracted from the resource.

Binary data is not directly handled by this node; it focuses on JSON FHIR resources.

Each output item includes:

  • json: The JSON data of the resource or evaluation result.
  • pairedItem: Metadata linking back to the input item index.

Dependencies

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

Troubleshooting

  • Authentication Errors: Ensure correct authentication method and credentials are configured. Common errors include unauthorized (401) or forbidden (403) responses.
  • Invalid Resource or Version ID: If the resource or version ID does not exist, the server may return 404 Not Found.
  • Malformed Query Parameters: When specifying query parameters as JSON, ensure valid JSON syntax to avoid parsing errors.
  • SSL Certificate Issues: If connecting to servers with self-signed certificates, enable "Ignore SSL Issues" to bypass validation.
  • Multiple Results Error: For Search operations with "Error if More than One Result" enabled, an error is thrown if more than one resource matches the search criteria.
  • FHIRPath Evaluation Errors: Invalid FHIRPath expressions may cause evaluation failures; verify expressions for correctness.

Links and References

Summary of execute() logic for Resource=Default and Operation=VRead

  • Reads input items.
  • Retrieves authentication parameters.
  • For each input item:
    • Gathers parameters: base URL, operation, resource type, id, version id, query parameters, patch body, etc.
    • Constructs HTTP request options based on operation:
      • For VRead, sends GET request to {baseUrl}/{resourceType}/{id}/_history/{vid}.
    • Sends authenticated HTTP request.
    • If FHIRPath expression is specified, evaluates it on the response.
    • Handles pagination for Search operation if enabled.
    • Collects results into output array.
  • Returns output array with JSON data and paired item metadata.

Discussion