createMedicalVocabulary method

Future<CreateMedicalVocabularyResponse> createMedicalVocabulary({
  1. required LanguageCode languageCode,
  2. required String vocabularyFileUri,
  3. required String vocabularyName,
  4. List<Tag>? tags,
})

Creates a new custom medical vocabulary.

Before creating a new custom medical vocabulary, you must first upload a text file that contains your vocabulary table into an Amazon S3 bucket. Note that this differs from , where you can include a list of terms within your request using the Phrases flag; CreateMedicalVocabulary does not support the Phrases flag and only accepts vocabularies in table format.

Each language has a character set that contains all allowed characters for that specific language. If you use unsupported characters, your custom vocabulary request fails. Refer to Character Sets for Custom Vocabularies to get the character set for your language.

For more information, see Custom vocabularies.

May throw BadRequestException. May throw ConflictException. May throw InternalFailureException. May throw LimitExceededException.

Parameter languageCode : The language code that represents the language of the entries in your custom vocabulary. US English (en-US) is the only language supported with Amazon Transcribe Medical.

Parameter vocabularyFileUri : The Amazon S3 location (URI) of the text file that contains your custom medical vocabulary. The URI must be in the same Amazon Web Services Region as the resource you're calling.

Here's an example URI path: s3://DOC-EXAMPLE-BUCKET/my-vocab-file.txt

Parameter vocabularyName : A unique name, chosen by you, for your new custom medical vocabulary.

This name is case sensitive, cannot contain spaces, and must be unique within an Amazon Web Services account. If you try to create a new custom medical vocabulary with the same name as an existing custom medical vocabulary, you get a ConflictException error.

Parameter tags : Adds one or more custom tags, each in the form of a key:value pair, to a new custom medical vocabulary at the time you create this new custom vocabulary.

To learn more about using tags with Amazon Transcribe, refer to Tagging resources.

Implementation

Future<CreateMedicalVocabularyResponse> createMedicalVocabulary({
  required LanguageCode languageCode,
  required String vocabularyFileUri,
  required String vocabularyName,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Transcribe.CreateMedicalVocabulary'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LanguageCode': languageCode.value,
      'VocabularyFileUri': vocabularyFileUri,
      'VocabularyName': vocabularyName,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateMedicalVocabularyResponse.fromJson(jsonResponse.body);
}