Ignixa.FhirPath
0.0.127
dotnet add package Ignixa.FhirPath --version 0.0.127
NuGet\Install-Package Ignixa.FhirPath -Version 0.0.127
<PackageReference Include="Ignixa.FhirPath" Version="0.0.127" />
<PackageVersion Include="Ignixa.FhirPath" Version="0.0.127" />
<PackageReference Include="Ignixa.FhirPath" />
paket add Ignixa.FhirPath --version 0.0.127
#r "nuget: Ignixa.FhirPath, 0.0.127"
#:package Ignixa.FhirPath@0.0.127
#addin nuget:?package=Ignixa.FhirPath&version=0.0.127
#tool nuget:?package=Ignixa.FhirPath&version=0.0.127
Ignixa.FhirPath
FHIRPath expression evaluation engine for FHIR resources. Provides a high-performance implementation of the FHIRPath specification for querying and navigating FHIR data structures.
Why Use This Package?
- Standards-compliant: Implements the FHIRPath specification
- High-performance: Includes compiled delegate mode for common patterns
- Modern architecture: Works with
IElementfrom Ignixa.Abstractions - Extensible: Add custom functions and evaluation logic
Installation
dotnet add package Ignixa.FhirPath
Quick Start
Evaluating FHIRPath Expressions
using Ignixa.FhirPath.Parser;
using Ignixa.FhirPath.Evaluation;
using Ignixa.Abstractions;
// Parse a FHIRPath expression
var parser = new FhirPathParser();
var expression = parser.Parse("Patient.name.family");
// Evaluate against a resource
var evaluator = new FhirPathEvaluator();
IElement patientElement = GetYourPatientElement();
IEnumerable<IElement> results = evaluator.Evaluate(patientElement, expression);
// Extract values
foreach (var result in results)
{
Console.WriteLine(result.Value); // Prints family names
}
Using the Compiled Delegate Mode (Faster)
For better performance on repeated evaluations:
using Ignixa.FhirPath.Evaluation;
// Set up compiler with fallback evaluator
var evaluator = new FhirPathEvaluator();
var compiler = new FhirPathDelegateCompiler(evaluator);
// Parse expression
var expression = parser.Parse("telecom.where(system='phone').value");
// Try to compile (falls back to interpreter if not supported)
var compiled = compiler.TryCompile(expression);
if (compiled != null)
{
// Use compiled delegate (80% faster for common patterns)
var context = new EvaluationContext();
var results = compiled(patientElement, context);
}
else
{
// Fallback to interpreter
var results = evaluator.Evaluate(patientElement, expression);
}
Common FHIRPath Patterns
// Simple path navigation
"Patient.name.family" // Get all family names
// Filtering with where()
"telecom.where(system='phone')" // Get phone telecoms
"name.where(use='official').family" // Get official family name
// Existence checks
"identifier.exists()" // Has any identifiers?
"name.family.exists()" // Has family name?
// First/single element
"name.first().family" // First family name
"identifier.where(system='SSN').value" // SSN value
// Boolean expressions
"active = true" // Is patient active?
"birthDate < @2000-01-01" // Born before 2000
Working with Evaluation Context
using Ignixa.FhirPath.Evaluation;
var context = new EvaluationContext();
// Set variables for use in expressions
context.SetVariable("minDate", someDate);
// Evaluate expression using context
var expression = parser.Parse("birthDate > %minDate");
var results = evaluator.Evaluate(patientElement, expression, context);
Supported FHIRPath Features
Compiled Mode (High Performance)
- Simple paths:
name,identifier - Two-level paths:
name.family,identifier.value - Where clauses:
telecom.where(system='phone') - Common functions:
first(),exists()
Interpreter Mode (Full Compatibility)
- All FHIRPath 2.0 operators
- All standard functions
- Complex nested expressions
- Type checking and conversions
Performance Notes
The FhirPathDelegateCompiler compiles ~80% of common search parameter patterns to optimized delegates:
- Simple paths: 30% of patterns (e.g.,
name) - Two-level paths: 40% of patterns (e.g.,
name.family) - Where clauses: 15% of patterns (e.g.,
telecom.where(system='phone')) - Functions: 10% of patterns (e.g.,
name.first())
Unsupported expressions automatically fall back to the interpreted mode.
Advanced Usage
Custom Function Registration
// Extend FhirPathEvaluator with custom functions
public class MyCustomEvaluator : FhirPathEvaluator
{
protected override IEnumerable<IElement> EvaluateFunctionCall(
IEnumerable<IElement> focus,
FunctionCallExpression func,
EvaluationContext context)
{
if (func.FunctionName == "myCustomFunc")
{
// Implement custom logic
return focus.Where(e => /* your logic */);
}
return base.EvaluateFunctionCall(focus, func, context);
}
}
Related Packages
- Ignixa.Abstractions: Provides
IElementandITypeinterfaces - Ignixa.Serialization: Parse JSON/XML to
IElementtrees - Ignixa.Search: Uses FHIRPath for search parameter extraction
- Ignixa.Validation: Uses FHIRPath for constraint evaluation
Specification Compliance
This implementation follows the FHIRPath N1 specification.
License
MIT License - see LICENSE file in repository root
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Fhir.Metrics (>= 1.3.1)
- Ignixa.Abstractions (>= 0.0.127)
- Superpower (>= 3.1.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Ignixa.FhirPath:
| Package | Downloads |
|---|---|
|
Ignixa.SqlOnFhir
SQL on FHIR implementation for analytics queries |
|
|
Ignixa.Validation
FHIR resource validation with profile support |
|
|
Ignixa.FhirMappingLanguage
FHIR Mapping Language (FML) parser and execution engine |
|
|
Ignixa.Search
FHIR search parameter indexing and query infrastructure |
|
|
Ignixa.NarrativeGenerator
FHIR narrative generation using Scriban templates with FHIRPath support |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.127 | 163 | 12/29/2025 |
| 0.0.109 | 419 | 12/18/2025 |
| 0.0.101 | 322 | 12/16/2025 |
| 0.0.96 | 469 | 12/10/2025 |
| 0.0.87 | 471 | 12/8/2025 |
| 0.0.70 | 333 | 12/7/2025 |
| 0.0.68 | 258 | 12/7/2025 |
| 0.0.62 | 261 | 12/6/2025 |
| 0.0.59 | 210 | 12/5/2025 |
| 0.0.58 | 233 | 12/5/2025 |
| 0.0.57 | 234 | 12/3/2025 |
| 0.0.56 | 701 | 12/3/2025 |
| 0.0.55 | 496 | 12/1/2025 |
| 0.0.54 | 492 | 11/30/2025 |
| 0.0.53 | 490 | 11/30/2025 |
| 0.0.51 | 249 | 11/29/2025 |
| 0.0.50 | 223 | 11/29/2025 |