Controlling the UI

Automatic Clinician Authentication

To allow the embedded UI to securely act on behalf of a clinician user, it will need to have an access token associated to a clinician user. To generate this access token without the password of the clinician, your backend will call POST /clinicians/{{clinician_id}}/authenticate with internal identifier of a clinician that your backend is authorized for. The reponse from this method will be a set of tokens that should be returned to your front end, and then your front end will provide them to the embedded Blueprint UI like this along with the clinician identifier:

<script>
  Blueprint.authenticate(accessTokens, clinicianId)
</script>

Automatically Select Client

Once a clinician is authenticated, a client can be automatically selected and the clinician will be prompted to start a recording. To select a client, provide the client identifier to the embedded Bluperint UI:

Blueprint.selectClient(clientId)

Optionally, provide additional configuration settings to the Blueprint UI. Tese settings will be selected by default:

Blueprint.selectClient(clientId, {
  sessionExternalId: 'external-id-1',
  sessionSetting: 'in-person', // in-person or telehealth
  usingHeadphones: true,
  noteOptions: {
    sessionType: 'individual', // individiual, couple, group
    noteType: 'birp',
    treatmentApproaches: ['cbt', 'dbt'],
    noteGroup: 'therapists' // Limit the available note types in the dropdown to 'therapists' or 'prescribers'
  },
})

Listening to UI Events

onCopyNoteClicked

After clinical artifcats have been generated and the user clicks the "Copy Note" button (the text can be customized via the copyNoteButtonText setting), the following callback can be used to access the note.

<script>
  Blueprint.onCopyNoteClicked(({sessionId, note}) => {
    console.log('Copy Note Clicked:', sessionId, note)
  })
</script>

onGenerateNoteClicked

The following callback can be used hen the clinician clicks the "Generate Note" button to end the session and generate a note, or when the clinician re-generates a note using Magic Edit.

<script>
  Blueprint.onGenerateNoteClicked(({ sessionId, progressNoteId, sessionType, noteType, treatmentApproaches }) => {
    console.log('Generate Note Clicked:', sessionId, progressNoteId, sessionType, noteType, treatmentApproaches)
  })
</script>

onDeleteSessionClicked

When the clinician clicks on the "Delete Session" button, the follwoing callback can be used.

<script>
  Blueprint.onDeleteSessionClicked(({ sessionId }) => {
    console.log('Delete Session Clicked:', sessionId)
  })
</script>

onDeleteNoteClicked

When the clinician clicks the "Delete Note" button, the following callback can be used.

<script>
  Blueprint.onDeleteNoteClicked(({ sessionId, progressNoteId }) => {
    console.log('Delete Note Clicked:', sessionId, progressNoteId)
  })
</script>

onSessionRecordingStarted

This is initiated when the clinician starts a recording by clicking on the Start Recording button.

<script>
  Blueprint.onSessionRecordingStarted(({ sessionId }) => {
    console.log('Start Session Clicked:', sessionId)
  })
</script>