import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectInt32 as __expectInt32 , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectString as __expectString , limitedParseFloat32 as __limitedParseFloat32 , parseEpochTimestamp as __parseEpochTimestamp , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , HeaderBag as __HeaderBag , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { v4 as generateIdempotencyToken } from "uuid" ; import { DescribeEntitiesDetectionV2JobCommandInput , DescribeEntitiesDetectionV2JobCommandOutput , } from "../commands/DescribeEntitiesDetectionV2JobCommand" ; import { DescribeICD10CMInferenceJobCommandInput , DescribeICD10CMInferenceJobCommandOutput , } from "../commands/DescribeICD10CMInferenceJobCommand" ; import { DescribePHIDetectionJobCommandInput , DescribePHIDetectionJobCommandOutput , } from "../commands/DescribePHIDetectionJobCommand" ; import { DescribeRxNormInferenceJobCommandInput , DescribeRxNormInferenceJobCommandOutput , } from "../commands/DescribeRxNormInferenceJobCommand" ; import { DescribeSNOMEDCTInferenceJobCommandInput , DescribeSNOMEDCTInferenceJobCommandOutput , } from "../commands/DescribeSNOMEDCTInferenceJobCommand" ; import { DetectEntitiesCommandInput , DetectEntitiesCommandOutput } from "../commands/DetectEntitiesCommand" ; import { DetectEntitiesV2CommandInput , DetectEntitiesV2CommandOutput } from "../commands/DetectEntitiesV2Command" ; import { DetectPHICommandInput , DetectPHICommandOutput } from "../commands/DetectPHICommand" ; import { InferICD10CMCommandInput , InferICD10CMCommandOutput } from "../commands/InferICD10CMCommand" ; import { InferRxNormCommandInput , InferRxNormCommandOutput } from "../commands/InferRxNormCommand" ; import { InferSNOMEDCTCommandInput , InferSNOMEDCTCommandOutput } from "../commands/InferSNOMEDCTCommand" ; import { ListEntitiesDetectionV2JobsCommandInput , ListEntitiesDetectionV2JobsCommandOutput , } from "../commands/ListEntitiesDetectionV2JobsCommand" ; import { ListICD10CMInferenceJobsCommandInput , ListICD10CMInferenceJobsCommandOutput , } from "../commands/ListICD10CMInferenceJobsCommand" ; import { ListPHIDetectionJobsCommandInput , ListPHIDetectionJobsCommandOutput , } from "../commands/ListPHIDetectionJobsCommand" ; import { ListRxNormInferenceJobsCommandInput , ListRxNormInferenceJobsCommandOutput , } from "../commands/ListRxNormInferenceJobsCommand" ; import { ListSNOMEDCTInferenceJobsCommandInput , ListSNOMEDCTInferenceJobsCommandOutput , } from "../commands/ListSNOMEDCTInferenceJobsCommand" ; import { StartEntitiesDetectionV2JobCommandInput , StartEntitiesDetectionV2JobCommandOutput , } from "../commands/StartEntitiesDetectionV2JobCommand" ; import { StartICD10CMInferenceJobCommandInput , StartICD10CMInferenceJobCommandOutput , } from "../commands/StartICD10CMInferenceJobCommand" ; import { StartPHIDetectionJobCommandInput , StartPHIDetectionJobCommandOutput , } from "../commands/StartPHIDetectionJobCommand" ; import { StartRxNormInferenceJobCommandInput , StartRxNormInferenceJobCommandOutput , } from "../commands/StartRxNormInferenceJobCommand" ; import { StartSNOMEDCTInferenceJobCommandInput , StartSNOMEDCTInferenceJobCommandOutput , } from "../commands/StartSNOMEDCTInferenceJobCommand" ; import { StopEntitiesDetectionV2JobCommandInput , StopEntitiesDetectionV2JobCommandOutput , } from "../commands/StopEntitiesDetectionV2JobCommand" ; import { StopICD10CMInferenceJobCommandInput , StopICD10CMInferenceJobCommandOutput , } from "../commands/StopICD10CMInferenceJobCommand" ; import { StopPHIDetectionJobCommandInput , StopPHIDetectionJobCommandOutput , } from "../commands/StopPHIDetectionJobCommand" ; import { StopRxNormInferenceJobCommandInput , StopRxNormInferenceJobCommandOutput , } from "../commands/StopRxNormInferenceJobCommand" ; import { StopSNOMEDCTInferenceJobCommandInput , StopSNOMEDCTInferenceJobCommandOutput , } from "../commands/StopSNOMEDCTInferenceJobCommand" ; import { Attribute , Characters , ComprehendMedicalAsyncJobFilter , ComprehendMedicalAsyncJobProperties , DescribeEntitiesDetectionV2JobRequest , DescribeEntitiesDetectionV2JobResponse , DescribeICD10CMInferenceJobRequest , DescribeICD10CMInferenceJobResponse , DescribePHIDetectionJobRequest , DescribePHIDetectionJobResponse , DescribeRxNormInferenceJobRequest , DescribeRxNormInferenceJobResponse , DescribeSNOMEDCTInferenceJobRequest , DescribeSNOMEDCTInferenceJobResponse , DetectEntitiesRequest , DetectEntitiesResponse , DetectEntitiesV2Request , DetectEntitiesV2Response , DetectPHIRequest , DetectPHIResponse , Entity , ICD10CMAttribute , ICD10CMConcept , ICD10CMEntity , ICD10CMTrait , InferICD10CMRequest , InferICD10CMResponse , InferRxNormRequest , InferRxNormResponse , InferSNOMEDCTRequest , InferSNOMEDCTResponse , InputDataConfig , InternalServerException , InvalidEncodingException , InvalidRequestException , ListEntitiesDetectionV2JobsRequest , ListEntitiesDetectionV2JobsResponse , ListICD10CMInferenceJobsRequest , ListICD10CMInferenceJobsResponse , ListPHIDetectionJobsRequest , ListPHIDetectionJobsResponse , ListRxNormInferenceJobsRequest , ListRxNormInferenceJobsResponse , ListSNOMEDCTInferenceJobsRequest , ListSNOMEDCTInferenceJobsResponse , OutputDataConfig , ResourceNotFoundException , RxNormAttribute , RxNormConcept , RxNormEntity , RxNormTrait , ServiceUnavailableException , SNOMEDCTAttribute , SNOMEDCTConcept , SNOMEDCTDetails , SNOMEDCTEntity , SNOMEDCTTrait , StartEntitiesDetectionV2JobRequest , StartEntitiesDetectionV2JobResponse , StartICD10CMInferenceJobRequest , StartICD10CMInferenceJobResponse , StartPHIDetectionJobRequest , StartPHIDetectionJobResponse , StartRxNormInferenceJobRequest , StartRxNormInferenceJobResponse , StartSNOMEDCTInferenceJobRequest , StartSNOMEDCTInferenceJobResponse , StopEntitiesDetectionV2JobRequest , StopEntitiesDetectionV2JobResponse , StopICD10CMInferenceJobRequest , StopICD10CMInferenceJobResponse , StopPHIDetectionJobRequest , StopPHIDetectionJobResponse , StopRxNormInferenceJobRequest , StopRxNormInferenceJobResponse , StopSNOMEDCTInferenceJobRequest , StopSNOMEDCTInferenceJobResponse , TextSizeLimitExceededException , TooManyRequestsException , Trait , UnmappedAttribute , ValidationException , } from "../models/models_0" ; export const serializeAws_json1_1DescribeEntitiesDetectionV2JobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.DescribeEntitiesDetectionV2Job" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeEntitiesDetectionV2JobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeICD10CMInferenceJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.DescribeICD10CMInferenceJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeICD10CMInferenceJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribePHIDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.DescribePHIDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribePHIDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeRxNormInferenceJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.DescribeRxNormInferenceJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeRxNormInferenceJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeSNOMEDCTInferenceJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.DescribeSNOMEDCTInferenceJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeSNOMEDCTInferenceJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetectEntitiesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.DetectEntities" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetectEntitiesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetectEntitiesV2Command = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.DetectEntitiesV2" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetectEntitiesV2Request ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DetectPHICommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.DetectPHI" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DetectPHIRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1InferICD10CMCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.InferICD10CM" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1InferICD10CMRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1InferRxNormCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.InferRxNorm" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1InferRxNormRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1InferSNOMEDCTCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.InferSNOMEDCT" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1InferSNOMEDCTRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListEntitiesDetectionV2JobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.ListEntitiesDetectionV2Jobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListEntitiesDetectionV2JobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListICD10CMInferenceJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.ListICD10CMInferenceJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListICD10CMInferenceJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListPHIDetectionJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.ListPHIDetectionJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListPHIDetectionJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListRxNormInferenceJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.ListRxNormInferenceJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListRxNormInferenceJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListSNOMEDCTInferenceJobsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.ListSNOMEDCTInferenceJobs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListSNOMEDCTInferenceJobsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartEntitiesDetectionV2JobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StartEntitiesDetectionV2Job" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartEntitiesDetectionV2JobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartICD10CMInferenceJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StartICD10CMInferenceJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartICD10CMInferenceJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartPHIDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StartPHIDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartPHIDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartRxNormInferenceJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StartRxNormInferenceJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartRxNormInferenceJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StartSNOMEDCTInferenceJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StartSNOMEDCTInferenceJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StartSNOMEDCTInferenceJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopEntitiesDetectionV2JobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StopEntitiesDetectionV2Job" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopEntitiesDetectionV2JobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopICD10CMInferenceJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StopICD10CMInferenceJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopICD10CMInferenceJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopPHIDetectionJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StopPHIDetectionJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopPHIDetectionJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopRxNormInferenceJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StopRxNormInferenceJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopRxNormInferenceJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1StopSNOMEDCTInferenceJobCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "ComprehendMedical_20181030.StopSNOMEDCTInferenceJob" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1StopSNOMEDCTInferenceJobRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const deserializeAws_json1_1DescribeEntitiesDetectionV2JobCommand = async ( output , context ) : Promise < DescribeEntitiesDetectionV2JobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeEntitiesDetectionV2JobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeEntitiesDetectionV2JobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeEntitiesDetectionV2JobCommandError = async ( output , context ) : Promise < DescribeEntitiesDetectionV2JobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeICD10CMInferenceJobCommand = async ( output , context ) : Promise < DescribeICD10CMInferenceJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeICD10CMInferenceJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeICD10CMInferenceJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeICD10CMInferenceJobCommandError = async ( output , context ) : Promise < DescribeICD10CMInferenceJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribePHIDetectionJobCommand = async ( output , context ) : Promise < DescribePHIDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribePHIDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribePHIDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribePHIDetectionJobCommandError = async ( output , context ) : Promise < DescribePHIDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeRxNormInferenceJobCommand = async ( output , context ) : Promise < DescribeRxNormInferenceJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeRxNormInferenceJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeRxNormInferenceJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeRxNormInferenceJobCommandError = async ( output , context ) : Promise < DescribeRxNormInferenceJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DescribeSNOMEDCTInferenceJobCommand = async ( output , context ) : Promise < DescribeSNOMEDCTInferenceJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeSNOMEDCTInferenceJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeSNOMEDCTInferenceJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeSNOMEDCTInferenceJobCommandError = async ( output , context ) : Promise < DescribeSNOMEDCTInferenceJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DetectEntitiesCommand = async ( output , context ) : Promise < DetectEntitiesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetectEntitiesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DetectEntitiesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetectEntitiesCommandError = async ( output , context ) : Promise < DetectEntitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidEncodingException" : case "com.amazonaws.comprehendmedical#InvalidEncodingException" : response = { ... ( await deserializeAws_json1_1InvalidEncodingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.comprehendmedical#ServiceUnavailableException" : response = { ... ( await deserializeAws_json1_1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehendmedical#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DetectEntitiesV2Command = async ( output , context ) : Promise < DetectEntitiesV2CommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetectEntitiesV2CommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DetectEntitiesV2Response ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetectEntitiesV2CommandError = async ( output , context ) : Promise < DetectEntitiesV2CommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidEncodingException" : case "com.amazonaws.comprehendmedical#InvalidEncodingException" : response = { ... ( await deserializeAws_json1_1InvalidEncodingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.comprehendmedical#ServiceUnavailableException" : response = { ... ( await deserializeAws_json1_1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehendmedical#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1DetectPHICommand = async ( output , context ) : Promise < DetectPHICommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DetectPHICommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DetectPHIResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DetectPHICommandError = async ( output , context ) : Promise < DetectPHICommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidEncodingException" : case "com.amazonaws.comprehendmedical#InvalidEncodingException" : response = { ... ( await deserializeAws_json1_1InvalidEncodingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.comprehendmedical#ServiceUnavailableException" : response = { ... ( await deserializeAws_json1_1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehendmedical#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1InferICD10CMCommand = async ( output , context ) : Promise < InferICD10CMCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1InferICD10CMCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1InferICD10CMResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1InferICD10CMCommandError = async ( output , context ) : Promise < InferICD10CMCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidEncodingException" : case "com.amazonaws.comprehendmedical#InvalidEncodingException" : response = { ... ( await deserializeAws_json1_1InvalidEncodingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.comprehendmedical#ServiceUnavailableException" : response = { ... ( await deserializeAws_json1_1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehendmedical#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1InferRxNormCommand = async ( output , context ) : Promise < InferRxNormCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1InferRxNormCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1InferRxNormResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1InferRxNormCommandError = async ( output , context ) : Promise < InferRxNormCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidEncodingException" : case "com.amazonaws.comprehendmedical#InvalidEncodingException" : response = { ... ( await deserializeAws_json1_1InvalidEncodingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.comprehendmedical#ServiceUnavailableException" : response = { ... ( await deserializeAws_json1_1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehendmedical#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1InferSNOMEDCTCommand = async ( output , context ) : Promise < InferSNOMEDCTCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1InferSNOMEDCTCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1InferSNOMEDCTResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1InferSNOMEDCTCommandError = async ( output , context ) : Promise < InferSNOMEDCTCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidEncodingException" : case "com.amazonaws.comprehendmedical#InvalidEncodingException" : response = { ... ( await deserializeAws_json1_1InvalidEncodingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.comprehendmedical#ServiceUnavailableException" : response = { ... ( await deserializeAws_json1_1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TextSizeLimitExceededException" : case "com.amazonaws.comprehendmedical#TextSizeLimitExceededException" : response = { ... ( await deserializeAws_json1_1TextSizeLimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListEntitiesDetectionV2JobsCommand = async ( output , context ) : Promise < ListEntitiesDetectionV2JobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListEntitiesDetectionV2JobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListEntitiesDetectionV2JobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListEntitiesDetectionV2JobsCommandError = async ( output , context ) : Promise < ListEntitiesDetectionV2JobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.comprehendmedical#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListICD10CMInferenceJobsCommand = async ( output , context ) : Promise < ListICD10CMInferenceJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListICD10CMInferenceJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListICD10CMInferenceJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListICD10CMInferenceJobsCommandError = async ( output , context ) : Promise < ListICD10CMInferenceJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.comprehendmedical#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListPHIDetectionJobsCommand = async ( output , context ) : Promise < ListPHIDetectionJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListPHIDetectionJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListPHIDetectionJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListPHIDetectionJobsCommandError = async ( output , context ) : Promise < ListPHIDetectionJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.comprehendmedical#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListRxNormInferenceJobsCommand = async ( output , context ) : Promise < ListRxNormInferenceJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListRxNormInferenceJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListRxNormInferenceJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListRxNormInferenceJobsCommandError = async ( output , context ) : Promise < ListRxNormInferenceJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.comprehendmedical#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1ListSNOMEDCTInferenceJobsCommand = async ( output , context ) : Promise < ListSNOMEDCTInferenceJobsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListSNOMEDCTInferenceJobsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListSNOMEDCTInferenceJobsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListSNOMEDCTInferenceJobsCommandError = async ( output , context ) : Promise < ListSNOMEDCTInferenceJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.comprehendmedical#ValidationException" : response = { ... ( await deserializeAws_json1_1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StartEntitiesDetectionV2JobCommand = async ( output , context ) : Promise < StartEntitiesDetectionV2JobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartEntitiesDetectionV2JobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartEntitiesDetectionV2JobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartEntitiesDetectionV2JobCommandError = async ( output , context ) : Promise < StartEntitiesDetectionV2JobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StartICD10CMInferenceJobCommand = async ( output , context ) : Promise < StartICD10CMInferenceJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartICD10CMInferenceJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartICD10CMInferenceJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartICD10CMInferenceJobCommandError = async ( output , context ) : Promise < StartICD10CMInferenceJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StartPHIDetectionJobCommand = async ( output , context ) : Promise < StartPHIDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartPHIDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartPHIDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartPHIDetectionJobCommandError = async ( output , context ) : Promise < StartPHIDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StartRxNormInferenceJobCommand = async ( output , context ) : Promise < StartRxNormInferenceJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartRxNormInferenceJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartRxNormInferenceJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartRxNormInferenceJobCommandError = async ( output , context ) : Promise < StartRxNormInferenceJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StartSNOMEDCTInferenceJobCommand = async ( output , context ) : Promise < StartSNOMEDCTInferenceJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StartSNOMEDCTInferenceJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StartSNOMEDCTInferenceJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StartSNOMEDCTInferenceJobCommandError = async ( output , context ) : Promise < StartSNOMEDCTInferenceJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StopEntitiesDetectionV2JobCommand = async ( output , context ) : Promise < StopEntitiesDetectionV2JobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopEntitiesDetectionV2JobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopEntitiesDetectionV2JobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopEntitiesDetectionV2JobCommandError = async ( output , context ) : Promise < StopEntitiesDetectionV2JobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StopICD10CMInferenceJobCommand = async ( output , context ) : Promise < StopICD10CMInferenceJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopICD10CMInferenceJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopICD10CMInferenceJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopICD10CMInferenceJobCommandError = async ( output , context ) : Promise < StopICD10CMInferenceJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StopPHIDetectionJobCommand = async ( output , context ) : Promise < StopPHIDetectionJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopPHIDetectionJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopPHIDetectionJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopPHIDetectionJobCommandError = async ( output , context ) : Promise < StopPHIDetectionJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StopRxNormInferenceJobCommand = async ( output , context ) : Promise < StopRxNormInferenceJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopRxNormInferenceJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopRxNormInferenceJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopRxNormInferenceJobCommandError = async ( output , context ) : Promise < StopRxNormInferenceJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_json1_1StopSNOMEDCTInferenceJobCommand = async ( output , context ) : Promise < StopSNOMEDCTInferenceJobCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1StopSNOMEDCTInferenceJobCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1StopSNOMEDCTInferenceJobResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1StopSNOMEDCTInferenceJobCommandError = async ( output , context ) : Promise < StopSNOMEDCTInferenceJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.comprehendmedical#InternalServerException" : response = { ... ( await deserializeAws_json1_1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.comprehendmedical#InvalidRequestException" : response = { ... ( await deserializeAws_json1_1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.comprehendmedical#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.comprehendmedical#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_json1_1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InternalServerException ( body , context ) ; const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidEncodingExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidEncodingException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidEncodingException ( body , context ) ; const contents = { name : "InvalidEncodingException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidRequestExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidRequestException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidRequestException ( body , context ) ; const contents = { name : "InvalidRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ResourceNotFoundException ( body , context ) ; const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ServiceUnavailableExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceUnavailableException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ServiceUnavailableException ( body , context ) ; const contents = { name : "ServiceUnavailableException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TextSizeLimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < TextSizeLimitExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TextSizeLimitExceededException ( body , context ) ; const contents = { name : "TextSizeLimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TooManyRequestsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyRequestsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TooManyRequestsException ( body , context ) ; const contents = { name : "TooManyRequestsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ValidationException ( body , context ) ; const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const serializeAws_json1_1ComprehendMedicalAsyncJobFilter = ( input , context ) : any => { return { ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . JobStatus !== undefined && input . JobStatus !== null && { JobStatus : input . JobStatus } ) , ... ( input . SubmitTimeAfter !== undefined && input . SubmitTimeAfter !== null && { SubmitTimeAfter : Math . round ( input . SubmitTimeAfter . getTime ( ) / 1000 ) } ) , ... ( input . SubmitTimeBefore !== undefined && input . SubmitTimeBefore !== null && { SubmitTimeBefore : Math . round ( input . SubmitTimeBefore . getTime ( ) / 1000 ) } ) , } ; } ; const serializeAws_json1_1DescribeEntitiesDetectionV2JobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribeICD10CMInferenceJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribePHIDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribeRxNormInferenceJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DescribeSNOMEDCTInferenceJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1DetectEntitiesRequest = ( input , context ) : any => { return { ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1DetectEntitiesV2Request = ( input , context ) : any => { return { ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1DetectPHIRequest = ( input , context ) : any => { return { ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1InferICD10CMRequest = ( input , context ) : any => { return { ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1InferRxNormRequest = ( input , context ) : any => { return { ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1InferSNOMEDCTRequest = ( input , context ) : any => { return { ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ; } ; const serializeAws_json1_1InputDataConfig = ( input , context ) : any => { return { ... ( input . S3Bucket !== undefined && input . S3Bucket !== null && { S3Bucket : input . S3Bucket } ) , ... ( input . S3Key !== undefined && input . S3Key !== null && { S3Key : input . S3Key } ) , } ; } ; const serializeAws_json1_1ListEntitiesDetectionV2JobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1ComprehendMedicalAsyncJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListICD10CMInferenceJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1ComprehendMedicalAsyncJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListPHIDetectionJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1ComprehendMedicalAsyncJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListRxNormInferenceJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1ComprehendMedicalAsyncJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListSNOMEDCTInferenceJobsRequest = ( input , context ) : any => { return { ... ( input . Filter !== undefined && input . Filter !== null && { Filter : serializeAws_json1_1ComprehendMedicalAsyncJobFilter ( input . Filter , context ) } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1OutputDataConfig = ( input , context ) : any => { return { ... ( input . S3Bucket !== undefined && input . S3Bucket !== null && { S3Bucket : input . S3Bucket } ) , ... ( input . S3Key !== undefined && input . S3Key !== null && { S3Key : input . S3Key } ) , } ; } ; const serializeAws_json1_1StartEntitiesDetectionV2JobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . KMSKey !== undefined && input . KMSKey !== null && { KMSKey : input . KMSKey } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , } ; } ; const serializeAws_json1_1StartICD10CMInferenceJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . KMSKey !== undefined && input . KMSKey !== null && { KMSKey : input . KMSKey } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , } ; } ; const serializeAws_json1_1StartPHIDetectionJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . KMSKey !== undefined && input . KMSKey !== null && { KMSKey : input . KMSKey } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , } ; } ; const serializeAws_json1_1StartRxNormInferenceJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . KMSKey !== undefined && input . KMSKey !== null && { KMSKey : input . KMSKey } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , } ; } ; const serializeAws_json1_1StartSNOMEDCTInferenceJobRequest = ( input , context ) : any => { return { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . DataAccessRoleArn !== undefined && input . DataAccessRoleArn !== null && { DataAccessRoleArn : input . DataAccessRoleArn } ) , ... ( input . InputDataConfig !== undefined && input . InputDataConfig !== null && { InputDataConfig : serializeAws_json1_1InputDataConfig ( input . InputDataConfig , context ) , } ) , ... ( input . JobName !== undefined && input . JobName !== null && { JobName : input . JobName } ) , ... ( input . KMSKey !== undefined && input . KMSKey !== null && { KMSKey : input . KMSKey } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OutputDataConfig !== undefined && input . OutputDataConfig !== null && { OutputDataConfig : serializeAws_json1_1OutputDataConfig ( input . OutputDataConfig , context ) , } ) , } ; } ; const serializeAws_json1_1StopEntitiesDetectionV2JobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopICD10CMInferenceJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopPHIDetectionJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopRxNormInferenceJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const serializeAws_json1_1StopSNOMEDCTInferenceJobRequest = ( input , context ) : any => { return { ... ( input . JobId !== undefined && input . JobId !== null && { JobId : input . JobId } ) , } ; } ; const deserializeAws_json1_1Attribute = ( output , context ) : Attribute => { return { BeginOffset : __expectInt32 ( output . BeginOffset ) , Category : __expectString ( output . Category ) , EndOffset : __expectInt32 ( output . EndOffset ) , Id : __expectInt32 ( output . Id ) , RelationshipScore : __limitedParseFloat32 ( output . RelationshipScore ) , RelationshipType : __expectString ( output . RelationshipType ) , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , Traits : output . Traits !== undefined && output . Traits !== null ? deserializeAws_json1_1TraitList ( output . Traits , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1AttributeList = ( output , context ) : Attribute [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Attribute ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Characters = ( output , context ) : Characters => { return { OriginalTextCharacters : __expectInt32 ( output . OriginalTextCharacters ) , } as any ; } ; const deserializeAws_json1_1ComprehendMedicalAsyncJobProperties = ( output , context ) : ComprehendMedicalAsyncJobProperties => { return { DataAccessRoleArn : __expectString ( output . DataAccessRoleArn ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . EndTime ) ) ) : undefined , ExpirationTime : output . ExpirationTime !== undefined && output . ExpirationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . ExpirationTime ) ) ) : undefined , InputDataConfig : output . InputDataConfig !== undefined && output . InputDataConfig !== null ? deserializeAws_json1_1InputDataConfig ( output . InputDataConfig , context ) : undefined , JobId : __expectString ( output . JobId ) , JobName : __expectString ( output . JobName ) , JobStatus : __expectString ( output . JobStatus ) , KMSKey : __expectString ( output . KMSKey ) , LanguageCode : __expectString ( output . LanguageCode ) , ManifestFilePath : __expectString ( output . ManifestFilePath ) , Message : __expectString ( output . Message ) , ModelVersion : __expectString ( output . ModelVersion ) , OutputDataConfig : output . OutputDataConfig !== undefined && output . OutputDataConfig !== null ? deserializeAws_json1_1OutputDataConfig ( output . OutputDataConfig , context ) : undefined , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , } as any ; } ; const deserializeAws_json1_1ComprehendMedicalAsyncJobPropertiesList = ( output , context ) : ComprehendMedicalAsyncJobProperties [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ComprehendMedicalAsyncJobProperties ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1DescribeEntitiesDetectionV2JobResponse = ( output , context ) : DescribeEntitiesDetectionV2JobResponse => { return { ComprehendMedicalAsyncJobProperties : output . ComprehendMedicalAsyncJobProperties !== undefined && output . ComprehendMedicalAsyncJobProperties !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobProperties ( output . ComprehendMedicalAsyncJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeICD10CMInferenceJobResponse = ( output , context ) : DescribeICD10CMInferenceJobResponse => { return { ComprehendMedicalAsyncJobProperties : output . ComprehendMedicalAsyncJobProperties !== undefined && output . ComprehendMedicalAsyncJobProperties !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobProperties ( output . ComprehendMedicalAsyncJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribePHIDetectionJobResponse = ( output , context ) : DescribePHIDetectionJobResponse => { return { ComprehendMedicalAsyncJobProperties : output . ComprehendMedicalAsyncJobProperties !== undefined && output . ComprehendMedicalAsyncJobProperties !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobProperties ( output . ComprehendMedicalAsyncJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeRxNormInferenceJobResponse = ( output , context ) : DescribeRxNormInferenceJobResponse => { return { ComprehendMedicalAsyncJobProperties : output . ComprehendMedicalAsyncJobProperties !== undefined && output . ComprehendMedicalAsyncJobProperties !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobProperties ( output . ComprehendMedicalAsyncJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeSNOMEDCTInferenceJobResponse = ( output , context ) : DescribeSNOMEDCTInferenceJobResponse => { return { ComprehendMedicalAsyncJobProperties : output . ComprehendMedicalAsyncJobProperties !== undefined && output . ComprehendMedicalAsyncJobProperties !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobProperties ( output . ComprehendMedicalAsyncJobProperties , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DetectEntitiesResponse = ( output , context ) : DetectEntitiesResponse => { return { Entities : output . Entities !== undefined && output . Entities !== null ? deserializeAws_json1_1EntityList ( output . Entities , context ) : undefined , ModelVersion : __expectString ( output . ModelVersion ) , PaginationToken : __expectString ( output . PaginationToken ) , UnmappedAttributes : output . UnmappedAttributes !== undefined && output . UnmappedAttributes !== null ? deserializeAws_json1_1UnmappedAttributeList ( output . UnmappedAttributes , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DetectEntitiesV2Response = ( output , context ) : DetectEntitiesV2Response => { return { Entities : output . Entities !== undefined && output . Entities !== null ? deserializeAws_json1_1EntityList ( output . Entities , context ) : undefined , ModelVersion : __expectString ( output . ModelVersion ) , PaginationToken : __expectString ( output . PaginationToken ) , UnmappedAttributes : output . UnmappedAttributes !== undefined && output . UnmappedAttributes !== null ? deserializeAws_json1_1UnmappedAttributeList ( output . UnmappedAttributes , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DetectPHIResponse = ( output , context ) : DetectPHIResponse => { return { Entities : output . Entities !== undefined && output . Entities !== null ? deserializeAws_json1_1EntityList ( output . Entities , context ) : undefined , ModelVersion : __expectString ( output . ModelVersion ) , PaginationToken : __expectString ( output . PaginationToken ) , } as any ; } ; const deserializeAws_json1_1Entity = ( output , context ) : Entity => { return { Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_json1_1AttributeList ( output . Attributes , context ) : undefined , BeginOffset : __expectInt32 ( output . BeginOffset ) , Category : __expectString ( output . Category ) , EndOffset : __expectInt32 ( output . EndOffset ) , Id : __expectInt32 ( output . Id ) , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , Traits : output . Traits !== undefined && output . Traits !== null ? deserializeAws_json1_1TraitList ( output . Traits , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1EntityList = ( output , context ) : Entity [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Entity ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ICD10CMAttribute = ( output , context ) : ICD10CMAttribute => { return { BeginOffset : __expectInt32 ( output . BeginOffset ) , Category : __expectString ( output . Category ) , EndOffset : __expectInt32 ( output . EndOffset ) , Id : __expectInt32 ( output . Id ) , RelationshipScore : __limitedParseFloat32 ( output . RelationshipScore ) , RelationshipType : __expectString ( output . RelationshipType ) , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , Traits : output . Traits !== undefined && output . Traits !== null ? deserializeAws_json1_1ICD10CMTraitList ( output . Traits , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1ICD10CMAttributeList = ( output , context ) : ICD10CMAttribute [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ICD10CMAttribute ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ICD10CMConcept = ( output , context ) : ICD10CMConcept => { return { Code : __expectString ( output . Code ) , Description : __expectString ( output . Description ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1ICD10CMConceptList = ( output , context ) : ICD10CMConcept [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ICD10CMConcept ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ICD10CMEntity = ( output , context ) : ICD10CMEntity => { return { Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_json1_1ICD10CMAttributeList ( output . Attributes , context ) : undefined , BeginOffset : __expectInt32 ( output . BeginOffset ) , Category : __expectString ( output . Category ) , EndOffset : __expectInt32 ( output . EndOffset ) , ICD10CMConcepts : output . ICD10CMConcepts !== undefined && output . ICD10CMConcepts !== null ? deserializeAws_json1_1ICD10CMConceptList ( output . ICD10CMConcepts , context ) : undefined , Id : __expectInt32 ( output . Id ) , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , Traits : output . Traits !== undefined && output . Traits !== null ? deserializeAws_json1_1ICD10CMTraitList ( output . Traits , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1ICD10CMEntityList = ( output , context ) : ICD10CMEntity [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ICD10CMEntity ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ICD10CMTrait = ( output , context ) : ICD10CMTrait => { return { Name : __expectString ( output . Name ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1ICD10CMTraitList = ( output , context ) : ICD10CMTrait [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ICD10CMTrait ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1InferICD10CMResponse = ( output , context ) : InferICD10CMResponse => { return { Entities : output . Entities !== undefined && output . Entities !== null ? deserializeAws_json1_1ICD10CMEntityList ( output . Entities , context ) : undefined , ModelVersion : __expectString ( output . ModelVersion ) , PaginationToken : __expectString ( output . PaginationToken ) , } as any ; } ; const deserializeAws_json1_1InferRxNormResponse = ( output , context ) : InferRxNormResponse => { return { Entities : output . Entities !== undefined && output . Entities !== null ? deserializeAws_json1_1RxNormEntityList ( output . Entities , context ) : undefined , ModelVersion : __expectString ( output . ModelVersion ) , PaginationToken : __expectString ( output . PaginationToken ) , } as any ; } ; const deserializeAws_json1_1InferSNOMEDCTResponse = ( output , context ) : InferSNOMEDCTResponse => { return { Characters : output . Characters !== undefined && output . Characters !== null ? deserializeAws_json1_1Characters ( output . Characters , context ) : undefined , Entities : output . Entities !== undefined && output . Entities !== null ? deserializeAws_json1_1SNOMEDCTEntityList ( output . Entities , context ) : undefined , ModelVersion : __expectString ( output . ModelVersion ) , PaginationToken : __expectString ( output . PaginationToken ) , SNOMEDCTDetails : output . SNOMEDCTDetails !== undefined && output . SNOMEDCTDetails !== null ? deserializeAws_json1_1SNOMEDCTDetails ( output . SNOMEDCTDetails , context ) : undefined , } as any ; } ; const deserializeAws_json1_1InputDataConfig = ( output , context ) : InputDataConfig => { return { S3Bucket : __expectString ( output . S3Bucket ) , S3Key : __expectString ( output . S3Key ) , } as any ; } ; const deserializeAws_json1_1InternalServerException = ( output , context ) : InternalServerException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidEncodingException = ( output , context ) : InvalidEncodingException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1InvalidRequestException = ( output , context ) : InvalidRequestException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1ListEntitiesDetectionV2JobsResponse = ( output , context ) : ListEntitiesDetectionV2JobsResponse => { return { ComprehendMedicalAsyncJobPropertiesList : output . ComprehendMedicalAsyncJobPropertiesList !== undefined && output . ComprehendMedicalAsyncJobPropertiesList !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobPropertiesList ( output . ComprehendMedicalAsyncJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListICD10CMInferenceJobsResponse = ( output , context ) : ListICD10CMInferenceJobsResponse => { return { ComprehendMedicalAsyncJobPropertiesList : output . ComprehendMedicalAsyncJobPropertiesList !== undefined && output . ComprehendMedicalAsyncJobPropertiesList !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobPropertiesList ( output . ComprehendMedicalAsyncJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListPHIDetectionJobsResponse = ( output , context ) : ListPHIDetectionJobsResponse => { return { ComprehendMedicalAsyncJobPropertiesList : output . ComprehendMedicalAsyncJobPropertiesList !== undefined && output . ComprehendMedicalAsyncJobPropertiesList !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobPropertiesList ( output . ComprehendMedicalAsyncJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListRxNormInferenceJobsResponse = ( output , context ) : ListRxNormInferenceJobsResponse => { return { ComprehendMedicalAsyncJobPropertiesList : output . ComprehendMedicalAsyncJobPropertiesList !== undefined && output . ComprehendMedicalAsyncJobPropertiesList !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobPropertiesList ( output . ComprehendMedicalAsyncJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListSNOMEDCTInferenceJobsResponse = ( output , context ) : ListSNOMEDCTInferenceJobsResponse => { return { ComprehendMedicalAsyncJobPropertiesList : output . ComprehendMedicalAsyncJobPropertiesList !== undefined && output . ComprehendMedicalAsyncJobPropertiesList !== null ? deserializeAws_json1_1ComprehendMedicalAsyncJobPropertiesList ( output . ComprehendMedicalAsyncJobPropertiesList , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1OutputDataConfig = ( output , context ) : OutputDataConfig => { return { S3Bucket : __expectString ( output . S3Bucket ) , S3Key : __expectString ( output . S3Key ) , } as any ; } ; const deserializeAws_json1_1ResourceNotFoundException = ( output , context ) : ResourceNotFoundException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1RxNormAttribute = ( output , context ) : RxNormAttribute => { return { BeginOffset : __expectInt32 ( output . BeginOffset ) , EndOffset : __expectInt32 ( output . EndOffset ) , Id : __expectInt32 ( output . Id ) , RelationshipScore : __limitedParseFloat32 ( output . RelationshipScore ) , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , Traits : output . Traits !== undefined && output . Traits !== null ? deserializeAws_json1_1RxNormTraitList ( output . Traits , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1RxNormAttributeList = ( output , context ) : RxNormAttribute [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1RxNormAttribute ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1RxNormConcept = ( output , context ) : RxNormConcept => { return { Code : __expectString ( output . Code ) , Description : __expectString ( output . Description ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1RxNormConceptList = ( output , context ) : RxNormConcept [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1RxNormConcept ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1RxNormEntity = ( output , context ) : RxNormEntity => { return { Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_json1_1RxNormAttributeList ( output . Attributes , context ) : undefined , BeginOffset : __expectInt32 ( output . BeginOffset ) , Category : __expectString ( output . Category ) , EndOffset : __expectInt32 ( output . EndOffset ) , Id : __expectInt32 ( output . Id ) , RxNormConcepts : output . RxNormConcepts !== undefined && output . RxNormConcepts !== null ? deserializeAws_json1_1RxNormConceptList ( output . RxNormConcepts , context ) : undefined , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , Traits : output . Traits !== undefined && output . Traits !== null ? deserializeAws_json1_1RxNormTraitList ( output . Traits , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1RxNormEntityList = ( output , context ) : RxNormEntity [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1RxNormEntity ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1RxNormTrait = ( output , context ) : RxNormTrait => { return { Name : __expectString ( output . Name ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1RxNormTraitList = ( output , context ) : RxNormTrait [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1RxNormTrait ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ServiceUnavailableException = ( output , context ) : ServiceUnavailableException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1SNOMEDCTAttribute = ( output , context ) : SNOMEDCTAttribute => { return { BeginOffset : __expectInt32 ( output . BeginOffset ) , Category : __expectString ( output . Category ) , EndOffset : __expectInt32 ( output . EndOffset ) , Id : __expectInt32 ( output . Id ) , RelationshipScore : __limitedParseFloat32 ( output . RelationshipScore ) , RelationshipType : __expectString ( output . RelationshipType ) , SNOMEDCTConcepts : output . SNOMEDCTConcepts !== undefined && output . SNOMEDCTConcepts !== null ? deserializeAws_json1_1SNOMEDCTConceptList ( output . SNOMEDCTConcepts , context ) : undefined , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , Traits : output . Traits !== undefined && output . Traits !== null ? deserializeAws_json1_1SNOMEDCTTraitList ( output . Traits , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1SNOMEDCTAttributeList = ( output , context ) : SNOMEDCTAttribute [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1SNOMEDCTAttribute ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1SNOMEDCTConcept = ( output , context ) : SNOMEDCTConcept => { return { Code : __expectString ( output . Code ) , Description : __expectString ( output . Description ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1SNOMEDCTConceptList = ( output , context ) : SNOMEDCTConcept [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1SNOMEDCTConcept ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1SNOMEDCTDetails = ( output , context ) : SNOMEDCTDetails => { return { Edition : __expectString ( output . Edition ) , Language : __expectString ( output . Language ) , VersionDate : __expectString ( output . VersionDate ) , } as any ; } ; const deserializeAws_json1_1SNOMEDCTEntity = ( output , context ) : SNOMEDCTEntity => { return { Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_json1_1SNOMEDCTAttributeList ( output . Attributes , context ) : undefined , BeginOffset : __expectInt32 ( output . BeginOffset ) , Category : __expectString ( output . Category ) , EndOffset : __expectInt32 ( output . EndOffset ) , Id : __expectInt32 ( output . Id ) , SNOMEDCTConcepts : output . SNOMEDCTConcepts !== undefined && output . SNOMEDCTConcepts !== null ? deserializeAws_json1_1SNOMEDCTConceptList ( output . SNOMEDCTConcepts , context ) : undefined , Score : __limitedParseFloat32 ( output . Score ) , Text : __expectString ( output . Text ) , Traits : output . Traits !== undefined && output . Traits !== null ? deserializeAws_json1_1SNOMEDCTTraitList ( output . Traits , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1SNOMEDCTEntityList = ( output , context ) : SNOMEDCTEntity [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1SNOMEDCTEntity ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1SNOMEDCTTrait = ( output , context ) : SNOMEDCTTrait => { return { Name : __expectString ( output . Name ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1SNOMEDCTTraitList = ( output , context ) : SNOMEDCTTrait [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1SNOMEDCTTrait ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1StartEntitiesDetectionV2JobResponse = ( output , context ) : StartEntitiesDetectionV2JobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1StartICD10CMInferenceJobResponse = ( output , context ) : StartICD10CMInferenceJobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1StartPHIDetectionJobResponse = ( output , context ) : StartPHIDetectionJobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1StartRxNormInferenceJobResponse = ( output , context ) : StartRxNormInferenceJobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1StartSNOMEDCTInferenceJobResponse = ( output , context ) : StartSNOMEDCTInferenceJobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1StopEntitiesDetectionV2JobResponse = ( output , context ) : StopEntitiesDetectionV2JobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1StopICD10CMInferenceJobResponse = ( output , context ) : StopICD10CMInferenceJobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1StopPHIDetectionJobResponse = ( output , context ) : StopPHIDetectionJobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1StopRxNormInferenceJobResponse = ( output , context ) : StopRxNormInferenceJobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1StopSNOMEDCTInferenceJobResponse = ( output , context ) : StopSNOMEDCTInferenceJobResponse => { return { JobId : __expectString ( output . JobId ) , } as any ; } ; const deserializeAws_json1_1TextSizeLimitExceededException = ( output , context ) : TextSizeLimitExceededException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1TooManyRequestsException = ( output , context ) : TooManyRequestsException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_json1_1Trait = ( output , context ) : Trait => { return { Name : __expectString ( output . Name ) , Score : __limitedParseFloat32 ( output . Score ) , } as any ; } ; const deserializeAws_json1_1TraitList = ( output , context ) : Trait [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Trait ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1UnmappedAttribute = ( output , context ) : UnmappedAttribute => { return { Attribute : output . Attribute !== undefined && output . Attribute !== null ? deserializeAws_json1_1Attribute ( output . Attribute , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1UnmappedAttributeList = ( output , context ) : UnmappedAttribute [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1UnmappedAttribute ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ValidationException = ( output , context ) : ValidationException => { return { Message : __expectString ( output . Message ) , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const buildHttpRpcRequest = async ( context , headers , path , resolvedHostname , body ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const contents = { protocol , hostname , port , method : "POST" , path : basePath . endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) + path : basePath + path , headers , } ; if ( resolvedHostname !== undefined ) { contents . hostname = resolvedHostname ; } if ( body !== undefined ) { contents . body = body ; } return new __HttpRequest ( contents ) ; } ; const parseBody = ( streamBody , context ) : any => collectBodyString ( streamBody , context ) . then ( ( encoded ) => { if ( encoded . length ) { return JSON . parse ( encoded ) ; } return { } ; } ) ; /**
 * Load an error code for the aws.rest-json-1.1 protocol.
 */ const loadRestJsonErrorCode = ( output , data ) : string => { const findKey = ( object , key ) => Object . keys ( object ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ; const sanitizeErrorCode = ( rawValue ) : string => { let cleanValue = rawValue ; if ( cleanValue . indexOf ( ":" ) >= 0 ) { cleanValue = cleanValue . split ( ":" ) [ 0 ] ; } if ( cleanValue . indexOf ( "#" ) >= 0 ) { cleanValue = cleanValue . split ( "#" ) [ 1 ] ; } return cleanValue ; } ; const headerKey = findKey ( output . headers , "x-amzn-errortype" ) ; if ( headerKey !== undefined ) { return sanitizeErrorCode ( output . headers [ headerKey ] ) ; } if ( data . code !== undefined ) { return sanitizeErrorCode ( data . code ) ; } if ( data [ "__type" ] !== undefined ) { return sanitizeErrorCode ( data [ "__type" ] ) ; } return "" ; } ;