Digital Developer Conference on Cloud Native Security: Register for free and choose your sessions. June 24, 25, & July 1, 2020 Learn more

Track COVID-19’s progression with The Weather Company’s API

Weather Company Data Disease Tracker API

Tracking a disease’s progression is incredibly useful in a pandemic like COVID-19. The Weather Company created a Data Disease Tracker API that allows you to track the progression of a disease for a given location. It provides information regarding active diseases including confirmed cases, deaths, and recoveries over a period of up to 60 days in the past.

In this tutorial, I show you how to access the Weather Company Data Disease Tracker API endpoint in Python from Watson Studio.

Obtain a Weather Company API Key

If you’re participating in the Call for Code Global Challenge, you have access to The Weather Company API for COVID-19 Disease Tracking.

Go to the Call for Code Weather website and register. A time-limited API key will be sent to you via email. The documentation for the Weather Company APIs for Call for Code can be found here.

(Optional) Obtain a HERE Location Services API Key

When using the application, you may pass it a geocode (for example, ‘35.843686,-78.78548’), a postal key (for example, 90210:US), or an address. If you pass an address, the application will try to use HERE Location Services for geocoding.

To access the HERE Geocoding API, an API Key is required. Follow the instructions outlined in the HERE Developer Portal to generate a free API Key.

Import the notebook into IBM Watson Studio

  1. Sign into IBM Watson Studio Cloud
  2. Create a project Create a project
  3. From your project, click Add to Project Add to project
  4. Select Notebook Choose asset type
  5. On the New Notebook page, select From URL
  6. Enter a Name for the notebook
  7. For the Notebook URL, enter the URL for the notebook (found in this GitHub repo):

     https://raw.githubusercontent.com/Call-for-Code/twc-disease-tracker-api-python/master/twc-disease-tracker-api.ipynb
    

    Add new notebook

  8. Click Create

The notebook should be uploaded into your project and opened up.

Run the notebook

From within the notebook:

  1. Update the cell under the Set API keys section and set the Weather Company Data API key (i.e., TWC_APIKEY)
  2. Update the cell under the Set API keys section and set the HERE Location services API key (i.e., HERE_APIKEY)
  3. Run through the notebook and execute each cell

In the Run section of the notebook, you can set the location you want to get data for. The location can be a geocode (i.e., 42.3584,-71.0598), postal key (i.e., 02109:US), or an address (e.g., Boston, MA) if HERE AP Key is set.

Examine the Add function to query TWC API to get most recent report section to see how exactly disease tracking API endpoint is used.

License

This code is licensed under Apache 2.0. Full license text is available in LICENSE.

va barbosa
Sam Couch