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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ignixa.Extensions.FirelySdk6" Version="0.6.108" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ignixa.Extensions.FirelySdk6" Version="0.6.108" />
                    
Directory.Packages.props
<PackageReference Include="Ignixa.Extensions.FirelySdk6" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ignixa.Extensions.FirelySdk6 --version 0.6.108
                    
#r "nuget: Ignixa.Extensions.FirelySdk6, 0.6.108"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ignixa.Extensions.FirelySdk6@0.6.108
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ignixa.Extensions.FirelySdk6&version=0.6.108
                    
Install as a Cake Addin
#tool nuget:?package=Ignixa.Extensions.FirelySdk6&version=0.6.108
                    
Install as a Cake Tool

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:

  1. Community adoption: Use Ignixa core libraries with existing Firely SDK-based tools
  2. Gradual migration: Adopt Ignixa interfaces incrementally without rewriting everything
  3. 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

  1. IgnixaElementAdapter: Wraps Firely ITypedElement → Implements Ignixa IElement

    • 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 same Locations in the same order, they share adapter instances, so subsetOf() and supersetOf() 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 not Children() 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: a valueFoo sibling makes Children("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 no TypedElementSettings are passed or under Passthrough, and throws under TypeErrorMode.Report. Children() throws for it under TypeErrorMode.Report, the 5.x default, and can return it under Passthrough, with Firely 6.x when no settings are passed, or beneath an element whose type cannot be resolved
  2. TypedElementAdapter: Wraps Ignixa IElement → Implements Firely ITypedElement

    • Streaming conversion (no upfront materialization)
    • Preserves Ignixa annotation system
  3. SourceNavigatorAdapter: Wraps Firely ISourceNode → Implements Ignixa ISourceNavigator

    • Bridges the schema-less interfaces between Firely and Ignixa
    • Derives ResourceType from child elements
    • Forwards annotations via IAnnotatable

Extension Methods

  • IgnixaExtensions: .ToIgnixaElement(), .ToIgnixaElements() - Firely ITypedElement → Ignixa IElement
  • FirelySdkExtensions:
    • .ToTypedElement(), .ToTypedElements() - Ignixa IElement → Firely ITypedElement
    • .ToSourceNavigator() - Firely ISourceNode → Ignixa ISourceNavigator
    • .ToElement(schema) - Firely ISourceNode → Ignixa IElement (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 enumeration
  • Children(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

  1. IType.Children: Empty collection (Firely IElementDefinitionSummary doesn't provide child definitions)
  2. IsAbstract: Not available in Firely's IElementDefinitionSummary, always returns false
  3. Annotations: Firely ITypedElement doesn'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.Base instead of version-specific packages like Hl7.Fhir.R4, making it compatible with any FHIR version (R4, R4B, R5, STU3).

Migration Strategy

For library authors:

  1. Accept both interfaces: Support both IElement and ITypedElement in your APIs

    public class MyValidator
    {
        public ValidationResult Validate(IElement element) { ... }
        public ValidationResult Validate(ITypedElement element) => Validate(element.ToCoreElement());
    }
    
  2. 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());
    
  3. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed