/rust-hl7

Learning rust by playing with a HL7 parser. Use for real at your own risk!

Primary LanguageRust

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