Skip to main content

Crate hl7_2_from_xsd_into_json_dictionary

Crate hl7_2_from_xsd_into_json_dictionary 

Source
Expand description

Convert HL7 v2.xml XML Schema files into the JSON dictionary the hl7-2 crates read.

HL7 publishes the v2.xml encoding as a set of XML Schema documents, and sites that customise HL7 customise those documents: a hospital’s PID is the standard’s PID plus or minus whatever the local system actually sends. hl7-2 reads a dictionary rather than a schema, which is what lets one build serve every release and every dialect — so this crate is the bridge between the two. Point it at a directory of schemas and it writes the dictionary that describes them.

use hl7_2_from_xsd_into_json_dictionary::{Options, convert_directory};

let document = convert_directory("schemas/paris".as_ref(), &Options::default())?;
std::fs::write("paris.json", document.to_json())?;

The dictionary that comes out states cardinality as well as data types, which is what lets hl7-2-from-er7-into-xml in schema mode produce a document that validates against the very schemas it was built from. See spec/index.md for the conversion rules (source of truth).

Re-exports§

pub use dictionary::Document;
pub use dictionary::Field;
pub use dictionary::Item;
pub use hl7_2_xml_lite_helper as xml;

Modules§

dictionary
The dictionary document this crate writes, and how it is written.
schema
Reading HL7 v2.xml XML Schema documents into dictionary tables.

Structs§

Options
What to put in the document beyond what the schemas say.

Enums§

Error
Why a directory of schemas could not be read as a dictionary.

Functions§

convert_directory
Convert a directory of HL7 v2.xml schemas into a dictionary document.
version_from_prefix
2_5_1 -> 2.5.1, which is how a dictionary spells a release.