Insights

The Covid-19 Chatbot

The Covid-19 Chatbot main image

Introduction

The Emergent Alliance aims to assist you in tackling and responding to the Covid-19 crisis with useful insights and applications [1]. Within the Alliance, the Regional Risk Pulse Index (RRPI)  Team [2] has made significant progress in tracking and quantifying the social and economic effects of the Covid-19 pandemic, and as our findings grow, we want to ensure that everyone can easily interact with our findings and data. To improve this accessibility, we have built a Chatbot as an alternative medium that enables you to easily access our data via a simple conversational interface (see Figure 1). Ask the Chatbot your Covid-19 and travel-related questions, and the Chatbot will respond to you with insights and analysis developed by our Team.

A preview of the Covid-19 Chatbox

Figure 1: Chatbot User Interface

How the Chatbot can help you

Our Chatbot can provide you with: travel advice for international travel and domestic travel within the UK; information regarding virus hotspot areas in the UK; the lockdown status of countries; and general information regarding the number of Covid-19 cases/deaths and fatality rates across the globe (see Figure 2). The responses provided by the Chatbot are informed principally by analysis and datasets created by the RRPI Team (Hotspots, Risk Index, and Travel Restrictions) and by an open data source, the Oxford COVID-19 Government Response Tracker (OxCGRT). All of which are stored in IBM’s Db2 Warehouse dedicated to Alliance.

An image of the information resources

Figure 2: Four Information Resources

Hotspots

The Hotspots dataset, developed by the RRPI Team, provides information about regions in the UK that are identified as Covid-19 ‘Hotspots’. The methodology applied divides regions into five categories including high-high (HH), low-low (LL), high-low (HL), low-high (LH), and Not Significant. Where a HH region has a high incidence of covid-19 cases and its surrounding areas also have a high incidence of covid-19 cases. In contrast to an LL region which has a low incidence of covid-19 cases and its surrounding areas also have a low incidence of covid-19 cases. Based on this methodology, the Chatbot will tell you what regions in the UK are hotspots.

Sample question:
What areas in the United Kingdom are hotspots for Covid-19?
Sample answer:
Currently, there are 92 hotspots in the UK. Some of them are Medway, Wolverhampton, North Tyneside, Wigan, Havering. Are you looking for a specific region?

Regional Risk Index

The Chatbot provides advice for domestic travel within the UK. This advice is based on the Regional Risk Index, developed by the RRPI team, which provides a score from 0 to 100, to indicate how critical a region is in a given point in time. The Risk Index is a composite index, that combines the predicted number of Infections with additional factors such as population density, the vulnerability of the population, and more. For more information on this data, please click here.

Sample question:
Should I travel to Manchester?
Sample answer:
It is not recommended to travel to Manchester as it is a High-Risk Area. For more information regarding travel restrictions please check GOV.uk

International Travel Restrictions

The Travel Restrictions dataset provides entry restriction information for travelling between two countries. The restriction information is extracted using Natural Language Processing (NLP) on data collected from various sources [4][7]. The text data is analysed and classified into one of three restriction levels: No Restriction, Partial Restriction, and Travel Ban. In addition to this information, the Chatbot also provides users with useful links to websites with further information. For more details on the data sources used and analysis conducted to develop the Travel Restrictions dataset, please click here.

Sample question:
Can I travel to Germany from Ireland?
Sample answer:
There are some restrictions applied regarding travelling to Germany from Ireland. Please check the following links for more information.
For more information: German Foreign Ministry

Covid-19 numbers and lockdown measures

The latest Covid-19 figures were taken from the Oxford Covid-19 Government Response Tracker (OxCGRT), an open data source that provides the latest number of Covid-19 cases and deaths for more than 180 countries. OxCGRT also provides information on international lockdown measures [5].

Sample question 1:
How many Covid-19 cases were recorded in Spain?
Sample answer 1:
The confirmed covid-19 Cases for Spain, are 2176089. (Last update: yyyy-mm-dd)

