Skip to content

Configuration Options

Jake Aitchison edited this page Jan 20, 2023 · 2 revisions

Configuration Options

Hexadecimal line feed and carriage return escape sequence configuration

The escape sequence for line feed \n and carriage return \r are configurable to 1 of 3 values each respectively.

Possible values for lineFeedHexadecimal are X0A, X00A and X000a (they map to an enum)

Possible values for carriageReturnHexadecimal are X0D, X00D and X000d (they map to an enum)

If the configuration isn't specified in the App.config the default values are X0A for line feed and X0D for carriage return.

Please note: the defaults prior to 3.0.0 where X0A for lineFeedHexadecimal and X000d for carriageReturnHexadecimal.

Requirements

You need to update the project's app.config <configSections> element to include the 'EscapingConfiguration' configuration section.

And then you need to add a EscapingConfiguration section that details the hexadecimal escaping configuration options you desire.

example App.config configuration:

<configSections>
  <section name="EscapingConfiguration" type="NHapi.Base.Model.Configuration.EscapingConfigurationSection, NHapi.Base"/>
</configSections>
...
<EscapingConfiguration>
  <HexadecimalEscaping lineFeedHexadecimal="X0A" carriageReturnHexadecimal="X0D"/>
</EscapingConfiguration>

Custom HL7 Object Models

You can create your own custom HL7 versioned object models (messages, segments, data types etc) and have nHapi parse HL7 messages into it.

Requirements

You need to update the project's app.config <configSections> element to include the 'Hl7PackageCollection' configuration section.

And then you need to add a Hl7PackageCollection section that details the namespace and custom version name so that the PipeParser can find the custom definitions.

example App.config configuration:

<configSections>
  <section name="Hl7PackageCollection" type="NHapi.Base.Model.Configuration.HL7PackageConfigurationSection, NHapi.Base"/>
</configSections>
...
<Hl7PackageCollection>
  <HL7Package name="NHapi.Model.V22_ZSegments" version="2.2.CustomZ"/>
</Hl7PackageCollection>

You need to pass the version you defined above into the PipeParser along with the HL7 message.

var parser = new PipeParser();

var parsed = parser.Parse(message, "2.2.CustomZ");