<Omniscribe> component.
Initial setup
1. Installation
2. Import in your application
Basic React component
Implementation with hooks
Props
Required
| Prop | Type | Description |
|---|---|---|
baseurl | string | SofIA API endpoint |
wssurl | string | WebSocket URL for real-time features |
apikey | string | Authentication key |
userid | string | User identifier in the EHR/HIS system |
patientid | string | Patient identifier in the EHR/HIS system |
template | object | Template object for report generation |
templateid | string | Template identifier (both template and templateid are required) |
Optional
| Prop | Type | Description |
|---|---|---|
isopen | boolean | Show/hide component |
language | LanguageCode | Interface language (e.g., LanguageCode.en) |
debug | boolean | Enable debug logging |
patientdata | object | Patient information (see structure below) |
showconsentindicator | boolean | Show the consent status indicator in the header (default: false) |
Callbacks
| Prop | Signature | Description |
|---|---|---|
handleReport | (report: unknown) => void | Receives generated reports |
setIsOpen | (value: boolean | (prev: boolean) => boolean) => void | Controls widget visibility |
setGetLastReport | (fn: () => Promise<unknown>) => void | Exposes async function to retrieve last report |
Retrieving the last report
ThesetGetLastReport callback receives an async function that you can store and call later:
Patient data updates
Use React state to dynamically update patient context. The SDK automatically re-initializes whenpatientid or userid change.
Patient data structure
extraData fields
| Field | Description |
|---|---|
medical_practice | The doctor’s specialty (e.g., "Cardiology", "Pediatrics"). Helps SofIA tailor responses to clinical context |
patient_medical_notes | Previous consultation notes. Include url fields if you want SofIA to cite the source |
| (custom fields) | Any additional patient data relevant to the consultation (e.g., allergies, medications) |
Full example
State management with context
For applications that need to share SofIA state across multiple components:Complete example
For a complete implementation with React and TypeScript, check our examples repository: View complete React example The example includes:- Complete setup with Vite + React 19 + TypeScript
- Development console with real-time controls
- Template and patient data editors with JSON validation
- Dynamic User ID, Patient ID, and Template ID switching
Best practices
Performance
- Use
useCallbackfor stable callbacks (handleReport,setGetLastReport) - Implement lazy loading for components on non-critical routes
State
- Pass
setIsOpendirectly — the SDK controls visibility - Changing
useridorpatientidautomatically remounts the SDK