ruby-hl7 0.1.23 released

March 18th, 2007

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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'rubygems'
require 'ruby-hl7'
require 'socket'

# create the empty hl7 message
msg = HL7::Message.new

# create an empty MSH segment
msh = HL7::Message::Segment::MSH.new 

# create an empty NTE segment
nte = HL7::Message::Segment::NTE.new
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 = HL7::Message::Segment::Default.new
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 = TCPSocket.open( "192.168.1.234", 5700 )
soc.write msg.to_mllp
soc.close

18 Responses to “ruby-hl7 0.1.23 released”

  1. Ron Sweeney Ron Sweeney Says:
    awesome!
  2. Matthew Clapp Matthew Clapp Says:
    Did you just do it for a challenge or was there a real need to do this on Ruby? I'm curious where the need for this sort of solution came from. Most companies don't have the Ruby framework installed. I think Ruby is a great, intuitive platform but I never imagined anything related to HL7 showing up on it. Very cool.
  3. segfault segfault Says:
    I wanted to promote the use of ruby in the medical software community (and it was fun).
  4. Deepak Kumar Deepak Kumar Says:
    Many thanks for your library. We have developed a Healthcare System in RoR and we were looking for this type of library. Just wanted to know, how we can easily check our application when using this library, i.e., can you suggest an easy to use receiver (preferably some other implementation).
  5. segfault segfault Says:
    Deepak, I would suggest the perl hl7 toolkit or the java HL7 Browser/HL7 Comm stuff. Both projects are open source.
  6. Ray Ray Says:
    As a clinician interested in open source EMR, the biggest problem implementing a medical solution is making the software usable for each docs brain. We develop our own forms for charts all the time. Taking one of my forms, I can scan it with Omiform and instantly create a DHTML page. Using RoR I should be able to attach this front end to my DB. Adding this HL7 modulke should allow communication between apps/providers/labs etc. The building blocks are all in place to get rolling in medicine. Why isn't there a good RoR open source medical app anywhere? Probably funding. Blue Cross of Mass put $50 million into the ehealth collaborative to hook up all docs in 3 communities. They are not using open source. What would even of a fraction of this funding do to stimulate open source medical EHR/EMR? How do we convince these big players that opensource is not a toy when the competitors are huge (like GE)? Open Source Medical Software needs this type of fuel to get traction.
  7. Chris Chris Says:
    I am using your library to read lab results from a major reference lab. The results are acquired over an SSL connection with SOAP using soap4r and then decoded with ruby-hl7. Works great! Thank you for contributing the library. I did find a couple of issues: 1. line 103 in ruby-hl7.rb does not handle a nil object. I added a test for nil: ret = ret.first if ret && ret.length == 1 2. allowed sex == "" in validation code for admin_sex field in pid.rb since I receive hl7 messages with a blank entry for the field. I will be scaling up the amount of lab result data flowing through the library and will keep you posted on any issues. Again, thank you so much for creating this library and making it available to the community.
  8. segfault segfault Says:
    Chris, I'm glad to see that people are using the library. I'll put your changes into the subversion repository later today.
  9. Eric Kramer Eric Kramer Says:
    Hello. We are getting ready to do some HL7 interfacing for a project we've developed. I was pretty excited to see your gem out there. I appreciate that you didn't try to tackle the entire HL7 spec, but instead did some basic segments and left the framework extensible. Nice choice!
  10. segfault segfault Says:
    I'm happy to hear that you like it. The spec is huge, I felt that it would be best to give the people using it as much freedom as possible.
  11. John Devine John Devine Says:
    I am developing an open source hospital information system. It is based on the Care2x open source project but using RoR. This "gem" really helps the project along! Thanks!!!
  12. Venkat Venkat Says:
    John Devine, good to know that you are developing something on the heels of Care2X using RoR. Can you share more details of the same?. is it hosted somewhere like sourceforge already?. Eager to know and participate. -Venkat@Bangalore, India.
  13. John Devine John Devine Says:
    Hi Venkat.. I havn't put it up on sourceforge yet but will as soon as I have the patient record module up and running. Any input or help would be appreciated. My email is john.h.devine@gmail.com.
  14. Jeff Jeff Says:
    Mark, I've been using your fantastic library. I've made a small optimization I'd like you to take a look at and offer comments on related to the generate_segments method: http://www.tbwcr.com/blog/2007/08/03/4/
  15. Oliver Jintha Oliver Jintha Says:
    Hi all, i find the library. However, i would like to extend some of the message segments such as the message header class to include some message segments that are specific for Malawi. I would like to find out how i can do this, and any guidance will be appreciated.
  16. segfault segfault Says:
    Oliver, Check out my post about creating new segment classes. Post any other questions here or to the mailing list. The people on the list (including myself), will probably be able to help.
  17. krammin krammin Says:
    Anyone else seeing this error? c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_ quire': no such file to load -- facets/core/class/cattr (LoadError) from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in ` quire' from c:/ruby/lib/ruby/gems/1.8/gems/ruby-hl7-0.2.44/lib/ruby-hl7.rb:21 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in ` m_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in ` quire' from test_hl7.rb:2
  18. segfault segfault Says:
    krammin, it looks like facets refactored. I'll see about fixing it this week.

Leave a Reply