Ignixa.Extensions.FirelySdk6
0.6.108
dotnet add package Ignixa.Extensions.FirelySdk6 --version 0.6.108
NuGet\Install-Package Ignixa.Extensions.FirelySdk6 -Version 0.6.108
<PackageReference Include="Ignixa.Extensions.FirelySdk6" Version="0.6.108" />
<PackageVersion Include="Ignixa.Extensions.FirelySdk6" Version="0.6.108" />
<PackageReference Include="Ignixa.Extensions.FirelySdk6" />
paket add Ignixa.Extensions.FirelySdk6 --version 0.6.108
#r "nuget: Ignixa.Extensions.FirelySdk6, 0.6.108"
#:package Ignixa.Extensions.FirelySdk6@0.6.108
#addin nuget:?package=Ignixa.Extensions.FirelySdk6&version=0.6.108
#tool nuget:?package=Ignixa.Extensions.FirelySdk6&version=0.6.108
Ignixa.Extensions.FirelySdk
Firely SDK interoperability extensions for Ignixa. Provides bidirectional conversion between Ignixa's modern interfaces (IElement, IType) and Firely SDK's interfaces (ITypedElement, IElementDefinitionSummary).
Purpose
This library enables:
- Community adoption: Use Ignixa core libraries with existing Firely SDK-based tools
- Gradual migration: Adopt Ignixa interfaces incrementally without rewriting everything
- Interoperability: Work with both ecosystems seamlessly
Usage
Firely → Ignixa Conversion
Convert Firely SDK types to Ignixa types to use with Ignixa libraries:
using Ignixa.Extensions.FirelySdk;
using Hl7.Fhir.ElementModel;
// Get a Firely SDK element
ITypedElement firelyElement = ...;
// Convert to Ignixa
IElement ignixaElement = firelyElement.ToIgnixaElement();
// Use with Ignixa libraries
var validator = new IgnixaValidator();
var result = validator.Validate(ignixaElement);
Ignixa → Firely Conversion
Convert Ignixa types to Firely SDK types to use with Firely tools:
using Ignixa.Extensions.FirelySdk;
using Ignixa.Abstractions;
// Get an Ignixa element
IElement ignixaElement = ...;
// Convert to Firely SDK
ITypedElement firelyElement = ignixaElement.ToTypedElement();
// Use with Firely SDK tools
var navigator = firelyElement.ToFhirPathNavigator();
var result = navigator.Scalar("Patient.name.family");
ISourceNode → IElement Conversion
Convert Firely's schema-less ISourceNode to Ignixa's schema-aware IElement:
using Ignixa.Extensions.FirelySdk;
using Hl7.Fhir.Serialization;
// Parse JSON with Firely SDK
ISourceNode sourceNode = FhirJsonNode.Parse(json);
// Convert to schema-aware IElement using Ignixa schema
IElement element = sourceNode.ToElement(schema);
// Access type-aware properties
var instanceType = element.InstanceType; // e.g., "Patient"
var name = element.Children("name").First();
Batch Conversions
Convert collections efficiently:
// Firely → Ignixa
IEnumerable<ITypedElement> firelyElements = ...;
IEnumerable<IElement> ignixaElements = firelyElements.ToIgnixaElements();
// Ignixa → Firely
IReadOnlyList<IElement> ignixaElements = ...;
IEnumerable<ITypedElement> firelyElements = ignixaElements.ToTypedElements();
Architecture
Adapter Classes
IgnixaElementAdapter: Wraps Firely
ITypedElement→ Implements IgnixaIElement- Lazy child materialization
- Caches the full child list for
Children()and the result of each named lookup. When both lookups list a name's children at the sameLocations in the same order, they share adapter instances, sosubsetOf()andsupersetOf()match a child reached either way without comparing its children; otherwise each lookup keeps its own adapters with the same values Children(name)always asks the wrapped element for that name alone, whether or notChildren()ran first, so an element the Firely model does not define cannot break a lookup of a modelled sibling, unless its name starts with a choice name: avalueFoosibling makesChildren("value")throw- Matches names exactly: a choice child is found by its base name (
value), not a suffixed one (valueDateTime) - Follows the wrapped element's own named lookup, as native Firely FHIRPath does, so an undefined child behaves differently by version. Firely 5.x never returns it by name, nor, under
Passthrough, anything inside it. Firely 6.x returns both when noTypedElementSettingsare passed or underPassthrough, and throws underTypeErrorMode.Report.Children()throws for it underTypeErrorMode.Report, the 5.x default, and can return it underPassthrough, with Firely 6.x when no settings are passed, or beneath an element whose type cannot be resolved
TypedElementAdapter: Wraps Ignixa
IElement→ Implements FirelyITypedElement- Streaming conversion (no upfront materialization)
- Preserves Ignixa annotation system
SourceNavigatorAdapter: Wraps Firely
ISourceNode→ Implements IgnixaISourceNavigator- Bridges the schema-less interfaces between Firely and Ignixa
- Derives
ResourceTypefrom child elements - Forwards annotations via
IAnnotatable
Extension Methods
- IgnixaExtensions:
.ToIgnixaElement(),.ToIgnixaElements()- FirelyITypedElement→ IgnixaIElement - FirelySdkExtensions:
.ToTypedElement(),.ToTypedElements()- IgnixaIElement→ FirelyITypedElement.ToSourceNavigator()- FirelyISourceNode→ IgnixaISourceNavigator.ToElement(schema)- FirelyISourceNode→ IgnixaIElement(with schema metadata)
Smart Unwrapping
The adapters detect when an element has already been wrapped and unwrap it instead of double-wrapping:
// No double-wrapping
IElement ignixa = ...;
ITypedElement firely = ignixa.ToTypedElement();
IElement back = firely.ToCoreElement(); // Returns original ignixa, not a wrapper!
Performance Considerations
Lazy Materialization
IgnixaElementAdapter (Firely → Ignixa):
- Children are materialized only on first access
Children()caches the full child list to avoid repeated Firely enumerationChildren(name)caches each looked-up name separately and does not enumerate the other children, so an adapter created per evaluation pays only for the names that evaluation asks for
Streaming Conversion
TypedElementAdapter (Ignixa → Firely):
- No upfront materialization
- Children converted on-demand as enumerated
- Memory-efficient for large trees
Limitations
- IType.Children: Empty collection (Firely
IElementDefinitionSummarydoesn't provide child definitions) - IsAbstract: Not available in Firely's
IElementDefinitionSummary, always returnsfalse - Annotations: Firely
ITypedElementdoesn't support general annotations (only stores original element for unwrapping)
Dependencies
- Ignixa.Abstractions: Modern Ignixa interfaces (IElement, IType, etc.)
- Ignixa.Serialization: SchemaAwareElement for ISourceNode → IElement conversion
- Hl7.Fhir.Base: Firely SDK base package (provides ITypedElement, ISourceNode, IElementDefinitionSummary, etc.)
Note: This package uses
Hl7.Fhir.Baseinstead of version-specific packages likeHl7.Fhir.R4, making it compatible with any FHIR version (R4, R4B, R5, STU3).
Migration Strategy
For library authors:
Accept both interfaces: Support both
IElementandITypedElementin your APIspublic class MyValidator { public ValidationResult Validate(IElement element) { ... } public ValidationResult Validate(ITypedElement element) => Validate(element.ToCoreElement()); }Prefer Ignixa internally: Use Ignixa interfaces internally, provide Firely shims externally
// Internal: Use IElement private void ValidateInternal(IElement element) { ... } // Public: Accept ITypedElement, convert to IElement public void Validate(ITypedElement element) => ValidateInternal(element.ToCoreElement());Deprecate Firely methods: Mark Firely-based methods as obsolete after a transition period
[Obsolete("Use Validate(IElement) instead")] public ValidationResult Validate(ITypedElement element) => Validate(element.ToCoreElement());
Examples
Example 1: Validate Firely Element with Ignixa Validator
// Firely SDK: Parse JSON to ITypedElement
var firelyElement = FhirJsonNode.Parse(jsonString).ToTypedElement(modelInspector);
// Convert to Ignixa
var ignixaElement = firelyElement.ToCoreElement();
// Validate with Ignixa (uses IElement)
var validator = new IgnixaFhirValidator();
var result = validator.Validate(ignixaElement);
Example 2: Use Ignixa Element with FHIRPath
// Ignixa: Get element from custom source
var ignixaElement = myCustomSource.GetPatient("123");
// Convert to Firely SDK
var firelyElement = ignixaElement.ToTypedElement();
// Evaluate FHIRPath (Firely SDK)
var compiler = new FhirPathCompiler();
var result = compiler.Compile("Patient.name.where(use='official').family")
.Invoke(firelyElement, EvaluationContext.CreateDefault());
Example 3: Interop Between Ecosystems
// Start with Firely
ITypedElement firelyPatient = ...;
// Convert to Ignixa for validation
var ignixaPatient = firelyPatient.ToCoreElement();
var validationResult = new IgnixaValidator().Validate(ignixaPatient);
// Convert back to Firely for FHIRPath
var firelyAgain = ignixaPatient.ToTypedElement();
var name = new FhirPathCompiler().Compile("Patient.name[0].family")
.Scalar(firelyAgain, EvaluationContext.CreateDefault());
Testing
The shims library includes comprehensive tests to ensure correct bidirectional conversion:
- Round-trip conversion (Firely → Ignixa → Firely)
- Property preservation (Name, Value, InstanceType, Location)
- Child navigation equivalence
- Annotation handling
- Performance benchmarks
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 is compatible. 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. |
-
net10.0
- Ensure.That (>= 10.1.0)
- Fhir.Metrics (>= 1.3.1)
- Hl7.Fhir.Base (>= 6.0.1)
- Ignixa.Abstractions (>= 0.6.108)
- Ignixa.Serialization (>= 0.6.108)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
-
net9.0
- Ensure.That (>= 10.1.0)
- Fhir.Metrics (>= 1.3.1)
- Hl7.Fhir.Base (>= 6.0.1)
- Ignixa.Abstractions (>= 0.6.108)
- Ignixa.Serialization (>= 0.6.108)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.6.108 | 0 | 12/2/2026 |
| 0.6.82 | 181 | 10/7/2026 |
| 0.6.74 | 176 | 9/3/2026 |
| 0.6.73 | 135 | 9/2/2026 |
| 0.6.68 | 158 | 8/24/2026 |
| 0.6.41 | 351 | 7/27/2026 |
| 0.6.28 | 190 | 7/22/2026 |
| 0.6.19 | 215 | 7/12/2026 |
| 0.6.7 | 218 | 7/9/2026 |
| 0.6.4 | 167 | 7/5/2026 |
| 0.5.13 | 169 | 7/3/2026 |
| 0.5.11 | 142 | 7/2/2026 |
| 0.5.6 | 193 | 6/17/2026 |
| 0.5.2 | 168 | 6/16/2026 |
| 0.5.0 | 141 | 6/15/2026 |
| 0.0.163 | 438 | 2/11/2026 |
| 0.0.160 | 168 | 2/9/2026 |
| 0.0.155 | 193 | 1/24/2026 |
| 0.0.151 | 175 | 1/21/2026 |
| 0.0.150 | 155 | 1/20/2026 |