Templates / Save lab results as FHIR LOINC Observations with optional Slack alerts

Save lab results as FHIR LOINC Observations with optional Slack alerts

Ready for 3.0

by Ciphernutz IT Services ✓ · 1 views · created 2026-10-07 · Document Extraction

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Nodes used (6)

What it does

Quick overview Receives lab results by webhook, validates them, maps each test to a LOINC-coded FHIR R4 Observation, and saves it with duplicate protection. Critical results can trigger a Slack alert without patient identifiers. Reference and panic ranges are configurable demo examples. How it works 1. Receives a POST request on the /lab-result webhook containing a JSON lab result payload. 2. Loads template settings, validates required fields and formats (including ISO timestamps), and normalizes the test identifier. 3. Maps the test to a supported LOINC code and expected unit, and enriches it with configurable reference and panic ranges. 4. Checks for duplicates using an idempotency key and stops early with a duplicate response if the result was already processed. 5. Builds a FHIR R4 Observation linked to Patient/{patientid} and creates it on the target FHIR server using an If-None-Exist header to prevent duplicates. 6. If the result is in the configured panic range and Slack alerts are enabled, posts a critical alert to Slack without patient identifiers, then returns the final status and Observation details to the webhook caller. Setup 1. Provide a reachable FHIR R4 base URL and ensure Patient/{patientid} resources already exist on that server. 2. If your FHIR server requires authentication, configure a Bearer token (or other auth method) on the HTTP request that posts the Observation. 3. In the workflow settings node, review and replace the demo reference/panic ranges for each supported test with your lab-validated ranges. 4. To enable critical alerts, create a Slack Incoming Webhook, paste its URL into the settings, and keep critical alerts turned on. 5. Activate the workflow and send test requests to the /lab-result webhook URL from your lab system or integration source. Requirements - n8n (self-hosted or Cloud) - A FHIR R4 server (the public HAPI test server works for demos) - Existing Patient resources on that server - Bearer token credential if your FHIR server requires authentication - Slack Incoming Webhook URL (optional, for critical alerts) - A lab system or source able to POST JSON to a webhook Customization - Edit reference and panic ranges per test in the Settings node, with no code changes - Add a new test by adding its LOINC code, accepted unit and ranges in the "Map Test + Ranges" node - Replace the Slack alert node with Teams, email, SMS or another channel - Change the idempotency key to match your source system's unique result ID - Add unit conversion if your lab sends different units - Add a Patient lookup or create step if patients may not exist yet Additional info The reference and panic ranges are demo examples only and vary by laboratory, method and population; replace them before any clinical use. The optional patientname field is accepted but never written to the Observation or sent to Slack. Treat your Slack webhook URL as a secret. For more on integrating n8n with FHIR APIs, see Ciphernutz's guide: https://ciphernutz.com/blog/fhir-api-integration-using-n8n

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.