Skip to main content

EkaScribe iOS SDK

A Swift package for voice-to-prescription functionality with audio recording and real-time transcription capabilities for medical consultation applications.

Overview

EkaScribe empowers healthcare applications with advanced voice recording and transcription capabilities. It provides a seamless integration for medical consultation workflows, enabling doctors to record patient interactions and automatically generate prescriptions through AI-powered voice analysis.

Getting Started

  1. Install the package via Swift Package Manager
  2. Configure authentication and doctor information at app launch
  3. Initialize VoiceToRxViewModel in your view
  4. Start recording with your desired templates and languages
  5. Handle results when processing completes
The SDK requires iOS 17.0+ and provides a simple, straightforward API for voice-to-prescription functionality.

Key Features

  • 🎙️ Voice Activity Detection (VAD) - Intelligent audio recording with automatic speech detection
  • 🔄 Real-time Transcription - Live audio-to-text conversion during consultations
  • 🏥 Medical Context Aware - Specialized for healthcare terminology and prescription generation
  • 📊 Session Management - Complete recording session lifecycle management
  • ☁️ Cloud Integration - Automatic audio upload and processing
  • 📝 Template Support - Customizable output formats (SOAP notes, prescriptions, etc.)

Table of Contents

Requirements

⚠️ Important: This SDK requires iOS 17.0 or later.
  • iOS: 17.0+
  • Swift: 5.9+
  • Xcode: 15.0+
  • Sdk Version: 1.3.5+

System Permissions

Add the following permissions to your app’s Info.plist:

Installation

Swift Package Manager

Add EkaScribe to your project using Swift Package Manager:
  1. In Xcode, select File → Add Package Dependencies
  2. Enter the repository URL:
    Or use SSH:
  3. Choose the version or branch
  4. Add to your target

Package.swift

Import Statement

After adding the package, import it in your Swift files:

Integration Guide

Follow these steps to integrate the SDK into your app:

Step 1: Configure Authentication and Doctor Information

Set up authentication tokens and doctor information when your app launches. This should be done once at app startup:
Important: Make sure to set authentication tokens and doctor information before making any SDK calls.

Step 2: Initialize the View Model

Create a VoiceToRxViewModel instance in your SwiftUI view or UIKit view controller: SwiftUI:
UIKit:

Step 3: Start Recording

Start a recording session with your desired configuration:

Parameters

The startRecording() method accepts the following parameters:
  • conversationType (VoiceConversationType): The type of conversation (see Conversation Types)
  • inputLanguage ([InputLanguageType]): Array of supported languages (see Input Languages)
  • templates ([OutputFormatTemplate]): Array of output format templates (see Template Management)
  • modelType (ModelType): The AI model to use for processing (see Model Types)
Note: It’s recommended to use the getTemplates() API first to fetch available templates before creating the OutputFormatTemplate array. See the Template Management section for details.

Core Components

VoiceToRxViewModel

The central view model that manages the entire voice recording and processing workflow.

Recording States

The screenState property tracks the current state of the recording session:

Conversation Types

Model Types

Input Languages

Configuration

App-Level Setup

Configure the SDK when your app launches. This should be done once at app startup:
Important: Make sure to set authentication tokens and doctor information before making any SDK calls.

Session-Specific Configuration

Before starting a recording session, configure patient-specific information. This should be done each time you start a new recording:
Note: Patient information can be set to empty strings if not applicable:

Configuration Properties

Authentication

Set authentication tokens before making any SDK calls:

Recording Management

Starting Recording

Parameters

The startRecording() method accepts the following parameters:
  • conversationType (VoiceConversationType): The type of conversation (see Conversation Types)
  • inputLanguage ([InputLanguageType]): Array of supported languages (see Input Languages)
  • templates ([OutputFormatTemplate]): Array of output format templates (see Template Management)
  • modelType (ModelType): The AI model to use for processing (see Model Types)
Note: It’s recommended to use the getTemplates() API first to fetch available templates before creating the OutputFormatTemplate array. See the Template Management section for details.

Pausing and Resuming

Stopping Recording

Handling Results

Monitor the screenState for result availability. Results are automatically provided when processing completes:
Note: The value parameter contains base64-encoded formatted output based on your selected template. You need to decode it before displaying to users. For more detailed results including multiple template outputs, use VoiceToRxRepo.shared.fetchResultStatusResponse().

Template Management

Fetching Available Templates

Use VoiceToRxRepo to fetch available templates:

Updating Favorite Templates

Update user’s favorite templates configuration:

Using Templates in Recording

Pass templates when starting a recording:

Session History

Fetching Session History

Retrieve past recording sessions:

Result Management

Fetching Full Result Response

Get the complete result response with selected template outputs:
Note: The value parameter returned by fetchResultStatus is base64 encoded and must be decoded before displaying to users.

Switching Templates

Switch the output format for an existing session:

Updating Results

Update edited content back to the server:

Error Handling

Common Errors

The SDK provides specific error types:

Error Handling Example

Here’s a complete example of handling errors when starting a recording:

API Reference

VoiceToRxViewModel

Properties

Methods

VoiceToRxRepo

Template Management

Session History

Result Management

Configuration Classes

V2RxInitConfigurations

AuthTokenHolder

Data Models

OutputFormatTemplate

VoiceToRxStatusResponse

Best Practices

Memory Management

State Management

Always observe screenState changes to keep your UI in sync:

Error Handling

Always handle errors from async operations using try-catch:

Troubleshooting

Microphone Permission Issues

If microphone permission is denied:
  1. Check Info.plist has NSMicrophoneUsageDescription
  2. Request permission programmatically if needed
  3. Guide users to Settings if permission was previously denied

Session Creation Failures

If sessions fail to create:
  1. Verify ownerOID is set in V2RxInitConfigurations.shared
  2. Check AuthTokenHolder.shared.authToken is valid
  3. Ensure network connectivity
  4. Check for free session limit if applicable

Result Not Available

If results are not available after processing:
  1. Check screenState transitions to .resultDisplay
  2. Verify session ID is available: viewModel.sessionID
  3. Use VoiceToRxRepo.shared.fetchResultStatusResponse to get full response
  4. Check network connectivity for result retrieval