/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.comprehendmedical.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* The collection of medical entities extracted from the input text and their associated information. For each entity, * the response provides the entity text, the entity category, where the entity text begins and ends, and the level of * confidence that Amazon Comprehend Medical has in the detection and analysis. Attributes and traits of the entity are * also returned. *

* * @see AWS * API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SNOMEDCTEntity implements Serializable, Cloneable, StructuredPojo { /** *

* The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather * than a global unique identifier. *

*/ private Integer id; /** *

* The segment of input text extracted as this entity. *

*/ private String text; /** *

* The category of the detected entity. Possible categories are MEDICAL_CONDITION, ANATOMY, or * TEST_TREATMENT_PROCEDURE. *

*/ private String category; /** *

* Describes the specific type of entity with category of entities. Possible types include DX_NAME, ACUITY, * DIRECTION, SYSTEM_ORGAN_SITE, TEST_NAME, TEST_VALUE, TEST_UNIT, PROCEDURE_NAME, or TREATMENT_NAME. *

*/ private String type; /** *

* The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected entity. *

*/ private Float score; /** *

* The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 * code point in the string. *

*/ private Integer beginOffset; /** *

* The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 * code point in the string. *

*/ private Integer endOffset; /** *

* 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. *

*/ private java.util.List attributes; /** *

* Contextual information for the entity. *

*/ private java.util.List traits; /** *

* The SNOMED concepts that the entity could refer to, along with a score indicating the likelihood of the match. *

*/ private java.util.List sNOMEDCTConcepts; /** *

* The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather * than a global unique identifier. *

* * @param id * The numeric identifier for the entity. This is a monotonically increasing id unique within this response * rather than a global unique identifier. */ public void setId(Integer id) { this.id = id; } /** *

* The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather * than a global unique identifier. *

* * @return The numeric identifier for the entity. This is a monotonically increasing id unique within this response * rather than a global unique identifier. */ public Integer getId() { return this.id; } /** *

* The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather * than a global unique identifier. *

* * @param id * The numeric identifier for the entity. This is a monotonically increasing id unique within this response * rather than a global unique identifier. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withId(Integer id) { setId(id); return this; } /** *

* The segment of input text extracted as this entity. *

* * @param text * The segment of input text extracted as this entity. */ public void setText(String text) { this.text = text; } /** *

* The segment of input text extracted as this entity. *

* * @return The segment of input text extracted as this entity. */ public String getText() { return this.text; } /** *

* The segment of input text extracted as this entity. *

* * @param text * The segment of input text extracted as this entity. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withText(String text) { setText(text); return this; } /** *

* The category of the detected entity. Possible categories are MEDICAL_CONDITION, ANATOMY, or * TEST_TREATMENT_PROCEDURE. *

* * @param category * The category of the detected entity. Possible categories are MEDICAL_CONDITION, ANATOMY, or * TEST_TREATMENT_PROCEDURE. * @see SNOMEDCTEntityCategory */ public void setCategory(String category) { this.category = category; } /** *

* The category of the detected entity. Possible categories are MEDICAL_CONDITION, ANATOMY, or * TEST_TREATMENT_PROCEDURE. *

* * @return The category of the detected entity. Possible categories are MEDICAL_CONDITION, ANATOMY, or * TEST_TREATMENT_PROCEDURE. * @see SNOMEDCTEntityCategory */ public String getCategory() { return this.category; } /** *

* The category of the detected entity. Possible categories are MEDICAL_CONDITION, ANATOMY, or * TEST_TREATMENT_PROCEDURE. *

* * @param category * The category of the detected entity. Possible categories are MEDICAL_CONDITION, ANATOMY, or * TEST_TREATMENT_PROCEDURE. * @return Returns a reference to this object so that method calls can be chained together. * @see SNOMEDCTEntityCategory */ public SNOMEDCTEntity withCategory(String category) { setCategory(category); return this; } /** *

* The category of the detected entity. Possible categories are MEDICAL_CONDITION, ANATOMY, or * TEST_TREATMENT_PROCEDURE. *

* * @param category * The category of the detected entity. Possible categories are MEDICAL_CONDITION, ANATOMY, or * TEST_TREATMENT_PROCEDURE. * @return Returns a reference to this object so that method calls can be chained together. * @see SNOMEDCTEntityCategory */ public SNOMEDCTEntity withCategory(SNOMEDCTEntityCategory category) { this.category = category.toString(); return this; } /** *

* Describes the specific type of entity with category of entities. Possible types include DX_NAME, ACUITY, * DIRECTION, SYSTEM_ORGAN_SITE, TEST_NAME, TEST_VALUE, TEST_UNIT, PROCEDURE_NAME, or TREATMENT_NAME. *

* * @param type * Describes the specific type of entity with category of entities. Possible types include DX_NAME, ACUITY, * DIRECTION, SYSTEM_ORGAN_SITE, TEST_NAME, TEST_VALUE, TEST_UNIT, PROCEDURE_NAME, or TREATMENT_NAME. * @see SNOMEDCTEntityType */ public void setType(String type) { this.type = type; } /** *

* Describes the specific type of entity with category of entities. Possible types include DX_NAME, ACUITY, * DIRECTION, SYSTEM_ORGAN_SITE, TEST_NAME, TEST_VALUE, TEST_UNIT, PROCEDURE_NAME, or TREATMENT_NAME. *

* * @return Describes the specific type of entity with category of entities. Possible types include DX_NAME, ACUITY, * DIRECTION, SYSTEM_ORGAN_SITE, TEST_NAME, TEST_VALUE, TEST_UNIT, PROCEDURE_NAME, or TREATMENT_NAME. * @see SNOMEDCTEntityType */ public String getType() { return this.type; } /** *

* Describes the specific type of entity with category of entities. Possible types include DX_NAME, ACUITY, * DIRECTION, SYSTEM_ORGAN_SITE, TEST_NAME, TEST_VALUE, TEST_UNIT, PROCEDURE_NAME, or TREATMENT_NAME. *

* * @param type * Describes the specific type of entity with category of entities. Possible types include DX_NAME, ACUITY, * DIRECTION, SYSTEM_ORGAN_SITE, TEST_NAME, TEST_VALUE, TEST_UNIT, PROCEDURE_NAME, or TREATMENT_NAME. * @return Returns a reference to this object so that method calls can be chained together. * @see SNOMEDCTEntityType */ public SNOMEDCTEntity withType(String type) { setType(type); return this; } /** *

* Describes the specific type of entity with category of entities. Possible types include DX_NAME, ACUITY, * DIRECTION, SYSTEM_ORGAN_SITE, TEST_NAME, TEST_VALUE, TEST_UNIT, PROCEDURE_NAME, or TREATMENT_NAME. *

* * @param type * Describes the specific type of entity with category of entities. Possible types include DX_NAME, ACUITY, * DIRECTION, SYSTEM_ORGAN_SITE, TEST_NAME, TEST_VALUE, TEST_UNIT, PROCEDURE_NAME, or TREATMENT_NAME. * @return Returns a reference to this object so that method calls can be chained together. * @see SNOMEDCTEntityType */ public SNOMEDCTEntity withType(SNOMEDCTEntityType type) { this.type = type.toString(); return this; } /** *

* The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected entity. *

* * @param score * The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected entity. */ public void setScore(Float score) { this.score = score; } /** *

* The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected entity. *

* * @return The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected entity. */ public Float getScore() { return this.score; } /** *

* The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected entity. *

* * @param score * The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected entity. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withScore(Float score) { setScore(score); return this; } /** *

* The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 * code point in the string. *

* * @param beginOffset * The 0-based character offset in the input text that shows where the entity begins. The offset returns the * UTF-8 code point in the string. */ public void setBeginOffset(Integer beginOffset) { this.beginOffset = beginOffset; } /** *

* The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 * code point in the string. *

* * @return The 0-based character offset in the input text that shows where the entity begins. The offset returns the * UTF-8 code point in the string. */ public Integer getBeginOffset() { return this.beginOffset; } /** *

* The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 * code point in the string. *

* * @param beginOffset * The 0-based character offset in the input text that shows where the entity begins. The offset returns the * UTF-8 code point in the string. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withBeginOffset(Integer beginOffset) { setBeginOffset(beginOffset); return this; } /** *

* The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 * code point in the string. *

* * @param endOffset * The 0-based character offset in the input text that shows where the entity ends. The offset returns the * UTF-8 code point in the string. */ public void setEndOffset(Integer endOffset) { this.endOffset = endOffset; } /** *

* The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 * code point in the string. *

* * @return The 0-based character offset in the input text that shows where the entity ends. The offset returns the * UTF-8 code point in the string. */ public Integer getEndOffset() { return this.endOffset; } /** *

* The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 * code point in the string. *

* * @param endOffset * The 0-based character offset in the input text that shows where the entity ends. The offset returns the * UTF-8 code point in the string. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withEndOffset(Integer endOffset) { setEndOffset(endOffset); return this; } /** *

* 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. *

* * @return 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. */ public java.util.List getAttributes() { return attributes; } /** *

* 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. *

* * @param attributes * 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. */ public void setAttributes(java.util.Collection attributes) { if (attributes == null) { this.attributes = null; return; } this.attributes = new java.util.ArrayList(attributes); } /** *

* 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. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setAttributes(java.util.Collection)} or {@link #withAttributes(java.util.Collection)} if you want to * override the existing values. *

* * @param attributes * 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. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withAttributes(SNOMEDCTAttribute... attributes) { if (this.attributes == null) { setAttributes(new java.util.ArrayList(attributes.length)); } for (SNOMEDCTAttribute ele : attributes) { this.attributes.add(ele); } return this; } /** *

* 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. *

* * @param attributes * 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. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withAttributes(java.util.Collection attributes) { setAttributes(attributes); return this; } /** *

* Contextual information for the entity. *

* * @return Contextual information for the entity. */ public java.util.List getTraits() { return traits; } /** *

* Contextual information for the entity. *

* * @param traits * Contextual information for the entity. */ public void setTraits(java.util.Collection traits) { if (traits == null) { this.traits = null; return; } this.traits = new java.util.ArrayList(traits); } /** *

* Contextual information for the entity. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setTraits(java.util.Collection)} or {@link #withTraits(java.util.Collection)} if you want to override the * existing values. *

* * @param traits * Contextual information for the entity. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withTraits(SNOMEDCTTrait... traits) { if (this.traits == null) { setTraits(new java.util.ArrayList(traits.length)); } for (SNOMEDCTTrait ele : traits) { this.traits.add(ele); } return this; } /** *

* Contextual information for the entity. *

* * @param traits * Contextual information for the entity. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withTraits(java.util.Collection traits) { setTraits(traits); return this; } /** *

* The SNOMED concepts that the entity could refer to, along with a score indicating the likelihood of the match. *

* * @return The SNOMED concepts that the entity could refer to, along with a score indicating the likelihood of the * match. */ public java.util.List getSNOMEDCTConcepts() { return sNOMEDCTConcepts; } /** *

* The SNOMED concepts that the entity could refer to, along with a score indicating the likelihood of the match. *

* * @param sNOMEDCTConcepts * The SNOMED concepts that the entity could refer to, along with a score indicating the likelihood of the * match. */ public void setSNOMEDCTConcepts(java.util.Collection sNOMEDCTConcepts) { if (sNOMEDCTConcepts == null) { this.sNOMEDCTConcepts = null; return; } this.sNOMEDCTConcepts = new java.util.ArrayList(sNOMEDCTConcepts); } /** *

* The SNOMED concepts that the entity could refer to, along with a score indicating the likelihood of the match. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setSNOMEDCTConcepts(java.util.Collection)} or {@link #withSNOMEDCTConcepts(java.util.Collection)} if you * want to override the existing values. *

* * @param sNOMEDCTConcepts * The SNOMED concepts that the entity could refer to, along with a score indicating the likelihood of the * match. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withSNOMEDCTConcepts(SNOMEDCTConcept... sNOMEDCTConcepts) { if (this.sNOMEDCTConcepts == null) { setSNOMEDCTConcepts(new java.util.ArrayList(sNOMEDCTConcepts.length)); } for (SNOMEDCTConcept ele : sNOMEDCTConcepts) { this.sNOMEDCTConcepts.add(ele); } return this; } /** *

* The SNOMED concepts that the entity could refer to, along with a score indicating the likelihood of the match. *

* * @param sNOMEDCTConcepts * The SNOMED concepts that the entity could refer to, along with a score indicating the likelihood of the * match. * @return Returns a reference to this object so that method calls can be chained together. */ public SNOMEDCTEntity withSNOMEDCTConcepts(java.util.Collection sNOMEDCTConcepts) { setSNOMEDCTConcepts(sNOMEDCTConcepts); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getId() != null) sb.append("Id: ").append(getId()).append(","); if (getText() != null) sb.append("Text: ").append(getText()).append(","); if (getCategory() != null) sb.append("Category: ").append(getCategory()).append(","); if (getType() != null) sb.append("Type: ").append(getType()).append(","); if (getScore() != null) sb.append("Score: ").append(getScore()).append(","); if (getBeginOffset() != null) sb.append("BeginOffset: ").append(getBeginOffset()).append(","); if (getEndOffset() != null) sb.append("EndOffset: ").append(getEndOffset()).append(","); if (getAttributes() != null) sb.append("Attributes: ").append(getAttributes()).append(","); if (getTraits() != null) sb.append("Traits: ").append(getTraits()).append(","); if (getSNOMEDCTConcepts() != null) sb.append("SNOMEDCTConcepts: ").append(getSNOMEDCTConcepts()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SNOMEDCTEntity == false) return false; SNOMEDCTEntity other = (SNOMEDCTEntity) obj; if (other.getId() == null ^ this.getId() == null) return false; if (other.getId() != null && other.getId().equals(this.getId()) == false) return false; if (other.getText() == null ^ this.getText() == null) return false; if (other.getText() != null && other.getText().equals(this.getText()) == false) return false; if (other.getCategory() == null ^ this.getCategory() == null) return false; if (other.getCategory() != null && other.getCategory().equals(this.getCategory()) == false) return false; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == false) return false; if (other.getScore() == null ^ this.getScore() == null) return false; if (other.getScore() != null && other.getScore().equals(this.getScore()) == false) return false; if (other.getBeginOffset() == null ^ this.getBeginOffset() == null) return false; if (other.getBeginOffset() != null && other.getBeginOffset().equals(this.getBeginOffset()) == false) return false; if (other.getEndOffset() == null ^ this.getEndOffset() == null) return false; if (other.getEndOffset() != null && other.getEndOffset().equals(this.getEndOffset()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; if (other.getTraits() == null ^ this.getTraits() == null) return false; if (other.getTraits() != null && other.getTraits().equals(this.getTraits()) == false) return false; if (other.getSNOMEDCTConcepts() == null ^ this.getSNOMEDCTConcepts() == null) return false; if (other.getSNOMEDCTConcepts() != null && other.getSNOMEDCTConcepts().equals(this.getSNOMEDCTConcepts()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); hashCode = prime * hashCode + ((getText() == null) ? 0 : getText().hashCode()); hashCode = prime * hashCode + ((getCategory() == null) ? 0 : getCategory().hashCode()); hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getScore() == null) ? 0 : getScore().hashCode()); hashCode = prime * hashCode + ((getBeginOffset() == null) ? 0 : getBeginOffset().hashCode()); hashCode = prime * hashCode + ((getEndOffset() == null) ? 0 : getEndOffset().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); hashCode = prime * hashCode + ((getTraits() == null) ? 0 : getTraits().hashCode()); hashCode = prime * hashCode + ((getSNOMEDCTConcepts() == null) ? 0 : getSNOMEDCTConcepts().hashCode()); return hashCode; } @Override public SNOMEDCTEntity clone() { try { return (SNOMEDCTEntity) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.comprehendmedical.model.transform.SNOMEDCTEntityMarshaller.getInstance().marshall(this, protocolMarshaller); } }