As promissed in a previous post, I've added the Base64 filter stream to the NHapiTools. Here's version 1.1 of the NHapiTools.
NHapi allows you to add non standard (custom) segments to messages. This way you can implement custom segments that differ from the HL7 specs or don't exist in the specs. The structure of NHapi doesn't allow you to implement custom versions of standard segments. For example: In 2010 I wrote a post on data I received (too many patient ID's) that I had to solve. I had to change the NHapi source code. With NHapiTools you are able to override standard segments with custom segments.
The NHapiTools provide some extension methods to make getting data from HL7 message much simpler. the NHapiTools provide some assemblies for specific HL7 version that are generator on the NHapi assemblies.
Implementing custom rules can be a lot of work.To ease the pain -as a matter of speaking- the NHapiTools provide 4 types of configurable message rules that you can apply to all or a selection of messages. using these rules you can validate if a field contains a numeric value, make a field mandatory (can't contain a null or string.empty value), make a segment (e.g. a custom Z-segment) madatory and apply regular expressions on fields.
In the previous post I showed you how to use the AutomatedContext. Adding validation rules with the default NHapi method will require a new build on every change in the ruleset. On the other hand the AutomatedContext will apply every rule it finds, which might be undesirable if you application is running in different production environments (that might require different rulesets). The ConfigurableContext will give you the ability to add and remove custom rules through the application configuration.