1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package comprehendmedical 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/comprehendmedical/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Inspects the clinical text for a variety of medical entities and returns 15// specific information about them such as entity category, location, and 16// confidence score on that information. Amazon Comprehend Medical only detects 17// medical entities in English language texts. The DetectEntitiesV2 operation 18// replaces the DetectEntities operation. This new action uses a different model 19// for determining the entities in your medical text and changes the way that some 20// entities are returned in the output. You should use the DetectEntitiesV2 21// operation in all new applications. The DetectEntitiesV2 operation returns the 22// Acuity and Direction entities as attributes instead of types. 23func (c *Client) DetectEntitiesV2(ctx context.Context, params *DetectEntitiesV2Input, optFns ...func(*Options)) (*DetectEntitiesV2Output, error) { 24 if params == nil { 25 params = &DetectEntitiesV2Input{} 26 } 27 28 result, metadata, err := c.invokeOperation(ctx, "DetectEntitiesV2", params, optFns, addOperationDetectEntitiesV2Middlewares) 29 if err != nil { 30 return nil, err 31 } 32 33 out := result.(*DetectEntitiesV2Output) 34 out.ResultMetadata = metadata 35 return out, nil 36} 37 38type DetectEntitiesV2Input struct { 39 40 // A UTF-8 string containing the clinical content being examined for entities. Each 41 // string must contain fewer than 20,000 bytes of characters. 42 // 43 // This member is required. 44 Text *string 45} 46 47type DetectEntitiesV2Output struct { 48 49 // The collection of medical entities extracted from the input text and their 50 // associated information. For each entity, the response provides the entity text, 51 // the entity category, where the entity text begins and ends, and the level of 52 // confidence in the detection and analysis. Attributes and traits of the entity 53 // are also returned. 54 // 55 // This member is required. 56 Entities []types.Entity 57 58 // The version of the model used to analyze the documents. The version number looks 59 // like X.X.X. You can use this information to track the model used for a 60 // particular batch of documents. 61 // 62 // This member is required. 63 ModelVersion *string 64 65 // If the result to the DetectEntitiesV2 operation was truncated, include the 66 // PaginationToken to fetch the next page of entities. 67 PaginationToken *string 68 69 // Attributes extracted from the input text that couldn't be related to an entity. 70 UnmappedAttributes []types.UnmappedAttribute 71 72 // Metadata pertaining to the operation's result. 73 ResultMetadata middleware.Metadata 74} 75 76func addOperationDetectEntitiesV2Middlewares(stack *middleware.Stack, options Options) (err error) { 77 err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectEntitiesV2{}, middleware.After) 78 if err != nil { 79 return err 80 } 81 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectEntitiesV2{}, middleware.After) 82 if err != nil { 83 return err 84 } 85 if err = addSetLoggerMiddleware(stack, options); err != nil { 86 return err 87 } 88 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 89 return err 90 } 91 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 92 return err 93 } 94 if err = addResolveEndpointMiddleware(stack, options); err != nil { 95 return err 96 } 97 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 98 return err 99 } 100 if err = addRetryMiddlewares(stack, options); err != nil { 101 return err 102 } 103 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 104 return err 105 } 106 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 107 return err 108 } 109 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 110 return err 111 } 112 if err = addClientUserAgent(stack); err != nil { 113 return err 114 } 115 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 116 return err 117 } 118 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 119 return err 120 } 121 if err = addOpDetectEntitiesV2ValidationMiddleware(stack); err != nil { 122 return err 123 } 124 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectEntitiesV2(options.Region), middleware.Before); err != nil { 125 return err 126 } 127 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 128 return err 129 } 130 if err = addResponseErrorMiddleware(stack); err != nil { 131 return err 132 } 133 if err = addRequestResponseLogging(stack, options); err != nil { 134 return err 135 } 136 return nil 137} 138 139func newServiceMetadataMiddleware_opDetectEntitiesV2(region string) *awsmiddleware.RegisterServiceMetadata { 140 return &awsmiddleware.RegisterServiceMetadata{ 141 Region: region, 142 ServiceID: ServiceID, 143 SigningName: "comprehendmedical", 144 OperationName: "DetectEntitiesV2", 145 } 146} 147