Inspects the clinical text for a variety of medical entities and returns specific information about them such as entity category, location, and confidence score on that information. Amazon Comprehend Medical only detects medical entities in English language texts.
The DetectEntitiesV2 operation replaces the DetectEntities operation. This new action uses a different model for determining the entities in your medical text and changes the way that some entities are returned in the output. You should use the DetectEntitiesV2 operation in all new applications.
The DetectEntitiesV2 operation returns the Acuity and Direction entities as attributes instead of types.
Parameters:
-
text
(BoundedLengthString)
–
A UTF-8 string containing the clinical content being examined for entities.
Raises:
-
InternalServerException
–
An internal server error occurred. Retry your request.
-
InvalidEncodingException
–
The input text was not in valid UTF-8 character encoding. Check your text then retry your request.
-
InvalidRequestException
–
The request that you made is invalid. Check your request to determine why it's invalid and then retry the request.
-
ServiceUnavailableException
–
The Amazon Comprehend Medical service is temporarily unavailable. Please wait and then retry your request.
-
TextSizeLimitExceededException
–
The size of the text you submitted exceeds the size limit. Reduce the size of the text or use a smaller document and then retry your request.
-
TooManyRequestsException
–
You have made too many requests within a short period of time. Wait for a short time and then try your request again. Contact customer support for more information about a service limit increase.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_comprehendmedical/_services/comprehend_medical.py
| def detect_entities_v2(
self,
text: "capo_comprehendmedical.types.bounded_length_string.BoundedLengthString",
*,
config_overrides: Optional[ComprehendMedicalClientConfig] = None,
) -> "capo_comprehendmedical.types.detect_entities_v2_response.DetectEntitiesV2Response":
"""<p>Inspects the clinical text for a variety of medical entities and returns specific information about them such as entity category, location, and confidence score on that information. Amazon Comprehend Medical only detects medical entities in English language texts.</p> <p>The <code>DetectEntitiesV2</code> operation replaces the <a>DetectEntities</a> operation. This new action uses a different model for determining the entities in your medical text and changes the way that some entities are returned in the output. You should use the <code>DetectEntitiesV2</code> operation in all new applications.</p> <p>The <code>DetectEntitiesV2</code> operation returns the <code>Acuity</code> and <code>Direction</code> entities as attributes instead of types. </p>
Args:
text: <p>A UTF-8 string containing the clinical content being examined for entities.</p>
Raises:
capo_comprehendmedical.errors.internal_server_exception.InternalServerException: <p> An internal server error occurred. Retry your request. </p>
capo_comprehendmedical.errors.invalid_encoding_exception.InvalidEncodingException: <p> The input text was not in valid UTF-8 character encoding. Check your text then retry your request.</p>
capo_comprehendmedical.errors.invalid_request_exception.InvalidRequestException: <p> The request that you made is invalid. Check your request to determine why it's invalid and then retry the request.</p>
capo_comprehendmedical.errors.service_unavailable_exception.ServiceUnavailableException: <p> The Amazon Comprehend Medical service is temporarily unavailable. Please wait and then retry your request. </p>
capo_comprehendmedical.errors.text_size_limit_exceeded_exception.TextSizeLimitExceededException: <p> The size of the text you submitted exceeds the size limit. Reduce the size of the text or use a smaller document and then retry your request. </p>
capo_comprehendmedical.errors.too_many_requests_exception.TooManyRequestsException: <p> You have made too many requests within a short period of time. Wait for a short time and then try your request again. Contact customer support for more information about a service limit increase. </p>
capo_comprehendmedical.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_comprehendmedical.types.detect_entities_v2_request.DetectEntitiesV2Request]",
) -> OperationResponse[
"capo_comprehendmedical.types.detect_entities_v2_response.DetectEntitiesV2Response"
]:
import capo_comprehendmedical._operations.comprehend_medical_20181030.detect_entities_v2
output, http_response = (
capo_comprehendmedical._operations.comprehend_medical_20181030.detect_entities_v2.detect_entities_v2(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DetectEntitiesV2")
)
input_: capo_comprehendmedical.types.detect_entities_v2_request.DetectEntitiesV2Request = {
"text": text
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|