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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//! Health Level Seven (HL7) version 3 (V3) for Rust — a foundation, not a
//! complete implementation.
//!
//! HL7 v3 replaced v2's pipe-delimited text and per-message-type segment
//! tables with one thing reused everywhere: the [Reference Information
//! Model](rim) (RIM), six backbone classes ([`rim::Act`], [`rim::Entity`],
//! [`rim::Role`], [`rim::Participation`], [`rim::ActRelationship`],
//! [`rim::RoleLink`]) that every domain payload — lab results, care
//! records, structured product labeling — is assembled from, serialized as
//! XML instead of ER7. It achieved little messaging adoption of its own
//! (implementers found the model-driven rigor expensive to work with) but
//! its RIM and three-level structure live on directly inside the Clinical
//! Document Architecture (CDA), which did succeed.
//!
//! ```
//! use hl7_3::message;
//!
//! let xml = r#"
//! <QUQI_IN000001UV01 xmlns="urn:hl7-org:v3">
//! <id root="2.16.840.1.113883.19.5" extension="MSG00001"/>
//! <interactionId root="2.16.840.1.113883.1.6" extension="QUQI_IN000001UV01"/>
//! <controlActProcess classCode="CACT" moodCode="EVN">
//! <code code="QUQI_TE000001UV01"/>
//! <subject>
//! <observation classCode="OBS" moodCode="EVN"/>
//! </subject>
//! </controlActProcess>
//! </QUQI_IN000001UV01>
//! "#;
//! let parsed = message::parse(xml)?;
//! assert_eq!(parsed.control_act.unwrap().domain.unwrap().local_name(), "observation");
//! # Ok::<(), hl7_3::Error>(())
//! ```
//!
//! ## What this crate is, and is not
//!
//! It is: the RIM backbone classes as Rust types ([`rim`]), the data types
//! RIM attributes are built from — identifiers, coded values, intervals,
//! quantities, encapsulated data, and the explicit-null mechanism any of
//! them can carry instead of a value ([`vocabulary`]) — and a reader for
//! the three-level message envelope every interaction shares ([`message`])
//! — transport wrapper, control act wrapper, domain payload.
//!
//! It is not: a validator against any of HL7 v3's vocabulary domains or
//! interaction schemas, a CDA document model, or a decoder for any
//! specific domain payload's internal shape (a lab result, a care record)
//! — those vary per interaction and are read with [`rim`] types by the
//! caller, the same way generic mode in
//! [`hl7-2`](https://crates.io/crates/hl7-2) hands back a tree rather than
//! a typed message. `spec/index.md` is the exact, current statement of
//! scope; where this comment and that document disagree, the document is
//! right.
//!
//! For a stable, long-lived interaction, [`typed::FromElement`] — derived
//! with `#[derive(FromElement)]` behind the `derive` feature
//! ([`hl7-3-derive`](https://crates.io/crates/hl7-3-derive)) — maps a
//! struct's fields onto an element's attributes and children once, the way
//! `hl7-2`'s struct mode does for v2 paths. See [`typed`] for the
//! attributes and an example.
pub use ;
pub use ;
pub use ;
/// The `#[derive(FromElement)]` macro, re-exported so the `hl7-3-derive`
/// crate does not have to be named as a dependency. Requires the `derive`
/// feature. (Same name as the [`typed::FromElement`] trait, deliberately —
/// like `hl7-2`'s `FromHl7`, Rust keeps a derive macro and a trait of the
/// same name in separate namespaces, so `#[derive(FromElement)]` and `impl
/// FromElement` never conflict.)
pub use FromElement;
/// The XML reader this crate reads HL7 v3 messages through, re-exported so
/// callers can name [`xml::Element`] without adding their own dependency.
pub use hl7_2_xml_lite_helper as xml;
/// What can go wrong.