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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//! # Fhirbolt
//! Fhirbolt is a library that enables you to work with FHIR resources in Rust.
//! This library includes FHIR data types and methods for (de)serializing these from and to JSON and XML.
//!
//! More elaborate features like validation (including cardinality and slicing) or full FHIRPath evaluation
//! might be added eventually.
//!
//! Currenlty supported FHIR releases: R4, R4B and R5
//!
//! The Rust crate supports two working modes:
//! 1. a generic [element] model
//! 2. working with fully typed model structs.
//!
//! ## Installation
//! Add `fhirbolt` to your Cargo.toml.
//! You can select which FHIR release to include model structs for by speficifying them as Cargo features.
//!
//! ```toml
//! [dependencies]
//! fhirbolt = { version = "0.2", features = ["r4b"] }
//! ```
//! By default, no FHIR release is included.
//!
//! ## Example
//! ```
//! // The `Resource` type is an enum that contains all possible FHIR resources.
//! // If the resource type is known in advance, you could also use a concrete resource type
//! // (like e.g. `fhirbolt::model::r4b::resources::Observation`).
//! use fhirbolt::model::r4b::{
//! Resource,
//! resources::{Observation, ObservationValue},
//! types::{Code, CodeableConcept, Coding, String as FhirString},
//! };
//! use fhirbolt::serde::{DeserializationConfig, DeserializationMode};
//!
//! // The type of `s` is `&str`
//! let s = r#"{
//! "resourceType": "Observation",
//! "status": "final",
//! "code": {
//! "text": "some code"
//! },
//! "valueString": "some value"
//! }"#;
//!
//! let r: Resource = fhirbolt::json::from_str(s, None).unwrap();
//!
//! match r {
//! Resource::Observation(ref o) => println!("deserialized observation: {:?}", r),
//! _ => (),
//! }
//!
//! // Use Default::default() or constructing new resources by yourself
//! let o = Observation {
//! status: "final".into(),
//! code: Box::new(CodeableConcept {
//! text: Some("some code".into()),
//! ..Default::default()
//! }),
//! value: Some(ObservationValue::String("some value".into())),
//! ..Default::default()
//! };
//! ```
//!
//! You can pass a [`DeserializationConfig`](crate::serde::DeserializationConfig) to configure the deserialization behavior.
pub use ;
pub use ;