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.
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’.
Once you create your own variable, you can set the value of the variable or you can use the variable in a Speak block.
For this COVID-19 Recovery Tracker skill, we are going to need a variable to store the number of new recoveries per day.
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.
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.
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.
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: