Submission Number: 98
Submission ID: 92
Submission UUID: 527c65d4-039a-40b5-9cb0-d3730a9c5e7b
Submission URI: /Script

Created: Wed, 06/24/2020 - 18:33
Completed: Wed, 06/24/2020 - 18:33
Changed: Wed, 07/08/2020 - 15:06

Remote IP address: 24.19.150.34
Submitted by: imedqo
Language: English

Is draft: No
Webform: Script
Submitted to: Script Upload

Script

Patient Assistant
Patient Assistant
Script: "Patient Assistant"
Language: "en-us male"

# Set up wait time for patient responses
Variable: timeoutReturnLabel = AnnounceVersion
Timeout: 30 TIMEOUT

# Announce version ("Testing" is displayed as text and is not spoken)

@AnnounceVersion

Name Speak : Pat : "Neon Patient Assistant Application Demonstration Version 2020 07 07 18:00 </speak> Testing"

Variable: exitList = "exit", "cancel", "never mind"
Variable: noList
Variable: yesList
Variable: alertsPhraseList
Variable: heyPatList
Variable: askPrompt
Variable: returnLabel
Variable: heardSilence
Variable: falseAlarmCount
Variable: askReturnValue = ""
Variable: userName
Variable: moreAppInfo
Variable: customizeSettings
Variable: customizeLanguage
Variable: customizeProsody
Variable: photoTime

@StartUp

# Initialize

# exitList = "exit", "cancel", "never mind"
noList = "no", "not now", "never mind", "nope", "n"
yesList = "yes", "yup", "y"
alertsPhraseList = "help", "I need help", "help me", "emergency", "this is an emergency", "i need a doctor", "i need a doctor", "i need a doctor", "i need a doctor", "i need a doctor", "i need a nurse", "i need aid", "i need a caregiver", "i need assistance", "i fell", "i can't get up", "fire"
heyPatList = "hey pat", "pat are you there", "is anybody listening", "what time is it"
speechGenderList = "female", "male"
speechRateList = "medium", "fast", "slow"
speechAccentList = "American", "British" or "Australian"
askPrompt = ""
returnLabel = ""
heardSilence = ""
falseAlarmCount = 0
askReturnValue = ""
userName = ""
moreAppInfo = ""
customizeSettings = ""
customizeLanguage = ""
customProsody = "rate=’medium’"
photoTime = ""

# Ask to install assistant

@PromptInstallAssistant

returnLabel = InstallAssistant
timeoutReturnLabel = PromptInstallAssistant
Name Speak : Pat : "Hi, I'm Pat. I'm a demonstration patient assistant from Neon AI. Thank you for helping test my conversational skills."
askPrompt = "Please tell me your name, or you can say cancel to exit."
Goto : ASK

@InstallAssistant

userName = {askReturnValue}

Name Speak : Pat : "Hi {userName}. I am glad you chose to install the Neon Patient Assistant Application."

## Offer additional information

@ReAskMoreInfo

Name Speak : Pat : "Before starting the Patient Assistant, would you like more information on the Neon conversational patient assistance application?"
timeoutReturnLabel = ReAskMoreInfo
voice_input{moreAppInfo}
if {moreAppInfo} IN {noList[*]}:
Goto: PromptCustomize

Name Speak : Pat : "Hi {userName}. I'm Pat the demonstration conversational patient assistant from Neon AI. I am an artificial intelligence personal assistant, I'm augmented with Neon Gecko open source code and CPI Corp patented technology. Neon AI makes the Patient Assistant application to enable patients to alert their caregivers to emergencies and other needs, and to get simple information. As your automated patient assistant I listen for calls for help and send alerts to the patient care administrator. For example, you can say help, or I fell. Another thing you can say is what time is it .. </speak> In the future you will be able to play your favorite music, turn the lights on or off, and even ask to send a text message .. And if you don't want to call me Pat, someday you will be able to change my name."

# Customize

@PromptCustomize

## Offer customization of settings for administrator, voice and system settings
## Set up PA voice: name, gender, accent, pitch, speed, [Later: language, diction, empathy]
## Set up system settings: timeoutSeconds (wait time for user input)
## Set up administrator (password, email, name, phone, [Later: staff names, secondary contacts] ..)
## Set up nurse (password, email, name, phone, [Later: staff names, secondary contacts] ..)

Name Speak : Pat : "Would you like to customize the Patient Assistant settings for my voice?"
# Name Speak : Pat : "Would you like to customize the Patient Assistant settings for administrator, voice and PAT system settings?"

timeoutReturnLabel = PromptCustomize
voice_input{customizeSettings}
if {customizeSettings} !IN {yesList[*]}:
Goto: BeginAssistant

Name Speak : Pat : "Hi {userName}. You can customize the voice for the Neon demonstration conversational patient assistant. You can say no change, or say female, male, normal, fast, slow, American, British or Australian. </speak> In the future you will be able to set up information for the administrator, staff members and the patient, and change my name and other PAT system settings."

@ReAskCustomize

# Name Speak : Pat : "Would you like to change the voice of the Neon conversational patient assistance application?"

timeoutReturnLabel = ReAskCustomize
voice_input{customizeSettings}
if {customizeSettings} == "":
Goto: PromptCustomize
if {customizeSettings} CONTAINS "no change":
Goto: BeginAssistant
if {customizeSettings} IN {noList[*]}:
Goto: BeginAssistant

customLanguage = ""

# Variable: britWords = british, gb, uk
#if {customizeSettings} CONTAINS "British":
if {customizeSettings} CONTAINS british, gb, uk:
customLanguage = "'en-GB'"
else
if {customizeSettings} CONTAINS "Australian, AU, aussie":
customLanguage = "en-AU"
else
customLanguage = "en-us"

