Wednesday, September 05, 2007

Open-source .NET HL7 Parser

I recently spent some time searching for a good open-source .NET HL7 parser. The pickings were pretty slim, and the best option appears to be NHapi--which is a fairly new port of the popular Hapi Java HL7 parser. I had to dig surprising deep into the search results to find NHapi, and though the code seems solid, the project is not extremely active. Another big weakness is the complete lack of API documentation and code samples. You can figure out the essentials from the Hapi Javadoc and sample code, but that's a bit of a pain so I've generated MS Help API docs for each HL7 version supported by NHapi. They are available in a single zip file here (80MB).

20 comments:

atilla acar said...

Great work,
Can nHapi really works? I am trying to develop something with Hapi but it have some problems... Maybe I should pass nHapi before It is too late

Ashley said...

It works for the basics. We're still in pre-production evaluation and prototyping with it, so I can't tell you much more than that. You should post to the sourceforge forum if you have a particular scenario you want to ask about.

sam_gamegie said...

how do you run the chm files ?
I can't open then...

Ashley said...

If you don't have the MS Compiled Help viewer installed (unlikely) you need to install it. Otherwise it's likely a security restriction related to a Windows XP security update. Try this workaround.

Anonymous said...

How are the files compressed? WinXP is not able to unzip them.

Ashley said...

They are compressed with WinZip.

Anonymous said...

Thanks, I had tried with an earlier version of Winzip. Nice work on the documentation. Do you know why ADT_A04 and ADT_A08 classes are missing from versions 2.4 and 2.5?
Mark

Ashley said...

Those classes are missing from the documentation because they are missing from the compiled assemblies. I'm not sure why the classes themselves are missing.

Anonymous said...

Hi all, does anybody know how to create a TBR_R08 message? How to specify the RDT segment?

You can email me at: tancapaul@yahoo.com

Thanks

Anonymous said...

Hi Ashley, this is Anwar from India, a software programmer by profession and currently working on R&D on healthcare & IT. During my digging on healthcare knowledge I found that HL7 plays major role in Healthcare, and for that nHAPI is helpful for parsing messages from HL7 to xml and xml to HL7.

During the search in Google i found this blog, which may really help me in my project.

I also read your profile and its really interesting.

Hope I will be an active member of this blog for knowledge gaining and sharing.

Thanks,
Anwar Shaik

Ashley Tate said...

Thanks Anwar!

Vineeth said...

Hi ashley,
this is vineeth from india, we make our software as HL7 compactible. we are using nHapi API for message parsing.

so for this project i need your help.

Thanks,
Vineeth

Anonymous said...

I'm new to this, but when I try to create a PID.PatientNameGivenName = "Testing" I get a compile error since it is readonly. What am I doing wrong? Using .Net 2.0.

Thanks

Ashley Tate said...

anonymous, you should post your question to the NHapi discussion forum on source forge:

http://sourceforge.net/forum/forum.php?forum_id=569647

Anonymous said...

Thanks for your great work!
I use nHapi toolkit for compiling,it helps me deeply.
And it can save me a lot of time.
Thank you for sharing your documentation!

Ashley Tate said...

You're welcome, Anonymous!

Anonymous said...

Hi.
I'm a s/w engg working for a health care organization.I'm very new to HL7 protocol.I have few questions can you please answer.
Here is that....

1st of let me describe i 'm going to do:-

I want to develop a client software which will communicate with the LIS server (through TCP/IP)and i need to get the HL7 data and parse it and store it into my local database(May be MS access).Then i may have to show it to the user using my UI.

Note:- My application is going to be a VC++/MFC application.

Now my question is :-

1.How the NHapi can help me to fulfill my above describe question.
2.Can i use NHapi source code (as it is open source)to parse the information.I mean to say ...can i use it as HL7 to .Xml parser
3.If yes,where is the source code available.

i tried to download it from :-

http://sourceforge.net/project/showfiles.php?group_id=166900&package_id=230204&release_id=552600

But it is having some problem.i don't know why its not downloading...

N.B. :- pls note that my application is going to be a MFC application with VS2005

Please give response.
Thanks.

Ashley Tate said...

@anonymous - If you're having trouble downloading or questions about the NHapi project I suggest you contact the project administrators.

Shikari Shambu said...

Ashley,
Do you have any sample programs using NHapi. The stuff in NHapi Quickstart does not seem to work

e.g.
using NHapi.Base.Model;
using NHapi.Base.Parser;
using NHapi.Base;
using NHapi.Model.V23;
using NHapi.Model.V23.Message;
using NHapi.Model.V23.Segment;


string message =
@"MSH|^~\&|SENDING|SENDER|RECV|INST|20060228155525||QRY^R02^QRY_R02|1|P|2.3|
QRD|20060228155525|R|I||||10^RD&Records&0126|38923^^^^^^^^&INST|||";

PipeParser parser = new PipeParser();

//GET an error here.
Error 1 No overload for method 'parse' takes '1' arguments
IMessage m = parser.parse(message);

QRY_R02 qryR02 = m as QRY_R02;
Console.WriteLine(qryR02.QRD.GetWhoSubjectFilter(0).IDNumber.Value);

Ashley Tate said...

@Shikari Shambu: I suggest you post a question to the NHapi forums. I generated the docs here and did some early prototyping, but my company ended up using a different HL7 parser so I am not an NHapi expert by any means.

 
Header photo courtesy of: http://www.flickr.com/photos/tmartin/ / CC BY-NC 2.0