#hl7 #parser #experimental #message #object #builder #check

rust-hl7

HL7 Parser and object builder? query'er? - experimental only at any rate

6 releases (3 breaking)

0.5.0 Sep 8, 2021
0.4.0 Aug 10, 2021
0.3.0 Jul 29, 2021
0.2.2 Jul 24, 2021

#2227 in Rust patterns

MIT/Apache

56KB
1K SLoC

An experimental HL7 library

CI Ubunutu Crates IO

Totally kind of like production ready!

This second cut provides consistent structure down to the sub-sub-field, efficient accessors to shared string reference data, with standardized implementations of common functionality.

Interpreting these facets (type conversion, determining which fields they represent etc) is a future problem... there is no plan whatsoever for message conformance checks or anything of that nature.

This library is trying to provide the tooling you need to build robust HL7 based systems, without dictating how you go about it. There's no one-size-fits-all here, so we try to provide a box of separate tools rather than a full framework.

Intended Features and Design Notes:

  • Initially use hl7 default separator chars
  • Use separator chars from the message
  • Add support for sub-field (component/subcomponent) items
    • Field repeats (via ~)
  • Initially, avoid any per-segment knowledge, requirement to read the spec too much etc.
    • Implementing all the segments, across all the hl7 versions, version-specific parsing etc is tooooo much while we're getting started.
  • Add support for HL7 escape sequences (#22)
    • Decoding of the most common escape sequences including \E\, \R\, \S\ & \T\
    • Correctly passes through \H\, \N\ and custom \Z..\ sequences unchanged
    • Decodes \X..\ sequences for hex-encoded chars
    • Support for various unicode sequences (\C..\, \M..\). These are lower priority as HL7 Australia considers them deprecated
  • Add tighter MSH as an exception to the above
  • The above allows us to parse everything as strings, and provide helper methods for type conversions as required.
  • Parse a message using a TryFrom<&str> impl rather than a dedicated parser
  • Index into messages using HL7 string index notation and binary methods
    • Index into sub-fields using HL7 string index notation and binary methods
    • Index into the segment enum using HL7 string index notation and binary methods
  • Implement buffer-copy-free generic indexing into MSH

Dependencies

~2.5–4MB
~72K SLoC