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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
//! PackagedProductDefinition
//!
//! URL: http://hl7.org/fhir/StructureDefinition/PackagedProductDefinition
//!
//! Version: 5.0.0
//!
//! PackagedProductDefinition Resource: A medically related item or items, in a container or package.
//!
//! FHIR: <https://build.fhir.org/>
//!
//! UML: <https://build.fhir.org/uml.html>
// Allow unused crate::r5::types as types;
#![allow(unused_imports)]
use crate::r5::types;
use ::serde::{Deserialize, Serialize};
use fhir_derive_macros::Validate;
/// A medically related item or items, in a container or package.
///
/// PackagedProductDefinition describes how a medicinal or medically related
/// product is physically packaged and supplied. It captures the complete
/// packaging hierarchy, such as a box that contains blisters that in turn
/// contain tablets, or a bottle of liquid, or a multi-component kit with a
/// diluent, together with the medically related items held at each level. The
/// resource records the pack size, the legal status of supply as classified by
/// a regulator, the marketing status and jurisdictions where the pack is placed
/// on the market, the manufacturers, and shelf life and storage information for
/// each packaging component.
///
/// In FHIR R5 this resource is part of the medication and regulated products
/// group and is used chiefly in the context of medicinal product regulation,
/// for example ISO IDMP submissions and pharmaceutical dossiers, to describe
/// how an authorized product is presented to the market. It does not describe
/// the substances or the abstract product itself; instead it references those
/// definitions and concentrates on presentation, containment, and supply.
///
/// # Related resources
///
/// This resource typically references product and administrable definitions via
/// [`Reference`](crate::r5::types::Reference), and the items within a package
/// are recorded with [`CodeableReference`](crate::r5::types::CodeableReference).
/// Regulatory classifications use [`CodeableConcept`](crate::r5::types::CodeableConcept),
/// availability on the market uses [`MarketingStatus`](crate::r5::types::MarketingStatus),
/// and shelf life uses [`ProductShelfLife`](crate::r5::types::ProductShelfLife).
/// It is commonly used alongside the related regulated product resources such as
/// `MedicinalProductDefinition`, `ManufacturedItemDefinition`, and
/// `AdministrableProductDefinition`.
///
/// # Examples
///
/// ```
/// use fhir::r5::resources::packaged_product_definition::PackagedProductDefinition;
///
/// let value = PackagedProductDefinition::default();
/// let json = ::serde_json::to_value(&value).unwrap();
/// let back: PackagedProductDefinition = ::serde_json::from_value(json).unwrap();
/// assert_eq!(value, back);
/// ```
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct PackagedProductDefinition {
/// Logical id of this artifact
pub id: Option<types::String>,
/// Metadata about the resource
pub meta: Option<types::Meta>,
/// A set of rules under which this content was created
pub implicit_rules: Option<types::Uri>,
/// Language of the resource content
pub language: Option<types::Code>,
/// Text summary of the resource, for human interpretation
pub text: Option<types::Narrative>,
/// Contained, inline Resources
pub contained: Option<Vec<::serde_json::Value>>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored
pub modifier_extension: Option<Vec<types::Extension>>,
/// A unique identifier for this package as whole - not for the content of the package
pub identifier: Option<Vec<types::Identifier>>,
/// A name for this package. Typically as listed in a drug formulary, catalogue, inventory etc
pub name: Option<types::String>,
/// A high level category e.g. medicinal product, raw material, shipping container etc
pub r#type: Option<types::CodeableConcept>,
/// References the medicinal or manufactured product definitions that this package is a pack for.
pub package_for: Option<Vec<types::Reference>>,
/// The status within the lifecycle of this item. High level - not intended to duplicate details elsewhere e.g. legal status, or authorization/marketing status
pub status: Option<types::CodeableConcept>,
/// The date at which the given status became applicable
pub status_date: Option<types::DateTime>,
/// A total of the complete count of contained items of a particular type/form, independent of sub-packaging or organization. This can be considered as the pack size
pub contained_item_quantity: Option<Vec<types::Quantity>>,
/// Textual description. Note that this is not the name of the package or product
pub description: Option<types::Markdown>,
/// The regulator-classified legal status of supply for this pack, optionally scoped by jurisdiction.
pub legal_status_of_supply: Option<Vec<PackagedProductDefinitionLegalStatusOfSupply>>,
/// Allows specifying that an item is on the market for sale, or that it is not available, and the dates and locations associated
pub marketing_status: Option<Vec<types::MarketingStatus>>,
/// Identifies if the drug product is supplied with another item such as a diluent or adjuvant
pub copackaged_indicator: Option<types::Boolean>,
/// Manufacturer of this package type (multiple means these are all possible manufacturers)
pub manufacturer: Option<Vec<types::Reference>>,
/// Additional information or supporting documentation about the packaged product
pub attached_document: Option<Vec<types::Reference>>,
/// The outermost packaging item, forming the root of the nested container hierarchy and the medically related items it holds.
pub packaging: Option<PackagedProductDefinitionPackaging>,
/// Allows the key features to be recorded, such as "hospital pack", "nurse prescribable"
pub characteristic: Option<Vec<::serde_json::Value>>,
}
/// The legal status of supply of the packaged item as classified by the regulator.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct PackagedProductDefinitionLegalStatusOfSupply {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Option<Vec<types::Extension>>,
/// The actual status of supply. In what situation this package type may be supplied for use
pub code: Option<types::CodeableConcept>,
/// The place where the legal status of supply applies
pub jurisdiction: Option<types::CodeableConcept>,
}
/// A packaging item, as a container for medically related items, possibly with
/// other packaging items within, or a packaging component, such as bottle cap.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct PackagedProductDefinitionPackaging {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Option<Vec<types::Extension>>,
/// An identifier that is specific to this particular part of the packaging. Including possibly a Data Carrier Identifier
pub identifier: Option<Vec<types::Identifier>>,
/// The physical type of the container of the items
pub r#type: Option<types::CodeableConcept>,
/// Is this a part of the packaging (e.g. a cap or bottle stopper), rather than the packaging itself (e.g. a bottle or vial)
pub component_part: Option<types::Boolean>,
/// The quantity of this level of packaging in the package that contains it (with the outermost level being 1)
pub quantity: Option<types::Integer>,
/// Material type of the package item
pub material: Option<Vec<types::CodeableConcept>>,
/// A possible alternate material for this part of the packaging, that is allowed to be used instead of the usual material
pub alternate_material: Option<Vec<types::CodeableConcept>>,
/// Shelf Life and storage information
pub shelf_life_storage: Option<Vec<types::ProductShelfLife>>,
/// Manufacturer of this packaging item (multiple means these are all potential manufacturers)
pub manufacturer: Option<Vec<types::Reference>>,
/// General characteristics of this item
pub property: Option<Vec<PackagedProductDefinitionPackagingProperty>>,
/// The item(s) within the packaging
pub contained_item: Option<Vec<PackagedProductDefinitionPackagingContainedItem>>,
/// Allows containers (and parts of containers) within containers, still as a part of single packaged product
pub packaging: Option<Vec<PackagedProductDefinitionPackaging>>,
}
/// General characteristics of a packaging item.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct PackagedProductDefinitionPackagingProperty {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Option<Vec<types::Extension>>,
/// A code expressing the type of characteristic
pub r#type: types::CodeableConcept,
/// A value for the characteristic (CodeableConcept)
pub value_codeable_concept: Option<types::CodeableConcept>,
/// A value for the characteristic (Quantity)
pub value_quantity: Option<types::Quantity>,
/// A value for the characteristic (date)
pub value_date: Option<types::Date>,
/// A value for the characteristic (boolean)
pub value_boolean: Option<types::Boolean>,
/// A value for the characteristic (Attachment)
pub value_attachment: Option<types::Attachment>,
}
/// The item(s) within the packaging.
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Validate)]
#[serde(rename_all = "camelCase")]
pub struct PackagedProductDefinitionPackagingContainedItem {
/// Unique id for inter-element referencing
pub id: Option<types::String>,
/// Additional content defined by implementations
pub extension: Option<Vec<types::Extension>>,
/// Extensions that cannot be ignored even if unrecognized
pub modifier_extension: Option<Vec<types::Extension>>,
/// The actual item(s) of medication, as manufactured, or a device, or other medically related item (food, biologicals, raw materials, medical fluids, gases etc.), as contained in the package
pub item: types::CodeableReference,
/// The number of this type of item within this packaging or for continuous items such as liquids it is the quantity (for example 25ml)
pub amount: Option<types::Quantity>,
}
#[cfg(test)]
mod tests {
use super::*;
type T = PackagedProductDefinition;
#[test]
fn test_default() {
let _ = T::default();
}
#[test]
fn test_serde_round_trip() {
let value = T::default();
let json = ::serde_json::to_value(&value).expect("to_value");
let back: T = ::serde_json::from_value(json).expect("from_value");
assert_eq!(value, back);
}
}