Exercise 3 - Test the medical insurance policy information request service from IBM Watson Assistant
With the record and process definitions built for this service, the next step is to see how to create Watson Dialogs to invoke the Get Country HR Source Data process.
Intent:
From IBM Watson select the HR Chatbot skill and go the Intents section. The #BMC_medicalInsurancePolicyInformation, intent was created for this service. The intent comes with 22 values or utterances.
For more information about these values review them using your IBM Watson Assistant instance where this service has been published to, because we have not documented every aspect of the intents here.
Tip: The number of Intent utterances will vary based on the use case. In this use case, the main goal is to request for Medical Insurance Policy information for your country. The following are some sample intent utterances that can be used to build out the Intent values:
- Can I get information about massage therapy coverage
- Can I get information about my insurance
- Can I get information about physio coverage
- Can I get information about vision care coverage
- I need information about health coverage for Canada
- I need information about health coverage for France
- I need information about health coverage for Germany
- I need information about health coverage for India
- I need information about health coverage for South Africa
- I need information about health coverage for the United Kingdom
- I need information about health coverage for the United States
- I need information about my dental plan
- I need information about my drug plan
- I need information about my health benefits
- I need information about my medical benefits
- I need information about my vision benefits
- I need information regarding my medical insurance policy
One point to notice here is the use of different country names within several of the Intent values. When such a pattern emerges, you can define an annotation-based entity that will allow Watson to recognizing entities (words with special meaning) by their context in a sentence. In our example, we will annotate the Country Names within a new entity, @bmc_country, created for this purpose, as shown below. This simply means that Watson will assume the annotated entity to be a country when it matches the intent pattern, e.g. I need information about health coverage for @bmc_country annotations
For more information regarding annotation, please refer to the following link: [https://cloud.ibm.com/docs/assistant?topic=assistant-entities#entities-annotations-overview
https://cloud.ibm.com/docs/assistant?topic=assistant-entities#entities-annotations-overview]
|
@sys-date:
- This is System entity. For more information regarding this system entity please refer to the following link: https://cloud.ibm.com/docs/assistant?topic=assistant-system-entities#system-entities-sys-date-time
Dialog Nodes:
Tip: When creating a new service that was not created using the Chatbot publishing wizard it is recommended to copy an existing dialog node that is like your service use case, to get the needed JSON content. (Note: you can use the dialog nodes that come with this starter kit for this purpose)
In HR Chatbot skill go to the Dialog section and look for the BMC - Medical Insurance Policy Information dialog, that is our parent dialog of this service. We have added the #BMC_medicalInsurancePolicyInformation intent in the condition, so that when Watson identifies this intent the parent dialog for this service gets triggered.
One difference that you will see here is we don't have any questionnaire for this service. If user doesn't enter any country name on the Chatbot UI, then the requester's Innovation Studio Foundation data country is used.
Next, we will look at the JSON created for this service. From the BMC - Medical Insurance Policy Information dialog node, click on the three vertical dots as seen from the highlighted section in the screenshot below.
Under context section you will see few a variable that are initialized.
- "bmc_hr_year": "<? @sys-date ? @sys-date.substring(0,4) : null ?>" We don't need year for this service but remember we use the same process for the Holiday List service as well. If you want to use year and do some processing, then you will have year in process without making any changes in Watson.
- "bmc_hr_country": "<?@bmc_country ? @bmc_country.values.join(' ') : $chatbot_country?>" Here we set country in the $bmc_hr_country variable. If country is specified in the user text then its extracted and stored, otherwise foundation country, which is in $chatbot_country variable, is stored into $bmc_hr_country. @bmc_country.values returns an array , the join function is used to display the two name element values from the array as a String.
- "bmc_hr_activity": "Medical Insurance Policy" We have set the activity value to the $bmc_hr_activity variable. The same value is used to compare with the Record entry activity field in the process.
Under the action section of the JSON you will see the following:
- inputMap: this is where we define the mapping between the process input variables, represented using their field IDs, to the Watson context variables
- outputMap: this is where we define the mapping between the process output variable, represented using their field IDs, to the Watson context variables
- processDefinitionName: this is where we define the process that will be executed from Innovation Studio for this service. When the process in the output action map is executed, the process result is embedded in the user message and sent to the user. If you want to return a process result to Watson for validation or conditional child dialog execution, you must use "waitForActionExecution": true in the output action map.
When status of the process is "Success", and a URL was found, the chatbot will display the message, "Here is a link I found for <a href="<? $bmc_hr_url ?>">Medical Insurance Policy<a> information for $bmc_hr_country."
In the message above, since we want to display a hyperlink for the policy document, we used html <a> tag.
$bmc_hr_country and $bmc_hr_url variables will be replaced with actual values. If we don't get that URL from process, then we show the message,
"I could not find any information regarding medical insurance policy for $bmc_hr_country." message to End user.