HL7 Parser

February 22, 2026 · 1 min read
projects

A Go library for parsing HL7 (Health Level 7) messages. Built as a learning exercise in HL7 parsing and Go buffered I/O, it went on to be used in production at two companies.

Features

  • io.Reader based - accepts any io.Reader (files, TCP streams, buffers), making it easy to integrate with different data sources
  • Lazy parsing - segments are parsed on access, so you can bail early if a message isn’t relevant to your use case
  • Stdlib only - zero runtime dependencies
  • Cross-platform - tested on macOS, Windows, and Ubuntu across multiple Go versions

Example

reader := hl7.NewReader(file)

for {
    msg, err := reader.ReadMessage()
    if err == io.EOF {
        break
    }
    seg, _ := msg.Segment("MSH")
    // Work with segment fields...
}

Tech Stack

LayerTechnology
LanguageGo (stdlib only)
I/OBuffered io.Reader
CIGitHub Actions (multi-OS, multi-version)
Authors
Software Developer
Software developer passionate about building great tools and applications.