UpdatedThe
setSessionContext method in the mobile SDK now accepts new optional parameters like:visit_typeencounter_typeprovider_rolereason_for_visitchief_complaint
Quick Summary
The
The method handles the session creation asynchronously and returns a result that you can use to track success or handle errors. Store the
createSession(withSessionInfo:) method creates a new ambient session and returns a sessionId that you use for all subsequent operations. You can optionally provide session context like patient information, provider specialty, and note sections to improve note quality.The method handles the session creation asynchronously and returns a result that you can use to track success or handle errors. Store the
sessionId securely as you’ll need it for recording controls and content retrieval.Overview
Before you can start recording audio and generating clinical notes, you must create an ambient session. This guide shows you how to create a session and provide clinical context that helps Suki generate more accurate notes.What Will You Learn?
In this guide, you will learn how to:- Create an ambient session using the
createSession(withSessionInfo:)method - Store the session ID returned from session creation for future operations
- Provide clinical context using the
setSessionContext(with:)method to improve note quality - Understand what information to provide and when to provide it
Create An Ambient Session
To start capturing audio and generating notes, you must first create a session. The session acts as a container that holds all the audio data and context for a single patient encounter.
Call the
createSession(withSessionInfo:) method to create a new session. When successful, this method returns a sessionId that you must store to use for recording and retrieving content later.
Session Info Parameters
ThewithSessionInfo dictionary accepts the following optional parameters:
An optional unique identifier for the session. If you don’t provide this, the SDK automatically generates a session ID for you. Use this if you want to use your own encounter ID or session identifier.
Enables multilingual processing for the session. Set this to
true if the conversation will be in languages other than English. The default value is false (English only). Once set, this cannot be changed for the session.Important: Always store the
sessionId returned from createSession. You’ll need it to:- Start recording
- Check session status
- Retrieve generated content
- Update session context
Provide Clinical Context (Optional but Recommended)
After creating a session, you can provide additional clinical information using thesetSessionContext(with:) method. This context helps Suki’s AI generate more accurate and relevant clinical notes.
Why provide context?
- Better note quality: More accurate sections and diagnoses
- Specialty-specific formatting: Notes match your medical specialty
- Structured organization: Notes organized by the sections you need
- Diagnosis accuracy: Better identification of conditions discussed
You can call
setSessionContext(with:) multiple times. Each call updates or adds to the existing context. This allows you to provide information as it becomes available in your app.Context Parameters
All context parameters are optional. Provide only the information that is available in your application. The absence of any parameter will not break existing functionality.Patient demographic information that helps personalize the note generation.
Information about the healthcare provider to tailor note generation to your specialty and role.
Visit-related metadata that provides context about the type and purpose of the encounter.
An array of LOINC codes that specify which clinical note sections you want in the generated note. Each dictionary contains a LOINC code.
You only need to provide LOINC codes. The SDK automatically generates the appropriate clinical section titles based on the codes you provide.
Structured diagnosis information that helps the AI identify and code conditions discussed during the encounter. Each dictionary represents one diagnosis.
Best Practices
Follow these practices to ensure reliable session management:-
Always initialize the SDK first: Make sure
SukiAmbientCore.shared.initialize()has been called successfully before creating a session. -
Store the session ID: Save the
sessionIdreturned fromcreateSessionimmediately. You’ll need it for all subsequent operations. - Handle errors properly: Use the completion handler’s result to check for success or failure. Display appropriate error messages to users.
-
Provide context when available: Call
setSessionContextwith any clinical information you have. Even partial context improves note quality. -
Call setSessionContext after createSession: Wait for
createSessionto succeed before callingsetSessionContext. - Handle background limitations: On iOS, you cannot start a recording while the app is in the background. Ensure your app is active before starting recording.
FAQs
Why is session creation failing?
Why is session creation failing?
Session creation can fail for several reasons:Common causes:
- SDK not initialized: Make sure you’ve called
initialize()before creating a session - Invalid partner information: Check that your partner ID and provider information are correct
- Network connectivity issues: Ensure the device has an active internet connection
- Authentication token problems: Verify your token provider is returning valid tokens
- Missing microphone permissions: Ensure your app has microphone access permissions
.failure case. The error will indicate the specific reason for failure.Why isn't my session context updating?
Why isn't my session context updating?
The session context may not update if:
- Session not created: You must call
createSessionfirst and wait for it to succeed - Method not called: Ensure you’re actually calling
setSessionContextafter session creation - Invalid parameters: Check that specialty strings and codes match the expected formats
- Network error: The update request may have failed due to connectivity issues
.failure, examine the error to understand what went wrong.Can I start recording immediately after creating a session?
Can I start recording immediately after creating a session?
Yes, once
createSession succeeds and returns a sessionId, you can start recording. However, it’s recommended to call setSessionContext first if you have clinical context available, as this improves note quality.The typical flow is:- Create session → Get sessionId
- Set session context (optional but recommended)
- Start recording