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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>An extracted segment of the text that is an attribute of an entity, or otherwise related to an entity, such as the dosage of a medication taken. It contains information about the attribute such as id, begin and end offset within the input text, and the segment of the input text.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Attribute {
    /// <p>The type of attribute.</p>
    pub r#type: ::std::option::Option<crate::types::EntitySubType>,
    /// <p>The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute.</p>
    pub score: ::std::option::Option<f32>,
    /// <p>The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity.</p>
    pub relationship_score: ::std::option::Option<f32>,
    /// <p>The type of relationship between the entity and attribute. Type for the relationship is <code>OVERLAP</code>, indicating that the entity occurred at the same time as the <code>Date_Expression</code>.</p>
    pub relationship_type: ::std::option::Option<crate::types::RelationshipType>,
    /// <p>The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
    pub id: ::std::option::Option<i32>,
    /// <p>The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string.</p>
    pub begin_offset: ::std::option::Option<i32>,
    /// <p>The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string.</p>
    pub end_offset: ::std::option::Option<i32>,
    /// <p>The segment of input text extracted as this attribute.</p>
    pub text: ::std::option::Option<::std::string::String>,
    /// <p>The category of attribute.</p>
    pub category: ::std::option::Option<crate::types::EntityType>,
    /// <p>Contextual information for this attribute.</p>
    pub traits: ::std::option::Option<::std::vec::Vec<crate::types::Trait>>,
}
impl Attribute {
    /// <p>The type of attribute.</p>
    pub fn r#type(&self) -> ::std::option::Option<&crate::types::EntitySubType> {
        self.r#type.as_ref()
    }
    /// <p>The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute.</p>
    pub fn score(&self) -> ::std::option::Option<f32> {
        self.score
    }
    /// <p>The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity.</p>
    pub fn relationship_score(&self) -> ::std::option::Option<f32> {
        self.relationship_score
    }
    /// <p>The type of relationship between the entity and attribute. Type for the relationship is <code>OVERLAP</code>, indicating that the entity occurred at the same time as the <code>Date_Expression</code>.</p>
    pub fn relationship_type(&self) -> ::std::option::Option<&crate::types::RelationshipType> {
        self.relationship_type.as_ref()
    }
    /// <p>The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
    pub fn id(&self) -> ::std::option::Option<i32> {
        self.id
    }
    /// <p>The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string.</p>
    pub fn begin_offset(&self) -> ::std::option::Option<i32> {
        self.begin_offset
    }
    /// <p>The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string.</p>
    pub fn end_offset(&self) -> ::std::option::Option<i32> {
        self.end_offset
    }
    /// <p>The segment of input text extracted as this attribute.</p>
    pub fn text(&self) -> ::std::option::Option<&str> {
        self.text.as_deref()
    }
    /// <p>The category of attribute.</p>
    pub fn category(&self) -> ::std::option::Option<&crate::types::EntityType> {
        self.category.as_ref()
    }
    /// <p>Contextual information for this attribute.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.traits.is_none()`.
    pub fn traits(&self) -> &[crate::types::Trait] {
        self.traits.as_deref().unwrap_or_default()
    }
}
impl Attribute {
    /// Creates a new builder-style object to manufacture [`Attribute`](crate::types::Attribute).
    pub fn builder() -> crate::types::builders::AttributeBuilder {
        crate::types::builders::AttributeBuilder::default()
    }
}

