jcomellas / hl7parser

HL7 parser with segment code generators in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HL7 Parser

Overview

The parser is divided into two parts:

  1. Low-level functions that implement a tokenizer, lexer, parser, callback (SAX-like) parser for the HL7 protocol.
  2. Custom segment accessors (code-generated by hl7segdef.py).

This HL7 parser was designed for a memory-constrained hardware environment and thus avoids allocating memory as much as possible. This makes its interface weird at times, and care must be taken to avoid overwriting memory that is in use by a message (e.g. modifying a parsed buffer while the resulting message is still in use).

Requirements

The HL7 parser has no runtime dependency other than the standard C library, but it requires qmake from the Qt project to generate its makefiles.

Installation

To install qmake in Ubuntu/Debian you can run:

apt-get install libt4-dev qt4-qmake

Then run:

cd hl7parser
./configure
make
sudo make install
sudo ldconfig

This will install the dynamic libraries and headers for the project in /usr/local. You can test the behavior of the library by using the following programs:

bin/test_lexer
bin/test_cbparser
bin/test_parser
bin/test_segment

Custom segments

The segment accessors are defined in an XML file (hl7segdef.xml) and are auto-generated by a Python script (hl7segdef.py). The code used to access the segments is already included in the project (see the src/seg_*.c and the include/hl7parser/seg_*.h files). If you need to modify the segment definitions, just remove these files, modify the XML file and run the script like this:

python ./hl7segdef.py <file name>

About

HL7 parser with segment code generators in C

License:Apache License 2.0


Languages

Language:C 95.1%Language:Python 3.1%Language:IDL 1.6%Language:C++ 0.2%