detectPHI method

Future<DetectPHIResponse> detectPHI({
  1. required String text,
})

Inspects the clinical text for protected health information (PHI) entities and returns the entity category, location, and confidence score for each entity. Amazon Comprehend Medical only detects entities in English language texts.

May throw InternalServerException. May throw ServiceUnavailableException. May throw TooManyRequestsException. May throw InvalidRequestException. May throw InvalidEncodingException. May throw TextSizeLimitExceededException.

Parameter text : A UTF-8 text string containing the clinical content being examined for PHI entities. Each string must contain fewer than 20,000 bytes of characters.

Implementation

Future<DetectPHIResponse> detectPHI({
  required String text,
}) async {
  ArgumentError.checkNotNull(text, 'text');
  _s.validateStringLength(
    'text',
    text,
    1,
    20000,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'ComprehendMedical_20181030.DetectPHI'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Text': text,
    },
  );

  return DetectPHIResponse.fromJson(jsonResponse.body);
}