Sample question 2:
What are the lockdown restrictions in Spain?
Sample answer 2:
The lockdown measures recorded in Spain are Workplace closing, Cancellation of public events, Restrictions on gatherings, Stay at home requirements, Restrictions on internal movement and International travel controls.

Methodology and Architecture

To build the Covid-19 chatbot we used IBM’s Watson Assistant development platform [6]. IBM Watson Assistant helps you to easily build a Chatbot that has three main components: the user interface, the DB2 Warehouse where our data is stored, and the API server which connects the Chatbot processes.

Figure 3 shows the different processes in the Covid-19 Chatbot that communicate with each other to provide the user with the appropriate information and insights. The Watson Assistant Service (Chatbot) uses Natural Language Processing (NLP) to identify the user’s intent, and uses API callouts (with Webhooks) to the API server. The API server pulls the appropriate data from the Db2 Warehouse, processes it accordingly and sends the data back to the Chatbot to respond to the user.

Flow of Chatbot Processes

Figure 3: Flow of Chatbot Processes

Building the Dialog

To build a Chatbot using IBM Watson Assistant, there are three main components:

  1. Intents: Intents enable the Chatbot to understand the user’s goal and what they want. By recognizing the intent expressed in a user’s input, the Chatbot can choose the correct dialog flow for responding to it.The prefix ‘#’ is used to define an intent such as #greetings or #travel_advice. For each intent, we train the Chatbot with a few examples of how that intent could be expressed by the user. For example, for the intent #greetings, we can provide examples such as ‘Hey’, ‘Hi there’, or ‘Hello how are you?’. Then once trained, the chatbot uses NLP to identify the intent of a user’s query.
  2. Entities: Intents are not always enough to understand the full context of a user’s request. Therefore, additional information relating to the user’s intent, known as ‘entities’, may be required.The prefix ‘@’ is used to define an entity, such as @area_name or @country. An example question relating to the intent #infection_risk could be, ‘What is the risk of infection for <area name>?’. In this example, the value @area_name can change depending on what the user wants. For example, a user may want the risk of infection in ‘Middlesborough’ and another user requires information for ‘Bristol’. Unlike intents, Watson Assistant is not trained on entities. Instead, entity values are entered manually or through CSV files.
  3. Dialog: The dialog is made up of a collection of nodes, where each node handles a specific conversation topic. For example, our ‘Covid-19 Numbers’ node handles the conversation relating to the number of people infected with Covid-19 in different countries. The intents and entities identified in a user’s input trigger a node that enables the Chatbot to interact with the user and respond to their query. The way the Chatbot triggers a particular node is by using a logical expression. If Chatbot recognizes a condition based on #intents or @entities, it triggers the node, as described in Figure 4.
Single Node with Logical Expression

Figure 4: Single Node with Logical Expression

If a single node is not enough to handle a user’s query, we can add child nodes based on additional conditions which must be met.

Child Nodes within a Node


Figure 5: Child Nodes within a Node

There are additional features offered by Watson Assistant which enhance the capabilities of the dialog. Adding Slots to a dialog node enables the Chatbot to gather multiple pieces of information from a user within that node [8]. Digression allows the user to switch between different topics. Webhooks allow the Chatbot to make API calls to gather further information to respond to the user’s query.

Dialog Flow diagram

Figure 6: Dialog Flow

The below table is a sample of six Covid-19 Chatbot nodes, showing how the dialog components connect together for each node.

A table of dialog components

Table 1: Dialog Components

Chatbot Backend

To build a Chatbot that can extract real-time information from our database, we developed an API Server that the Chatbot can interact with using a webhook. A Webhook is a mechanism that, when triggered, sends an HTTP POST request containing variables gathered from the user’s input, to our API Server which performs the appropriate logic/functions and returns a response to the Chatbot.

To build the API Server we used an open-source framework called FastAPI, which is a high-performance web framework for building APIs using Python. To deploy the API Server in an easy and scalable way, we chose to containerize it using Docker and deploy it on a bare metal.The code is published on GitHub.

Conclusion

In this blog, we have presented our work to date to develop a Chatbot that is capable of responding to your covid-19 and travel-related questions. Going forward, we aim to expand the range of Covid-19 related topics that the Chatbot can discuss as our data and insights grow. 

