FHIR Search
Searches for FHIR resources by type and search parameters. Includes a built-in visual filter builder.
Inputs
Outputs
Details
This node performs a FHIR search operation to find resources matching the specified criteria.
The node requires an access token to be provided in msg.payload.access_token. This token should have appropriate permissions to search the requested resource type.
Search parameters should be provided as a JSON object. Common FHIR search parameters include:
_count- Number of results to return_sort- Sort order for results_include- Include related resources- Resource-specific parameters (e.g.,
name,birthdatefor Patient)
Search Parameter Priority
- Visual filter rows configured in the node (if any)
msg.payload.searchFilter(e.g., from ec-fhir-searchfilter node)- Raw JSON textarea in node config
msg.toolInput(AI Tool structures)
Filter Operators
equals- Exact match (default)not equals- ne prefixgreater than- gt prefixgreater or equal- ge prefixless than- lt prefixless or equal- le prefixcontains- :contains modifierexact- :exact modifier
Variable Substitution
Use {{variableName}} in filter values. Resolved from msg.payload.filterValues.
Nested paths: {{patient.id}} resolves to msg.payload.filterValues.patient.id.
Multiple variables can be used in a single value, and variables can be placed anywhere in the string.
Examples:
- Simple:
{{patientId}}→123 - Multiple:
{{resourceType}}/{{id}}→Patient/456 - With operators:
ge{{startDate}}→ge2024-01-01
Scope Validation
The node checks if the selected resource type is included in the integration's scopes.
Scopes follow the format: [user|patient|system]/[ResourceType|*].[read|write|*]
Examples:
patient/*.read- Can read all resource types in patient contextuser/Patient.read- Can read Patient resources in user contextsystem/Observation.*- Can perform all operations on Observations
Search Examples
Patient Search:
{
"family": "Smith",
"given": "John",
"birthdate": "1980-01-01",
"_count": 10
}
Observation Search:
{
"patient": "Patient/123",
"code": "http://loinc.org|8867-4",
"_sort": "-date",
"_count": 5
}
Encounter Search:
{
"patient": "Patient/123",
"date": "ge2024-01-01",
"status": "finished"
}
Example Output
Filter configuration:
- Parameter:
patient, Value:{{patientId}} - Parameter:
date, Value:ge{{startDate}}
With msg.payload.filterValues:
{
"patientId": "123",
"startDate": "2024-01-01"
}
Resulting query parameters:
{
"patient": "123",
"date": "ge2024-01-01"
}
Best Practices
- Use variables (e.g.,
{{patientId}}) for dynamic values rather than hardcoding. - Enable Enforce Validation to catch missing variable values early in the workflow.
- Set an appropriate
_countto limit the result set size and improve performance. - Use
_sortfor predictable result ordering (e.g.,-datefor newest first). - Test complex filter logic using a standalone FHIR Search Filter node before connecting it to this node.
- Document the expected
filterValuesinput structure in your flow's notes.