bonFHIR icon

bonFHIR

Perform operations on FHIR resources

Overview

This node enables interaction with FHIR (Fast Healthcare Interoperability Resources) servers, specifically supporting the "Patch" operation on FHIR resources. The Patch operation allows partial updates to existing FHIR resources by applying a set of changes described in a JSON Patch format or as individual patch parameters.

Common scenarios for this node include:

  • Updating specific fields of a FHIR resource without sending the entire resource.
  • Applying complex modifications such as adding, removing, or replacing elements within a resource.
  • Integrating healthcare workflows where incremental updates to patient records or other clinical data are required.

Practical example:

  • A healthcare application needs to update only the address field of a Patient resource. Instead of sending the full Patient resource, the node can send a patch request specifying just the change to the address.

Properties

Name Meaning
Authentication Method of authentication to use when connecting to 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. Example: http://example.com/fhir.
Resource Type The type of FHIR resource to operate on, e.g., Patient, Observation, MedicationRequest, etc. Also supports a custom resource type string.
Custom Resource Type If "Resource Type" is set to "- Custom -", specify the custom resource type here as a string.
ID The identifier of the specific resource instance to patch. Required for Patch operation.
Specify Patch Body How to specify the patch body: either "Using Fields Below" (individual patch operations) or "Using JSON" (raw JSON Patch document).
Body The raw JSON Patch document to apply. Used if "Specify Patch Body" is set to "Using JSON".
Patch Parameters Collection of individual patch operations (op, from, path, value) used to build the patch body. Used if "Specify Patch Body" is set to "Using Fields Below".
Specify Query Parameters How to specify query parameters for the request: "Using Fields Below" (key-value pairs) or "Using JSON" (raw JSON object).
Query Parameters Key-value pairs representing query parameters to include in the request URL.
JSON Raw JSON object representing query parameters. Used if "Specify Query Parameters" is set to "Using JSON".
FHIR Path Optional FHIR Path expression to extract specific data from the response output.
Ignore SSL Issues Whether to allow connections even if SSL certificate validation fails (e.g., self-signed certificates).

Patch Parameters Details

Each patch parameter consists of:

  • Op: Operation type. Options include Add, Copy, Move, Remove, Replace, Test.
  • From: Source path for Copy, Move, or Test operations (JSON Pointer).
  • Path: Target path in the JSON document (JSON Pointer).
  • Value: Value to apply for Add, Replace, or Test operations (JSON).

Output

The node outputs an array of items corresponding to the responses from the FHIR server for each input item processed.

  • Each output item contains a json property holding the parsed JSON response from the FHIR server.
  • For Patch operation, the response typically includes the updated resource or an operation outcome indicating success or failure.
  • If a FHIR Path expression is specified, the output will contain the extracted data according to that expression.
  • Binary data is not produced by this node.

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 standard HTTP methods and headers for FHIR RESTful API interactions.
  • Optionally uses FHIR Path evaluation for extracting data from responses.

Troubleshooting

  • Invalid Patch Body: Ensure the patch body conforms to JSON Patch specification. When using key-value patch parameters, verify all required fields (op, path, and optionally from and value) are correctly set.
  • Authentication Errors: Verify that the selected authentication method matches the FHIR server requirements and that credentials are valid.
  • SSL Certificate Issues: If connecting to servers with self-signed or invalid certificates, enable "Ignore SSL Issues" to bypass validation.
  • More Than One Result Error: When performing search operations (not Patch), if "Error if More than One Result" is enabled and multiple results are returned, the node throws an error. For Patch, this does not apply.
  • Malformed Query Parameters: When specifying query parameters as JSON, ensure valid JSON syntax.
  • Resource Not Found: For Patch operation, ensure the resource ID exists on the server.
  • Unsupported Operation: Only supported operations listed in the properties are allowed; others will cause errors.

Links and References

Summary

This node provides a flexible interface to perform partial updates on FHIR resources via the Patch operation. It supports both structured patch parameters and raw JSON Patch documents, integrates with various authentication schemes, and allows fine control over query parameters and response data extraction through FHIR Path. It is ideal for healthcare automation workflows requiring precise and efficient resource updates.

Discussion