if {customizeSettings} CONTAINS "female":
customLanguage = “{customLanguage} female"
else
customLanguage = “{customLanguage} male"

Language: {customLanguage}

if {customizeSettings} CONTAINS "fast":
customProsody = "rate='fast'"
else
if {customizeSettings} CONTAINS "slow":
customProsody = "rate='slow'"
else
customProsody = “rate=’medium’”

# Later: Provide example of new Language/Prosody and offer reset

# Later: Make settings into a case statement and error check:
# split_words(wordList, customizeSettings)
# customSettingCount = length({wordList})
# wordListIndex = 0
# LOOP
# Case
# LOOP END

@BeginAssistant
timeoutReturnLabel = WaitForAlertPhrase
Name Speak : Pat : "<prosody {customProsody}> Your demonstration patient assistant has signed in. You can say, hey Pat, or, Pat are you there, if you want to know if I am listening. </prosody>"

# Wait for alert

@WaitForAlertPhrase

askPrompt = ""
returnLabel = GotPatientPhrase
### Name Speak : Pat : "PA 1 pre ask"
Goto : ASK

@GotPatientPhrase
## Did patient ask for "help"
if {askReturnValue} !IN {alertsPhraseList[*]}:
### Name Speak : Pat : "PA 4 not an alert, listen again"
Goto: WaitForAlertPhrase

# Possible EMERGENCY

Name Speak : Pat : "PA 5 got alert, about to reconvey {askReturnValue}"
Reconvey : askReturnValue
Name Speak : Pat : "PA 6 did reconvey"

@PromptConfirmHelp

askPrompt = "Please say just kidding if this is not an emergency"
returnLabel = ConfirmHelp
### Name Speak : Pat : "PA 7 about to ask to cancel help request"
Goto : ASK
@ConfirmHelp

### Name Speak : Pat : "PA 8 check for jk"
## Did patient REALLY ask for "help"?
if {askReturnValue} == "":
Name Speak : Pat : "Pat the Patient Assistant heard nothing."
Name Speak : Pat : "PA 7 got alert, about to reconvey of heard nothing {askReturnValue}"
Reconvey : askReturnValue
Name Speak : Pat : "PA 8 did reconvey of nothing?"
## PA heard nothing after emergency request .. if second time then this is an emergency
if {heardSilence == "TRUE"} :
Goto: Emergency
heardSilence = "TRUE"
## LATER: Increase volume, speak slower
Name Speak : Pat : "{userName}! I need to hear from you! Is this an emergency?"
Goto: PromptConfirmHelp
if {askReturnValue} CONTAINS "just kidding", "never mind","not an emergency":
Name Speak : Pat : "Pat the Patient Assistant heard you say this is not an emergency."
Reconvey : askReturnValue
Name Speak : Pat : "Please say help again if this is an emergency."
### Name Speak : Pat : "PA 9 jk so restart listening"
Python: falseAlarmCount = {falseAlarmCount} + 1
Goto: WaitForAlertPhrase

# EMERGENCY

@Emergency

Name Speak : Pat : "This is an EMERGENCY"

Name Speak : Pat : "Pat the Patient Assistant would now send an emergency alert, keep engaged with the patient, and send updated alerts to the caregiver."

Name Speak : Pat : "Pat test completed. Say start again to start again?"
voice_input{askReturnValue}
### Name Speak : Pat : "PA 10 check for restart request"
if {askReturnValue} == "start again":
### Name Speak : Pat : "PA 10 restarting"
Goto: StartUp

Name Speak : Pat : "Pat exiting"
exit

# ========== Subroutines

@ASK
# The ASK subroutine speaks the askPrompt and waits for a response. If the response is a command to Pat to perform an action, then the request is effected and Pat continues waiting for a response, otherwise, the response is returned to the caller in the askReturnValue.
# Input parameters: askPrompt, returnLabel and timeOutReturnLabel
# Result parameter: askReturnValue

### Name Speak : Pat : "Ask 1 Starting"
if {askPrompt}:
Name Speak : Pat : " {askPrompt} "
### Name Speak : Pat : "Ask 2 Starting ask subroutine"
voice_input {askReturnValue}
### Name Speak : Pat : "Ask 3 got input"
if {askReturnValue} IN {exitList[*]}:
Name Speak : Pat : "Say yes to confirm exiting Pat, the Neon AI Patient Assistant"
voice_input{askReturnValue}
if {askReturnValue} IN {yesList[*]}:
Name Speak : Pat : "Pat, the Neon AI Patient Assistant, signing off"
exit
else
goto: ASK
### Name Speak : Pat : "Ask 4 not cancel command {askReturnValue}"
if {askReturnValue} IN {heyPatList[*]}:
Name Speak : Pat : "<prosody {customProsody}> {userName}, Pat the AI Patient Assistant demo here. I'm listening all the time but I don't <phoneme alphabet=”x-sampa” ph=”rikord”>record</phoneme> everything you say. I only make recordings of calls for help or in an emergency. </prosody>"
# Note - Disambiguation for the pronunciations of "record": <phoneme alphabet=”x-sampa” ph=”rikord”>record</phoneme> Verb as in “I record everything you say” vs. Noun as in "Make a record of the conversation".
Name Speak : Pat : "The time is"
Execute : "Neon what time is it"
if {falseAlarmCount} != 0:
Name Speak : Pat : "The false alarm count is {falseAlarmCount}!"
goto : ASK
### Name Speak : Pat : "Ask 5 About to return to {returnLabel}"
Goto: {returnLabel}


@TIMEOUT
Goto: {timeoutReturnLabel}

Author

jsh r
{Empty}
{Empty}