Skip to content

Transcribe Streaming  >  Operations  >  start_medical_scribe_stream

start_medical_scribe_stream

Operation

start_medical_scribe_stream async

start_medical_scribe_stream(input: StartMedicalScribeStreamInput, plugins: list[Plugin] | None = None) -> DuplexEventStream[MedicalScribeInputStream, MedicalScribeResultStream, StartMedicalScribeStreamOutput]

Starts a bidirectional HTTP/2 stream, where audio is streamed to Amazon Web Services HealthScribe and the transcription results are streamed to your application.

When you start a stream, you first specify the stream configuration in a MedicalScribeConfigurationEvent. This event includes channel definitions, encryption settings, medical scribe context, and post-stream analytics settings, such as the output configuration for aggregated transcript and clinical note generation. These are additional streaming session configurations beyond those provided in your initial start request headers. Whether you are starting a new session or resuming an existing session, your first event must be a MedicalScribeConfigurationEvent.

After you send a MedicalScribeConfigurationEvent, you start AudioEvents and Amazon Web Services HealthScribe responds with real-time transcription results. When you are finished, to start processing the results with the post-stream analytics, send a MedicalScribeSessionControlEvent with a Type of END_OF_SESSION and Amazon Web Services HealthScribe starts the analytics.

You can pause or resume streaming. To pause streaming, complete the input stream without sending the MedicalScribeSessionControlEvent. To resume streaming, call the StartMedicalScribeStream and specify the same SessionId you used to start the stream.

The following parameters are required:

  • language-code

  • media-encoding

  • media-sample-rate-hertz

For more information on streaming with Amazon Web Services HealthScribe, see Amazon Web Services HealthScribe.

Parameters:

Name Type Description Default
input StartMedicalScribeStreamInput

An instance of StartMedicalScribeStreamInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
DuplexEventStream[MedicalScribeInputStream, MedicalScribeResultStream, StartMedicalScribeStreamOutput]

A DuplexEventStream for bidirectional streaming.

Input

StartMedicalScribeStreamInput dataclass

Dataclass for StartMedicalScribeStreamInput structure.

Attributes

language_code class-attribute instance-attribute
language_code: MedicalScribeLanguageCode | None = None

Specify the language code for your HealthScribe streaming session.

media_encoding class-attribute instance-attribute
media_encoding: MedicalScribeMediaEncoding | None = None

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.

media_sample_rate_hertz class-attribute instance-attribute
media_sample_rate_hertz: int | None = None

Specify the sample rate of the input audio (in hertz). Amazon Web Services HealthScribe supports a range from 16,000 Hz to 48,000 Hz. The sample rate you specify must match that of your audio.

session_id class-attribute instance-attribute
session_id: str | None = None

Specify an identifier for your streaming session (in UUID format). If you don't include a SessionId in your request, Amazon Web Services HealthScribe generates an ID and returns it in the response.

Output

This operation returns a DuplexEventStream for bidirectional streaming.

Event Stream Structure

Input Event Type

MedicalScribeInputStream

Output Event Type

MedicalScribeResultStream

Initial Response Structure

StartMedicalScribeStreamOutput dataclass

Dataclass for StartMedicalScribeStreamOutput structure.

Attributes
language_code class-attribute instance-attribute
language_code: MedicalScribeLanguageCode | None = None

The Language Code that you specified in your request. Same as provided in the StartMedicalScribeStreamRequest.

media_encoding class-attribute instance-attribute
media_encoding: MedicalScribeMediaEncoding | None = None

The Media Encoding you specified in your request. Same as provided in the StartMedicalScribeStreamRequest

media_sample_rate_hertz class-attribute instance-attribute
media_sample_rate_hertz: int | None = None

The sample rate (in hertz) that you specified in your request. Same as provided in the StartMedicalScribeStreamRequest

request_id class-attribute instance-attribute
request_id: str | None = None

The unique identifier for your streaming request.

session_id class-attribute instance-attribute
session_id: str | None = None

The identifier (in UUID format) for your streaming session.

If you already started streaming, this is same ID as the one you specified in your initial StartMedicalScribeStreamRequest.