Microsoft

Update: This blog was last edited on 5/24/2020. We are continuously working on updating the blog with the latest modifications to Healthcare Bot Service. 

 

Why the Healthcare Bot Service?

The Healthcare Bot Service is an AI-powered, extensible, secure and compliant healthcare experience. Microsoft now has a specific template pre-built for COVID-19 Assessment. It takes inbound requests, asks about the patient’s symptoms, and assists in getting people access to trusted and relevant healthcare services and information based on the CDC recommendation.

teaserImage0524020.png

 

We will take you step-by-step through the following, so that you can deploy the health bot with ease:

  1. Configuration
  2. Design and Coding
  3. Creating a Web Chat Channel
  4. Embedding Web Chat in a Web Page
  5. Enhancing COVID-19 bot with CDC-approved FAQ template

  6. Viewing world-wide metrics with COVID-19 Metrics template

Configuration

 

1. Login to https://portal.azure.com and search For “Microsoft Healthcare Bot” in the Azure Marketplace.

marketplace.png

 

2. Enter the required details and click “Subscribe”. You can start with the W1 – Free plan and update Plan later.

subscribe.png

   

3. On successful deployment, Go To Resource and click Configure Account. Verify details and click Create. You will be redirected to the Healthcare Bot Service admin portal. Once configuration is done, you will see this home page. Click "Open scenarios  template catalog” in blue.

3.png

   

4. Select “COVID-19 Assessment” from the pre-built templates. Then specify the name and click "Import Template".

templatecatalog.png

      

5. Once you import the scenario, it will appear in the “Manage” tab under “Scenarios” on the left-hand toolbar. Click on the name of the template to take you to the visual designer.

scenario1.png

Design and Coding

 

The relevant code is in Javascript, so if you are familiar more with the code, you can click the “Code” tab on the bottom left.

jscode.png

 

Click back to the “Designer” tab. It has a Visio-style look, but with programming capabilities. At the top, you can see the range of scenario elements. You have the ability to insert prompts (represented in green), if/else decision (represented in yellow), or add statements to print out messages (represented in blue). There are many different types of scenario elements, and more details that Microsoft documents here so that you can customize further.

designer1.png

 

If you click “Run” at the top, it will only run the current scenario in a debug mode. Below is how it looks after the run, asking you a set of questions on the right.

designer2.png

 

As you answer the series of questions in the chat on the right, you can see that it’s corresponding with the logic on the left hand side. For example, if you click on the “Symptoms” prompt, it’s highlighted in green on the left and reflected in the chat on the right.

designer3.png

 

After the questions are answered, the bot classifies patients based on the logic. In this example, if you’re classified as a high-risk patient, the bot reads a Developer Notice, prompting users to configure Handoff conversations to live agent. You can have different end results, such as - a link to virtually schedule an appointment, a connection to a virtual agent, or a link to a virtual physician visit. All of these endpoints can be customized.                 

designer4.png

 

For customizing further, including Handoff to Microsoft Teams and integration with FHIR API, see the resource appendix at the end of this article.

 

Creating the Web Chat Channel

 

1. Go back to the Health Bot Service, select "Integrations" and click "Secrets".

Integration.png

 

2. Webchat_secret allows you to connect the bot to a web page, just like Azure Bot framework. The web chat channel is enabled by default. Copy the webchat_secret and the app_secret. More details here on embedding your health bot into your app via web chat.

secrets.png

 

3. To deploy web chat to Azure, go to Github repository linkClick “Deploy to Azure”. 

deploytoazure.png

 

4. Provide required details and use the App Secret and Web chat secret copied in previous step. Click Next. This deploys an app service that will host the healthcare bot. 

deploytoazure.png

 

5. Go back to your Azure portal and click on the Resource group that you created/chose in previous step. The deployment steps creates two services in this resource group: an app service and an associated app service plan.

resourceGroup.png

 

6. Next, you will need to edit the index.js file in the app service. Depending on your choice of Operating System in the previous step, follow steps below:

 

