Skip to main content

Crate hl7_2_from_er7_into_json

Crate hl7_2_from_er7_into_json 

Source
Expand description

Convert HL7 v2.5 messages from ER7 (pipe-delimited) encoding to a typed JSON representation.

This is the JSON sibling of hl7-2-from-er7-into-xml: both read ER7 through the er7 crate and use the same HL7 v2.5 data-type tables to name output keys, but this one renders JSON instead of the official v2.xml XML. See spec/index.md for the exact mapping rules (source of truth).

The ER7 encoding itself — parsing, delimiters, escape sequences — comes from er7. This crate adds the layer above it: the v2.5 data-type tables, the message-structure grammars, and the JSON renderer.

let er7 = "MSH|^~\\&|hphis||EPIC||20131011093851||ORM^O01|14AAACVDD|P|2.5\r\
           PID|1||241900||MEDIANO^FOUAZ\r\
           ORC|NW|ORD1";
let json = hl7_2_from_er7_into_json::convert(er7).unwrap();
assert!(json.contains("\"ORM_O01\""));
assert!(json.contains("\"XPN.1\""));

Re-exports§

pub use er7;

Modules§

json
Building the typed JSON tree from parsed segments, and serializing it.
structure
HL7 v2.5 abstract message structures (segment groups).
types
HL7 v2.5 data-type knowledge used to name JSON keys.

Structs§

Options
Options controlling how a message is converted; see convert_with_options.

Enums§

Hl7Error
Errors that can occur while turning ER7 text into a er7::Message or, in turn, into JSON.

Functions§

convert
Convert one ER7 message to JSON with default options.
convert_with_options
Convert one ER7 message to JSON.
split_messages
Split input that may hold several messages (or an HL7 batch file) into individual ER7 messages, one per MSH segment. Batch envelope segments (FHS, BHS, BTS, FTS) are dropped.