Tutorial: Build a COVID-19 Recovery Tracker

This is the lede paragraph for the blog post. It should be populated with dynamic data from a WYSIWYG custom field assigned to your posts.

Written by

Kevin Elgan

Published on

BlogTutorials, Uncategorized

Today, we’ll be tracking the recovery from the COVID-19 pandemic using the latest numbers from Johns Hopkins University.

It’s hard to avoid all the news surrounding the pandemic that we are currently in. So we thought that we’d use this as a learning opportunity with a positive spin. Today we are going to learn how use a new API that grabs data from Johns Hopkins University to track COVID-19 recoveries in your country.

Variables Review

Let’s review Variables from yesterday. If you recall, a variable is an object that “remembers” or stores information. You can create them by going to the Variables menu and clicking ‘Create variable’.

Make your own variables by clicking the ‘Create variable’ button

Once you create your own variable, you can set the value of the variable or you can use the variable in a Speak block.

The block on the left let’s you SET the contents of the variable. The block on the right let’s you USE the variable.

For this COVID-19 Recovery Tracker skill, we are going to need a variable to store the number of new recoveries per day.

You can name your block whatever you like, but we’ll be using the Set block first

Hey Chatterbox, how many recoveries today?

Next, we need to decide how we would like to ask Chatterbox for recoveries. We’ll be using the Listen block On phrases like this but need to think of all the ways that people might ask Chatterbox for this information.

We’ve come up with some examples, but your skill might look a little bit different.

Using the COVID-19 Block

The COVID-19 block uses an API that gathers information from Johns Hopkins University. Whoa?! What?! What’s an API???

I’m glad you asked! An API stands for “Application Programming Interface” which is a fancy way of saying that it is a program that you can request information from.

To access the COVID-19 block, you first need to enable the Web APIs Extension from the extension page.

After enabling the Web APIs Extension, you can access the COVID-19 block

The COVID-19 block allows you to get a number for “New recoveries” by country. But just like yesterday, we need to store this number in a variable in order to be able to use it later.

This line will get the new recoveries from United States and store it in a variable

Your skill should now look similar to this.

Make Chatterbox answer the question

We now have set how to trigger the skill with the Listen block and have set the newRecoveries variable, it’s time to make Chatterbox answer the question.

A double-sided text block lets you use variables to make Chatterbox speak

We’ll do this using a Speak block and double-sided text block. If you recall you can find the text block in the “Data” category and it’s handy when you want to use a variable block in a response.

We’ll make Chatterbox answer the question by saying:
“Today there have been [newRecoveries] new recoveries from COVID-19 in the United States.”

Your final skill should look similar to this:

Related Posts