For Windows OS: Click on the App Service. On the left pane, look for Development Tools -> App Service Editor (Preview). Click Go. In the App Service Editor screen, Click on Explore -> WWWRoot -> public/index.js file. Scroll down to line 107, remove the comment symbols /* and */ from lines 108 and 116. Change trigger in line 110 to trigger: “covid19_assessment”

 

For Linux OS: Here, we describe 2 methods. Method 1 uses SSH and VI if you are comfortable with those tools. The second method uses VS Code, which is a modern IDE.

 

Method 1: Click on App Service. On the left pane, scroll down to Development Tools -> Advanced Tools -> Click 'Go' -> SSH -> Type vi to edit the public/index.js file. Make necessary changes to trigger a COVID-19 Assessment scenario.

 

Method 2: For VS Code, install and connect using the first section of instructions here. Once connected to Azure, locate your app service, and find the public/index.js and edit the trigger to reflect your scenario_ID = covid19_assessment and remove the comment lines (/*) at lines 108 and 116:

110 and 118.jpg

sambrown_0-1586304484843.gif

7. If you want to remove the text input box, change from "false" to "true" on line 89:

2.PNG

If it's your first time using VS Code, check out this video that walks you through downloading it, locating the Azure app service, and editing a sample file:

 

 

8. Once that's done, we are ready! Click “Run” in App Service Editor or copy the Azure App Service URL in a new browser window and you will get this Azure website.

webchat.png

 

9. There are many front-end UI changes that might be required to customize UI of the bot. Typical examples include: add bot avatar, delete text entry, add close/refresh button, disable previous user selections, not display user selection in assessment scenario etc. If you choose to deploy web chat framework v4, the front-end changes follow standard web development practices. More details on UI customizations can be found at this link.

 

For using Twilio channel for SMS messaging, see the resource appendix at the end of this article.

 

Embedding a Web Chat into a Web Page

 

1. This Azure website hosting the web chat channel has to be embedded into a web page. See the sample website below, this is an example of a public facing website.

site.PNG

2. Open visual studio for the code. Embed an iFrame as a tag. The source is the app service that is hosting the health bot. Front-end developers can then play around with this code.

last2.png

 

3. If you click the COVID-19 info button, you want the web chat to pop up like this to start the triggered scenario. Now you know how to get the health bot on the web page!

contosowebsite.png

 

Enhancing COVID-19 bot with CDC-approved FAQ Template

 

The COVID-19 FAQs template has 200+ QnA pairs and answers frequently asked questions based on CDC's COVID-19 website. DISCLAIMER: This template has been created using current information about COVID-19 from the Centers for Disease Control (CDC) and is updated to the date of importing.

 

1. Login to health bot admin portal. Navigate to Scenarios -> Template Catalog. Click on COVID-19 FAQs template and import the template by providing a QnA Maker subscription key. If you do not have a QnA Maker service provisioned, create one on Azure portal.

faqtemp.png

 

3. Once the import succeeds, navigate to Scenarios -> Manage. You can see the scenario here.

scenarioman.png

 

4. If you drill down to see it in Visual Designer, you will see that the code here fetches results from the language model of this custom QnA Maker and adds the source name. See below for how it displays to the user:

userdisplay.png

 

5. Importing the FAQ template also creates a language model in Language -> Models page at the end. The Update button helps you to retrain data in knowledge base created on importing this FAQ template.

faqmodel.png

 

6. The import template creates a scenario, it’s underlying language model as seen above and a Knowledge Base "Healthcare Bot COVID-19 CDC" in the Azure QnA Maker service using the subscription key provided during import step. More information on updating knowledge base can be found here.

language model.png

 

7. Now, we are ready to test the FAQ scenario! Test it here in the in-house chat control as shown below, or test it on the public website. Note: You do not need to write a custom scenario to bring the two models (COVID-19 Assessment and COVID-19 FAQ) together. FAQ model will be available as a top level scenario by default.

chatcontrol.png

 

 

Viewing world-wide metrics with COVID-19 Metrics template

 

The COVID-19 Metrics template can provide up-to-date metrics on COVID-19 cases around the world. Below are some example questions that you can ask the bot about reported cases:

  • How many cases have been reported worldwide?
  • What is the coronavirus situation in United States?

DISCLAIMER: This COVID-19 Metrics template leverages an external data source provided by the ArcGis API. Users are responsible for complying with any terms and conditions required by the entities licensing the external data source. Microsoft is not responsible for the performance, accuracy or results from the use of the template.

 

1. Go back to the Scenario Template Catalog and click on COVID-19 Metrics template. Provide LUIS Prediction Key. PREREQUISITE: Create an Azure LUIS cognitive service prediction resource to access the COVID-19 Metrics natural language understanding (NLU) model.

luis.png

 

3. Once imported, it will appear in Scenarios -> Manage tab as seen below:

metrics.png

 

4. Click on it to go to the Visual designer. Let’s say you enter: "How many confirmed cases in Italy?". See example answer below.

italy.png

 

Resources for Customizing Further

 

 

 

* For a comprehensive overview of Microsoft services and tools for Crisis Management, Business Continuity, and Patient Outreach see “Situational Response Management, Communications, and Virtual Patient Outreach – Webcast Recording
 

Thanks for reading and let us know how else we can help!

 

nikita.jfif

Nikita Pitliya, Microsoft Cloud Solutions Architect

 

sam.jfif

Sam Brown, Microsoft Teams Technical Specialist

 

17 Comments

Just deployed this to test. Current code in the template is different from code above. On the trigger code, there are some additional modifications to make. my final code looks like this.  Note the /* should be removed. in the name of the trigger, add the scenarioID of the bot, not the Name.

 

bot code.png

Microsoft

Thanks @David Hanna (TSP) for the feedback! You're right, the template code changed from this weekend. The screenshots are updated now!

Microsoft

Hi guys,

 

Awesome work! thank you for sharing. I tried deploying the tool from the marketplace and I keep getting this error:

 

Something went wrong while deploying the SaaS resource 'USEduCSAHealthcareBot'. Details: "This operation has failed due to internal error. Please retry. If error persists, contact support."
 
Any ideas?
 
Ana
Occasional Visitor

Is this available in the GCC?

Regular Visitor

The catalog in your doc says select COVID-19 Response.  I think this is now renamed to COVID-19 Assessment.  Are they the same?  
Also, the flow is not exactly the same as the one on the CDC site.  Is the one MS is managing for CDC changing more frequently?  

Microsoft

Thanks @normkatz! Our engineers are working hard to keep improving these templates during these times, and we just updated the post accordingly. To be clear, there are three templates available now for COVID-19: Assessment, FAQs, and Metrics. We updated the old "Response" template screenshots with the new "Assessment" template screenshots and we have two new sections for you: FAQs and Metrics! Stay safe and keep the feedback coming.

Established Member

Hi Nikita, 

Awesome work! thank you for sharing and helping me.

 

I have followed the steps and deployed it. I have used all three templates (COVID-19: Assessment, FAQs, and Metrics). Also, I have integrated it with MS Teams.

 

Microsoft

Thanks @Laxmi_yad for your feedback. Glad to connect with you on this project and congrats on the great progress integrating all COVID-19 templates with Teams. 

Occasional Visitor

I'm impressed with this bot platform. We are building out bots with code only in Bot Framework, but this interface looked really good so I wanted to check it out. Is this something we will eventually have access to for building our own bots? We've checked out Power Virtual Agents but that does not align well with our requirements. I was quite impressed with the suite of features provided with this bot, such as the visual builder and integrated reporting, and would love to be able to implement some of these things for our other bots.

 

Specifically, I was impressed with the transcript storage and retrieval. It is much more robust than anything I have been able to figure out for our bots. Would you be able to share more information on how this was implemented and if it is possible to do the same sort of thing via Bot Framework proper?

Occasional Visitor

Thank you, great outline; however, when I run the app it does not work.  What are the args for

  triggeredScenario: {
                                trigger"{covid19_assessment}"
                                ,
                                args: {
                                    myVar1"{custom_arg_2}"
                                    ,
                                    myVar2"{custom_arg_2}" 
                                }
 
It should have been -  trigger"covid19_assessment".  Working now.
                            }
Microsoft

Hi, these Bots recognize language (could they work when someone type something en spanish?) or only work in english?.

Occasional Visitor

I tried the following sample shown above. The trigger code shown in the given sample is not working for me. I tried to give the scenario_id name in "trigger" but whenever i start I had to manually type by "begin scenario_id".

Here is the screenshot of the code that i have modified:

Scenario_capture.PNGscenario_capture2.PNG

Microsoft

Hi @Sudip_Viper it looks like you are adding {scenario_id}. You will need to remove the curly braces.

Frequent Visitor

I am trying to use Twilio channel to run the assessment scenario but it always goes to FAQ scenario since its setup as top or default. How can I switch to assessment scenario from Twilio and do assessment via SMS?

Senior Member

Does anyone have any data on the number of "messages" a typical bot session consumes? We have another bot in use and know how many daily sessions we're getting, but need to budget if we're going to make the switch.

 

Thanks,

Ed

Frequent Visitor

@edduncan : It depends... for covid-19 assessment it takes about 20 messages per session because there are about 10 (input+response=20 messages)  questions in the assessment scenario. Microsoft Healthbot has published their rates here [ pricing ] so basic one is 10,000 messages per month is for 500$ and it goes up from there. Hope this helps.

Frequent Visitor

Are there more detailed instructions or a video explaining the setup for using a Azure SQL Database? I am having issues building and publishing the code found on github. I am getting all sorts of build errors using VS 2017 

 

Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) BackToWorkFunctions I:\covid19-BackToWork-master\AzureFunctionsCodebase\SelfMonitoring\GetLabTestInfo.cs 4 Active

 

Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'HttpTriggerAttribute' could not be found (are you missing a using directive or an assembly reference?) BackToWorkFunctions I:\covid19-BackToWork-master\AzureFunctionsCodebase\SelfMonitoring\GetLabTestInfo.cs 25 Active

 

Severity Code Description Project File Line Suppression State
Error CS0103 The name 'AuthorizationLevel' does not exist in the current context BackToWorkFunctions I:\covid19-BackToWork-master\AzureFunctionsCodebase\SelfMonitoring\GetLabTestInfo.cs 25 Active

 

Severity Code Description Project File Line Suppression State
Warning CS8032 An instance of analyzer Microsoft.EntityFrameworkCore.InternalUsageDiagnosticAnalyzer cannot be created from C:\Users\kenne\.nuget\packages\microsoft.entityframeworkcore.analyzers\3.1.3\analyzers\dotnet\cs\Microsoft.EntityFrameworkCore.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. BackToWorkFunctions I:\covid19-BackToWork-master\AzureFunctionsCodebase\SelfMonitoring\CSC 1 Active

 

Severity Code Description Project File Line Suppression State
Warning IDE1003 Analyzer assembly 'C:\Users\kenne\.nuget\packages\microsoft.entityframeworkcore.analyzers\3.1.3\analyzers\dotnet\cs\Microsoft.EntityFrameworkCore.Analyzers.dll' depends on 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' but it was not found. Analyzers may not run correctly unless the missing assembly is added as an analyzer reference as well. BackToWorkFunctions 1 Active

 

Severity Code Description Project File Line Suppression State
Warning NU1701 Package 'Microsoft.AspNet.WebApi.Core 5.2.7' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. BackToWorkFunctions I:\covid19-BackToWork-master\AzureFunctionsCodebase\SelfMonitoring\BackToWorkFunctions.csproj 1