Encounter
The Encounter namespace provides commands, events, and errors for managing clinical encounters within the Aura Widget.
Event Flow
Commands
Commands you can send to control encounter behavior.
Encounter.Open
Opens an encounter with the provided encounter ID. If the encounter doesn’t exist, a new record will be created using the provided patient and provider details.
AuraWidget.command({
type: 'Encounter.Open',
payload: {
encounterId: '1234567890',
patient: {
id: '3572',
firstName: 'John',
lastName: 'Doe',
birthDate: '1990-01-15',
gender: 'Male',
email: 'john.doe@example.com',
phone: '+1234567890',
address: {
line1: '123 Main St',
city: 'New York',
state: 'NY',
zip: '10001',
country: 'USA',
},
},
encounterDateTime: '2025-01-01T00:00:00Z',
providerId: '971',
description: 'Annual checkup',
templates: {
'pre-chart': '<template-id-1>',
'in-visit': '<template-id-2>',
},
},
});Payload
| Property | Type | Description |
|---|---|---|
encounterId* | string | Unique identifier for the encounter in your system. |
patient* | Patient | The patient object. See Patient properties below. |
id* | string | Unique identifier for the patient in your system. |
firstName | string | Patient's first name. |
lastName | string | Patient's last name. |
birthDate* | string | Patient's date of birth in YYYY-MM-DD format. |
gender | 'Male' | 'Female' | 'Other' | Patient's gender. |
email | string | Patient's email address. |
phone | string | Patient's phone number. |
address | Address | Patient's address. All fields are optional. |
line1 | string | Street address line 1. |
line2 | string | Street address line 2. |
city | string | City name. |
state | string | State or province. |
zip | string | ZIP or postal code. |
country | string | Country name. |
encounterDateTime* | string | Encounter start date and time in ISO 8601 format. |
providerId* | string | Unique identifier for the provider in your system. |
description | string | Optional description for the encounter. |
templates | object | Template IDs to use for each encounter phase. |
pre-chart | string | Template ID for the pre-chart phase. |
in-visit | string | Template ID for the in-visit phase. |
If a patient with the same id already exists, their record will be updated
with the provided details. Otherwise, a new patient record will be created.
Encounter.Update
Updates the encounter with the provided details.
AuraWidget.command({
type: 'Encounter.Update',
payload: {
description: 'Updated description',
encounterDateTime: '2025-01-01T00:00:00Z',
},
});Payload
| Property | Type | Description |
|---|---|---|
description | string | Updated description for the encounter. |
encounterDateTime | string | Updated encounter start date and time in ISO 8601 format. |
Encounter.RegenerateNote
Regenerates the note for the opened encounter.
AuraWidget.command({
type: 'Encounter.RegenerateNote',
payload: {
encounterId: '1234567890',
encounterPhase: 'in-visit',
templates: {
'in-visit': '<template-id-2>',
},
},
});Payload
| Property | Type | Description |
|---|---|---|
encounterId* | string | Unique identifier for the encounter in your system. |
encounterPhase* | 'pre-chart' | 'in-visit' | The encounter phase to regenerate the note for. |
templates | object | Optional template ID to use for regenerating the note. |
pre-chart | string | Template ID for the pre-chart phase. |
in-visit | string | Template ID for the in-visit phase. |
Encounter.UpdateHistory
Adds a prior note or history to the encounter pre-chart.
AuraWidget.command({
type: 'Encounter.UpdateHistory',
payload: {
encounterId: '1234567890',
note: 'Patient has a history of hypertension and diabetes.',
},
});Payload
| Property | Type | Description |
|---|---|---|
encounterId* | string | Unique identifier for the encounter in your system. |
note* | string | Any prior note or history content to add to the encounter pre-chart. |
Events
Events broadcast by the widget that you can subscribe to.
Encounter.Loaded
Fired when an encounter has been successfully loaded and is ready for interaction.
| Property | Type | Description |
|---|---|---|
encounterId* | string | Unique identifier for the encounter in your system. This links the widget's encounter to your application's encounter record. |
Encounter.NoteChanged
Fired with the latest note summary/note for the current encounter.
| Property | Type | Description |
|---|---|---|
noteJson* | object | The latest note summary/note JSON. |
encounterId* | string | Unique identifier for the encounter in your system. This links the widget's encounter to your application's encounter record. |
encounterPhase* | string | The phase of the encounter the note was generated for. e.g. pre-chart and in-visit. |
templateId | string | The template ID used to generate the note. This may be undefined if the note was created using a template unknown to the widget. |
Errors
The error events emitted during the course of an encounter. Each error event receives the common error properties as payload, in addition to the event-specific properties listed below.
Encounter.LoadFailed
Fired when an encounter fails to load. The event receives the common error properties as payload.
Encounter.HistoryUpdateFailed
Fired when an encounter history update fails.
| Property | Type | Description |
|---|---|---|
encounterId* | string | Unique identifier for the encounter in your system. This links the widget's encounter to your application's encounter record. |