/AWS1/CL_TNS=>STRTMEDICALSTRMTRANSCRIPTION()
¶
About StartMedicalStreamTranscription¶
Starts a bidirectional HTTP/2 or WebSocket stream where audio is streamed to Amazon Transcribe Medical and the transcription results are streamed to your application.
The following parameters are required:
-
language-code
-
media-encoding
-
sample-rate
For more information on streaming with Amazon Transcribe Medical, see Transcribing streaming audio.
Method Signature¶
IMPORTING¶
Required arguments:¶
iv_languagecode
TYPE /AWS1/TNSLANGUAGECODE
/AWS1/TNSLANGUAGECODE
¶
Specify the language code that represents the language spoken in your audio.
Amazon Transcribe Medical only supports US English (
en-US
).
iv_mediasampleratehertz
TYPE /AWS1/TNSMEDIASAMPLERATEHERTZ
/AWS1/TNSMEDIASAMPLERATEHERTZ
¶
The sample rate of the input audio (in hertz). Amazon Transcribe Medical supports a range from 16,000 Hz to 48,000 Hz. Note that the sample rate you specify must match that of your audio.
iv_mediaencoding
TYPE /AWS1/TNSMEDIAENCODING
/AWS1/TNSMEDIAENCODING
¶
Specify the encoding used for the input audio. Supported formats are:
FLAC
OPUS-encoded audio in an Ogg container
PCM (only signed 16-bit little-endian audio formats, which does not include WAV)
For more information, see Media formats.
iv_specialty
TYPE /AWS1/TNSSPECIALTY
/AWS1/TNSSPECIALTY
¶
Specify the medical specialty contained in your audio.
iv_type
TYPE /AWS1/TNSTYPE
/AWS1/TNSTYPE
¶
Specify the type of input audio. For example, choose
DICTATION
for a provider dictating patient notes andCONVERSATION
for a dialogue between a patient and a medical professional.
io_audiostream
TYPE REF TO /AWS1/IF_TNSAUDIOSTREAM_IS
/AWS1/IF_TNSAUDIOSTREAM_IS
¶
AudioStream
Optional arguments:¶
iv_vocabularyname
TYPE /AWS1/TNSVOCABULARYNAME
/AWS1/TNSVOCABULARYNAME
¶
Specify the name of the custom vocabulary that you want to use when processing your transcription. Note that vocabulary names are case sensitive.
iv_showspeakerlabel
TYPE /AWS1/TNSBOOLEAN
/AWS1/TNSBOOLEAN
¶
Enables speaker partitioning (diarization) in your transcription output. Speaker partitioning labels the speech from individual speakers in your media file.
For more information, see Partitioning speakers (diarization).
iv_sessionid
TYPE /AWS1/TNSSESSIONID
/AWS1/TNSSESSIONID
¶
Specify a name for your transcription session. If you don't include this parameter in your request, Amazon Transcribe Medical generates an ID and returns it in the response.
iv_enbchannelidentification
TYPE /AWS1/TNSBOOLEAN
/AWS1/TNSBOOLEAN
¶
Enables channel identification in multi-channel audio.
Channel identification transcribes the audio on each channel independently, then appends the output for each channel into one transcript.
If you have multi-channel audio and do not enable channel identification, your audio is transcribed in a continuous manner and your transcript is not separated by channel.
If you include
EnableChannelIdentification
in your request, you must also includeNumberOfChannels
.For more information, see Transcribing multi-channel audio.
iv_numberofchannels
TYPE /AWS1/TNSNUMBEROFCHANNELS
/AWS1/TNSNUMBEROFCHANNELS
¶
Specify the number of channels in your audio stream. This value must be
2
, as only two channels are supported. If your audio doesn't contain multiple channels, do not include this parameter in your request.If you include
NumberOfChannels
in your request, you must also includeEnableChannelIdentification
.
iv_contentidentificationtype
TYPE /AWS1/TNSMEDICALCONTIDENTIFI00
/AWS1/TNSMEDICALCONTIDENTIFI00
¶
Labels all personal health information (PHI) identified in your transcript.
Content identification is performed at the segment level; PHI is flagged upon complete transcription of an audio segment.
For more information, see Identifying personal health information (PHI) in a transcription.
RETURNING¶
oo_output
TYPE REF TO /aws1/cl_tnsstrtmedicalstrmt01
/AWS1/CL_TNSSTRTMEDICALSTRMT01
¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->/aws1/if_tns~strtmedicalstrmtranscription(
io_audiostream = lo_stream
iv_contentidentificationtype = |string|
iv_enbchannelidentification = ABAP_TRUE
iv_languagecode = |string|
iv_mediaencoding = |string|
iv_mediasampleratehertz = 123
iv_numberofchannels = 123
iv_sessionid = |string|
iv_showspeakerlabel = ABAP_TRUE
iv_specialty = |string|
iv_type = |string|
iv_vocabularyname = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_requestid = lo_result->get_requestid( ).
lv_languagecode = lo_result->get_languagecode( ).
lv_mediasampleratehertz = lo_result->get_mediasampleratehertz( ).
lv_mediaencoding = lo_result->get_mediaencoding( ).
lv_vocabularyname = lo_result->get_vocabularyname( ).
lv_specialty = lo_result->get_specialty( ).
lv_type = lo_result->get_type( ).
lv_boolean = lo_result->get_showspeakerlabel( ).
lv_sessionid = lo_result->get_sessionid( ).
TRY.
WHILE lo_result->get_transcriptresultstream( )->/aws1/if_rt_stream_reader~data_available( ) = ABAP_TRUE.
lo_event = lo_result->get_transcriptresultstream( )->READ( ).
IF lo_event->get_transcriptevent( ) IS NOT INITIAL.
" process this kind of event
ENDIF.
ENDWHILE.
CATCH /aws1/cx_tnsinternalfailureex.
" handle error in stream
CATCH /aws1/cx_tnsconflictexception.
" handle error in stream
CATCH /aws1/cx_tnsbadrequestex.
" handle error in stream
CATCH /aws1/cx_tnslimitexceededex.
" handle error in stream
CATCH /aws1/cx_tnsserviceunavailex.
" handle error in stream
ENDTRY.
lv_boolean = lo_result->get_enbchannelidentification( ).
lv_numberofchannels = lo_result->get_numberofchannels( ).
lv_medicalcontentidentific = lo_result->get_contidentificationtype( ).
ENDIF.