ruby-hl7 0.1.23 released

This is the first public release of my Ruby HL7 library. HL7 is a standard for information exchange in hospitals, it’s used for everything from lab work to billing and scheduling. The library can parse or generate HL7 messages. Currently the library only support HL7 2.x, but I’d like to add support for the xml based HL7 3.0 in a future version.

You can install the library by typing gem install ruby-hl7. The bugtracker is hosted locally. I’ve created a rubyforge project to store the releases.

Here’s an example of ruby-hl7 usage:

require 'rubygems'
require 'ruby-hl7'
require 'socket'

# create the empty hl7 message
msg =

# create an empty MSH segment
msh = 

# create an empty NTE segment
nte =
msg << msh # add the MSH segment to our message
msg << nte  # add the NTE segment to our message

# let's fill in some fields using pre-defined aliases
msh.sending_app = "my test app"
msh.sending_facility = "my apartment"
nte.comment = "my message rocks, ruby-hl7 is great"

# let's create our own on-the-fly segment (NK1 is not implemented in code)
seg =
seg.e0 = "NK1"             # define the segment's name
seg.e1 = "MORE INFO"   # define it's first field
seg.e2 = "OTHER INFO" # define it's second field
msg << seg  # add the new segment to the message
soc = "", 5700 )
soc.write msg.to_mllp