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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
//! Parse FHIR R5 specifications JSON file.
//!
//! For an example see the sibling file of JSON.
use crate::r5::parse::concept_maps::*;
use ::serde::{Deserialize, Serialize};
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct Entry {
/// # fullUrl
///
/// ## Description
///
/// The `fullUrl` attribute provides an absolute URL that uniquely
/// identifies a resource within a Bundle entry. This URL serves as a stable
/// identifier that can be used for references within the bundle and
/// provides a canonical location where the resource can be found. The
/// fullUrl is particularly important for maintaining referential integrity
/// within bundles and supporting resource resolution in distributed
/// systems.
///
/// ## Purpose
///
/// The `fullUrl` exists to:
///
/// - Provide unique identification for resources within bundle entries
/// - Support referential integrity and link resolution within bundles
/// - Enable absolute URL references for resource location and retrieval
/// - Support bundle processing and resource cross-referencing
/// - Facilitate resource caching and resolution mechanisms
/// - Enable proper resource identification in messaging and transaction
/// bundles
/// - Support canonical resource referencing across distributed systems
///
/// ## Usage
///
/// Use the `fullUrl` attribute when:
///
/// - Creating Bundle entries that need unique resource identification
/// - Supporting internal bundle references between resources
/// - Implementing resource resolution and caching mechanisms
/// - Creating transaction or batch bundles with resource interdependencies
/// - Building messaging bundles with multiple related resources
/// - Supporting search bundles where resources need canonical URLs
/// - Implementing resource versioning and history tracking
///
/// The fullUrl should be globally unique and ideally resolvable to the
/// actual resource location.
///
/// ## Data Type
///
/// **uri** - An absolute Uniform Resource Identifier:
///
/// - Must be an absolute URI (not relative)
/// - Should be globally unique within the context
/// - Commonly uses HTTP/HTTPS scheme for web-accessible resources
/// - May use URN scheme for non-web identifiers
/// - Should be stable and persistent when possible
/// - Must be unique within the containing bundle
/// - Should follow RFC 3986 URI syntax requirements
///
/// ## Constraints
///
/// - **Required**: Optional within bundle entries, but recommended for
/// referential integrity
/// - **Cardinality**: 0..1 (at most one occurrence per entry)
/// - **Format**: Must be a valid absolute URI
/// - **Uniqueness**: Must be unique within the containing bundle
/// - **Resolvability**: Should ideally resolve to the actual resource when
/// accessed
/// - **Stability**: Should remain stable across bundle versions when
/// representing the same resource
/// - **Scheme**: Typically HTTP/HTTPS, but other URI schemes are permitted
///
/// ## Examples
///
/// See the accompanying `example.json` file for a complete Bundle resource
/// demonstrating fullUrl usage in various contexts including search
/// results, transactions, and messaging with proper cross-referencing.
///
/// ## Related Keys
///
/// - `entry` - The bundle entry container that includes the fullUrl
/// - `resource` - The actual FHIR resource that the fullUrl identifies
/// - `reference` - Resource references that may use the fullUrl for
/// resolution
/// - `url` - Canonical URLs in resources that may match the fullUrl
/// - `id` - Resource logical ID that may be derived from or related to the
/// fullUrl
/// - `link` - Bundle-level links that provide navigation context for
/// entries
///
/// ## Specification Reference
///
/// Based on FHIR R5 specification. For complete details, refer to the
/// official FHIR R5 documentation for Bundle resource structure and fullUrl
/// element requirements.
///
pub full_url: String,
/// # resource
///
/// ## Description
///
/// The `resource` property defines capabilities and constraints for
/// specific FHIR resource types in capability statements and other
/// conformance resources.
///
/// ## Purpose
///
/// - Define resource-specific capabilities
/// - Specify supported operations per resource
/// - Document resource constraints and profiles
/// - Enable resource capability discovery
/// - Support conformance testing
///
/// ## Usage
///
/// The `resource` property is used in CapabilityStatement and other
/// conformance resources to define capabilities for specific resource
/// types.
///
/// ## Data Type
///
/// **BackboneElement** - Complex structure defining resource capabilities
///
/// ## Constraints
///
/// - Must specify valid resource type
/// - Should define realistic capabilities
/// - Must align with server implementation
/// - Should include relevant interactions
///
/// ## Examples
///
/// ### Patient Resource Capabilities
/// ```json
/// {
/// "resource": [
/// {
/// "type": "Patient",
/// "interaction": [
/// {"code": "read"},
/// {"code": "search-type"}
/// ]
/// }
/// ]
/// }
/// ```
///
/// ## Related Keys
///
/// - `type` - Resource types
/// - `interaction` - Supported interactions
/// - `profile` - Resource profiles
/// - `rest` - REST capabilities
///
/// ## Specification Reference
///
/// FHIR R5 CapabilityStatement:
/// [resource](http://hl7.org/fhir/R5/capabilitystatement-definitions.html#CapabilityStatement.rest.resource)
///
pub resource: Resource,
}
#[cfg(test)]
mod tests {
use super::*;
type T = Entry;
#[test]
fn test_serde_json_from_reader() {
let path = crate::r5::parse::concept_maps::DIR
.join("entry")
.join("entry.json");
let file = std::fs::File::open(path).expect("open");
let reader = std::io::BufReader::new(file);
let actual: T = ::serde_json::from_reader(reader).unwrap();
assert_eq!(
actual.full_url,
"http://hl7.org/fhir/ConceptMap/cm-administrative-gender-v2"
);
}
}