1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Health Level Seven (HL7®) for Rust.
//!
//! HL7 is not one standard but a family of them, and they have little in
//! common beyond the name and the problem: v2 is delimited text, v3 is
//! XML, the HL7® FHIR® standard is resources over HTTP. So this crate is
//! organized by standard, one module each, and the module you want is the
//! version your senders speak:
//!
//! - [`v2`] — HL7 v2, releases 2.1 through 2.9. The format most healthcare
//! data still moves in.
//! - [`v3`] — HL7 v3: the Reference Information Model, and the
//! three-level message envelope built from it. A foundation, not a full
//! implementation — see that module's own documentation for scope.
//!
//! ```
//! use hl7::v2;
//!
//! let message = v2::parse("MSH|^~\\&|LAB||EPIC||20240101||ORU^R01|1|P|2.5\r\
//! PID|1||241900||SMITH^JOHN")?;
//! assert_eq!(message.structure_id(), "ORU_R01");
//! assert_eq!(message.get("PID-5.1")?.as_deref(), Some("SMITH"));
//! # Ok::<(), v2::Error>(())
//! ```
//!
//! Each module is its own crate underneath — `hl7::v2` is the `hl7-2`
//! crate, `hl7::v3` is `hl7-3`, both re-exported here — so a caller who
//! wants only one standard can depend on that crate directly instead of
//! this umbrella:
//!
//! ```toml
//! [dependencies]
//! hl7-2 = "0.3"
//! ```
//!
//! Nothing lives at the root but the modules. A name that means one thing
//! in v2 means another in FHIR — a "message", a "segment", a "code" — and
//! flattening them into one namespace would only invite mixing them up.
//!
//! See [`v2`] for everything HL7 v2, and `hl7-2`'s `spec/index.md` for the
//! normative specification of it.
//!
//! # Trademarks
//!
//! HL7®, and FHIR® are the registered trademarks of Health Level Seven
//! International and their use of these trademarks does not constitute an
//! endorsement by HL7.
// No `unsafe` anywhere in this crate, enforced rather than merely true:
// `forbid` cannot be lifted by an `allow` further down, so this is a
// property a reviewer can rely on without reading the sources. See
// SECURITY.md.
pub use hl7_2 as v2;
pub use hl7_3 as v3;