paint-brush
Our Hospitals Are Overrun: How We Made a COVID-19 Bot to Help Outby@andy_tom
335 reads
335 reads

Our Hospitals Are Overrun: How We Made a COVID-19 Bot to Help Out

by AndyApril 4th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In British Columbia, Canada, it takes over 24 hours to receive a generic response from a human operator. A chatbot is a practical application because this task is repetitive and follows a sequential set of rules. With a few tweaks, this could be applied to NSW (where I reside). The following section is for those interested in the technology and problems faced in our solution. If you are not interested in this, please scroll to the end where you can find out how you can help fight COVID-19.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Our Hospitals Are Overrun: How We Made a COVID-19 Bot to Help Out
Andy HackerNoon profile picture

COVID-19 Prescreening SMS Bot

Problem, Objective and Solution write up courtesy of Oliver.

Problem:

Existing health services are overwhelmed by inquiries (online and web inquiries, call centers, ER visits, in-person GP visits).

Many are false positives (A person may feel sick but do not have COVID-19).

This takes testing resources away from true positives (A person who feels sick and has COVID-19).

In British Columbia, Canada, it takes over 24 hours to receive a generic response from a human SMS operator. A chatbot is a practical application because this task is repetitive and follows a sequential set of rules, a chatbot is a practical application. It’s also applicable to all regions of the world.

Objective:

Inform concerned citizens at scale and reduce the burden on healthcare professionals.

Proposed Solution (MVP):

Supplement human-operated SMS with a chatbot, which follows the same self-assessment protocol. In Alberta, Canada, this is the current self-assessment tool (web-based). It’s the same across all provinces. With a few tweaks, this could be applied to NSW (where I reside).

The following section is for those interested in the technology and problems faced in our solution.

If you are not interested in this, please scroll to the end where you can find out how you can help fight COVID-19.

Twilio Autopilot & Functions

Twilio is a software company that allows companies and individuals to leverage their APIs and tools to create different types of communication channels (messaging, video, bots) with ease.

Their product called Autopilot allows us to utilize NLP (natural language processing) to develop a robust chatbot. In our case this allows our bot to understand different variations of yes or no (y, yeh, yup, n, nah, nope) from the user input.

To create a flow inside Autopilot we create a task in JSON format that contains an array of Autopilots Actions:

Say — bot replies or displays a messageListen — bot listens for user inputRedirect — sends the user input to a URL or directs to a specified task

To view the entire action list, visit the docs here:

https://www.twilio.com/docs/autopilot/actions

Below is a copy of one of the tasks we specified for our flow.

{
 "actions": [
  {
   "collect": {
    "name": "collect_critical",
    "questions": [
     {
      "question": "Are you having severe difficult breathing or chest pain?",
      "name": "critical_question",
      "type": "Twilio.YES_NO"
     }
    ],
    "on_complete": {
     "redirect": {
      "method": "POST",
      "uri": "https://licorice-gnat-6331.twil.io/critical_question"
     }
    }
   }
  }
 ]
}

The bot reads the JSON and maps through the actions array and performs each valid action within the array until it reaches the end.

In our example, our first action displays a message “Are you having severe difficulty breathing or chest pain?” while waiting for a user input (which is expected to be in the type of Twilio.YES_NO — boolean).

When the user has submitted a valid input this response is then sent to our Twilio Function that handles the boolean logic.

exports.handler = function(context, event, callback) {
// Retrieve and parse the entire memory tree which shows previous actions until this point
    let memoryTree = JSON.parse(event.Memory);
// Initialise the action array to pass onto the next task
    let actions = [];
    // Initialise the response object we are going to append to our actions array
    let response;
//Get the user input 
    let result = memoryTree.twilio.collected_data.collect_critical.answers.critical_question.answer;
// The logic flow is handled here
    if(result === "Yes"){
        response = {
          "redirect": {
            "method": "POST",
            "uri": "task://Call_811"
          }
        };
        actions.push(response);
    } else {
        result = {
          "redirect": {
            "method": "POST",
            "uri": "task://Moderate_Question"
          }
        };
        actions.push(response);
    }
// We create the response object to be passed back 
    let responseObject = {
        "actions": actions
    };
callback(null, responseObject);
};

This Task-Function flow is repeated for each COVID-19 prescreening question where they are either prompted with the advice to:

Call 911 (Emergency Department)Call 811 (Canada COVID-19 hotline)Stay home/practice social distancing as testing is not required.

How you can help

I found https://helpwithcovid.com from a tweet on twitter while browsing amidst the COVID-19 panic. That is where I met Oliver Leung who had posted this project with the request for volunteers.

Helpwithcovid is a website based on San Francisco and supported by Y Combinator where individuals who have ideas on how to support essential services during this Coronavirus Pandemic post in hopes of finding volunteers to help.

The projects range from design/engineering to skills like funding/social giving. You can filter by skill or project type which lets you map your interest and skills to projects that you may be able to help in.

We would like to thank those in the front-line (nurses, doctors, surgeons, and healthcare service workers) who are doing their best to support the rest of society.

We also hope everyone stays safe and practices social distancing as we try to flatten the curve. Together we can overcome this obstacle.

https://helpwithcovid.com/projects

Final words: If you know any countries or local states that could utilize our SMS bot please reach out by emailing me or Oliver at [email protected] and [email protected].

If you have any feedback and product improvements, please reach out.