The Chatbot is hosted on the Emergent Alliance website and is currently in Beta stage, so we would appreciate any feedback you have which would enable us to continuously improve the Chatbot. If you wish to contribute to the development of this Chatbot, please provide feedback on the Emergent Alliance website or directly through the Chatbot by typing ‘feedback’.

References

[1] Emergent Alliance.org. (2020) Emergent Alliance. [online] Link: https://emergentalliance.org/  [Date Last Accessed: 12 January 2021].

[2] Emergent Alliance.org. (2020) The Predicted Regional Risk Index – Emergent Alliance. [online] Link: https://emergentalliance.org/?p=1815  [Date Last Accessed: 12 January 2021].

[3] Emergent Alliance.org. (2020) Challenge: Regional Risk-Pulse Index – Forecasting & Simulation – Emergent Alliance. [online] Link: https://emergentalliance.org/?page_id=1659  [Date Last Accessed: 12 January 2021].

[4] WFP – World Food Programme. COVID-19 global travel restrictions and airline information. Humanitarian Data Exchange. https://data.humdata.org/dataset/covid-19-global-travel-restrictions-and-airline-information. [Date Accessed: Daily]. License: Creative Commons Attribution International

[5] Thomas Hale, Sam Webster, Anna Petherick, Toby Phillips, and Beatriz Kira. (2020). Oxford COVID-19 Government Response Tracker. Blavatnik School of Government. Link: https://www.bsg.ox.ac.uk/research/research-projects/coronavirus-government-response-tracker  [Date Accessed: Daily]. Data License: https://github.com/OxCGRT/covid-policy-tracker/blob/master/LICENSE.txt 

[6] Ibm.com. Watson Assistant – Overview. [online] Link: https://www.ibm.com/cloud/watson-assistant [Date Last Accessed 12 January 2021].

[7] Emergent Alliance.org. (2020) Information Extraction From Travel Restrictions Data – Emergent Alliance. [online] Link: https://emergentalliance.org/?p=1932  [Date Last Accessed: 12 January 2021].

[8] Ibm.com. Gathering information with slots. [online] Link: https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-slots [Date Last Accessed: 18 January 2021]. 

Disclaimer: This is an ongoing project (beta version) that is continuously updating. This project is for research purposes only. The authors are not responsible for any wrong information provided by the Chatbot during the Beta stage of development.

Authors

Giorgos Aniftos is a Machine Learning Engineer at IBM

Elaine Begley is an Artificial Intelligence Developer at Rolls-Royce plc

Ananda Pal is a Data Scientist and Performance Test Analyst at IBM

Special thanks to Amritpaul Sohal (who developed the chatbot as part of our team), Klaus Paul, Mehrnoosh Vahdat, Sarah Boufelja, Shri Nishanth Rajendran, Erika Agostinelli, and Sarah Packowski who helped and inspired us in our work. 

We are a team of data scientists from IBM’s Data Science & AI Elite Team, IBM’s Cloud Pak Acceleration Team, and Rolls-Royce plc R² Data Labs working on Regional Risk-Pulse Index: forecasting and simulation within Emergent Alliance. Have a look at our challenge statement!


Fatal error: Uncaught Error: Call to undefined function WP_Optimize() in /var/www/wp-content/plugins/wp-optimize/cache/file-based-page-cache-functions.php:178 Stack trace: #0 [internal function]: wpo_cache('<!doctype html>...', 9) #1 /var/www/wp-includes/functions.php(5107): ob_end_flush() #2 /var/www/wp-includes/class-wp-hook.php(303): wp_ob_end_flush_all('') #3 /var/www/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array) #4 /var/www/wp-includes/plugin.php(470): WP_Hook->do_action(Array) #5 /var/www/wp-includes/load.php(1097): do_action('shutdown') #6 [internal function]: shutdown_action_hook() #7 {main} thrown in /var/www/wp-content/plugins/wp-optimize/cache/file-based-page-cache-functions.php on line 178