/// A builder for [`Attribute`](crate::types::Attribute).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct AttributeBuilder {
    pub(crate) r#type: ::std::option::Option<crate::types::EntitySubType>,
    pub(crate) score: ::std::option::Option<f32>,
    pub(crate) relationship_score: ::std::option::Option<f32>,
    pub(crate) relationship_type: ::std::option::Option<crate::types::RelationshipType>,
    pub(crate) id: ::std::option::Option<i32>,
    pub(crate) begin_offset: ::std::option::Option<i32>,
    pub(crate) end_offset: ::std::option::Option<i32>,
    pub(crate) text: ::std::option::Option<::std::string::String>,
    pub(crate) category: ::std::option::Option<crate::types::EntityType>,
    pub(crate) traits: ::std::option::Option<::std::vec::Vec<crate::types::Trait>>,
}
impl AttributeBuilder {
    /// <p>The type of attribute.</p>
    pub fn r#type(mut self, input: crate::types::EntitySubType) -> Self {
        self.r#type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of attribute.</p>
    pub fn set_type(mut self, input: ::std::option::Option<crate::types::EntitySubType>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>The type of attribute.</p>
    pub fn get_type(&self) -> &::std::option::Option<crate::types::EntitySubType> {
        &self.r#type
    }
    /// <p>The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute.</p>
    pub fn score(mut self, input: f32) -> Self {
        self.score = ::std::option::Option::Some(input);
        self
    }
    /// <p>The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute.</p>
    pub fn set_score(mut self, input: ::std::option::Option<f32>) -> Self {
        self.score = input;
        self
    }
    /// <p>The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute.</p>
    pub fn get_score(&self) -> &::std::option::Option<f32> {
        &self.score
    }
    /// <p>The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity.</p>
    pub fn relationship_score(mut self, input: f32) -> Self {
        self.relationship_score = ::std::option::Option::Some(input);
        self
    }
    /// <p>The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity.</p>
    pub fn set_relationship_score(mut self, input: ::std::option::Option<f32>) -> Self {
        self.relationship_score = input;
        self
    }
    /// <p>The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity.</p>
    pub fn get_relationship_score(&self) -> &::std::option::Option<f32> {
        &self.relationship_score
    }
    /// <p>The type of relationship between the entity and attribute. Type for the relationship is <code>OVERLAP</code>, indicating that the entity occurred at the same time as the <code>Date_Expression</code>.</p>
    pub fn relationship_type(mut self, input: crate::types::RelationshipType) -> Self {
        self.relationship_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of relationship between the entity and attribute. Type for the relationship is <code>OVERLAP</code>, indicating that the entity occurred at the same time as the <code>Date_Expression</code>.</p>
    pub fn set_relationship_type(mut self, input: ::std::option::Option<crate::types::RelationshipType>) -> Self {
        self.relationship_type = input;
        self
    }
    /// <p>The type of relationship between the entity and attribute. Type for the relationship is <code>OVERLAP</code>, indicating that the entity occurred at the same time as the <code>Date_Expression</code>.</p>
    pub fn get_relationship_type(&self) -> &::std::option::Option<crate::types::RelationshipType> {
        &self.relationship_type
    }
    /// <p>The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
    pub fn id(mut self, input: i32) -> Self {
        self.id = ::std::option::Option::Some(input);
        self
    }
    /// <p>The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
    pub fn set_id(mut self, input: ::std::option::Option<i32>) -> Self {
        self.id = input;
        self
    }
    /// <p>The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
    pub fn get_id(&self) -> &::std::option::Option<i32> {
        &self.id
    }
    /// <p>The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string.</p>
    pub fn begin_offset(mut self, input: i32) -> Self {
        self.begin_offset = ::std::option::Option::Some(input);
        self
    }
    /// <p>The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string.</p>
    pub fn set_begin_offset(mut self, input: ::std::option::Option<i32>) -> Self {
        self.begin_offset = input;
        self
    }
    /// <p>The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string.</p>
    pub fn get_begin_offset(&self) -> &::std::option::Option<i32> {
        &self.begin_offset
    }
    /// <p>The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string.</p>
    pub fn end_offset(mut self, input: i32) -> Self {
        self.end_offset = ::std::option::Option::Some(input);
        self
    }
    /// <p>The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string.</p>
    pub fn set_end_offset(mut self, input: ::std::option::Option<i32>) -> Self {
        self.end_offset = input;
        self
    }
    /// <p>The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string.</p>
    pub fn get_end_offset(&self) -> &::std::option::Option<i32> {
        &self.end_offset
    }
    /// <p>The segment of input text extracted as this attribute.</p>
    pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.text = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The segment of input text extracted as this attribute.</p>
    pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.text = input;
        self
    }
    /// <p>The segment of input text extracted as this attribute.</p>
    pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
        &self.text
    }
    /// <p>The category of attribute.</p>
    pub fn category(mut self, input: crate::types::EntityType) -> Self {
        self.category = ::std::option::Option::Some(input);
        self
    }
    /// <p>The category of attribute.</p>
    pub fn set_category(mut self, input: ::std::option::Option<crate::types::EntityType>) -> Self {
        self.category = input;
        self
    }
    /// <p>The category of attribute.</p>
    pub fn get_category(&self) -> &::std::option::Option<crate::types::EntityType> {
        &self.category
    }
    /// Appends an item to `traits`.
    ///
    /// To override the contents of this collection use [`set_traits`](Self::set_traits).
    ///
    /// <p>Contextual information for this attribute.</p>
    pub fn traits(mut self, input: crate::types::Trait) -> Self {
        let mut v = self.traits.unwrap_or_default();
        v.push(input);
        self.traits = ::std::option::Option::Some(v);
        self
    }
    /// <p>Contextual information for this attribute.</p>
    pub fn set_traits(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Trait>>) -> Self {
        self.traits = input;
        self
    }
    /// <p>Contextual information for this attribute.</p>
    pub fn get_traits(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Trait>> {
        &self.traits
    }
    /// Consumes the builder and constructs a [`Attribute`](crate::types::Attribute).
    pub fn build(self) -> crate::types::Attribute {
        crate::types::Attribute {
            r#type: self.r#type,
            score: self.score,
            relationship_score: self.relationship_score,
            relationship_type: self.relationship_type,
            id: self.id,
            begin_offset: self.begin_offset,
            end_offset: self.end_offset,
            text: self.text,
            category: self.category,
            traits: self.traits,
        }
    }
}