Build a Node-RED COVID-19 dashboard
Use The Weather Company Disease Tracker API to easily access disease data
Tracking where the coronavirus (COVID-19) is spreading is an important measure in fighting against the virus. In this tutorial, I show you how to access COVID-19 location and infection data through an API provided by The Weather Company (TWC) and incorporate that data into Node-RED dashboard, charts, and tables. Use Node-RED for data analysis and data visualization of COVID-19 infections by country, state, and county.
In this tutorial, you will:
- Learn about Node-RED and how to install it locally and on IBM Cloud
- Explore the node-red-contrib-twc-covid19-tracker Node-RED node
- Review the TWC Disease Tracker API documentation
- Experiment with node-red-dashboard charts and node-red-node-ui-table tables
- Build a Call for Code COVID-19 Disease Tracking Dashboard using TWC Disease Tracker API
- Install Node-RED locally or Create a Node-RED starter application in IBM Cloud.
- You need an API key to use The Weather Company API for COVID-19 Disease Tracking. Call for Code participants can read the Terms of Service, register to join the Call for Code 2020 COVID Challenge and request a TWC API key for this Node-RED node at callforcode.weather.com
Completing this tutorial should take about 30 minutes.
Learn about Node-RED
Node-RED is an open source programming tool for wiring together hardware devices, APIs, and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.
Install Node-RED dependencies nodes
After Node-RED is installed, this tutorial requires you to add some additional dependencies:
Local installation instructions
To install locally, use the following:
npm install node-red-node-ui-table node-red-dashboard node-red-contrib-twc-covid19-tracker
IBM Cloud installation instructions
Instead of adding the additional packages via Manage Palette, use the IBM Cloud Toolchain and the git repository in IBM Cloud to add the following packages to the
package.json. Commit the change, and the IBM Cloud Continuous Delivery toolchain will build and deploy the Cloud Foundry application.
"node-red-node-ui-table":"0.x", "node-red-dashboard":"2.x", "node-red-contrib-twc-covid19-tracker":"0.x",
Explore the node-red-contrib-twc-covid19-tracker Node-RED node
This Node-RED package creates a twc covid19 tracker node in your Node-RED palette.
The twc covid19 tracker node queries 60-day history of COVID-19 statistics at the country (USA), state, county level by geocode, place ID, or postal code.
Once the node is installed in your Node-RED palette, drag it to your flow and double-click on the twc covid tracker node. In the Properties dialog box, enter the following information:
- Your TWC API Key provided by callforcode.weather.com
- Specify whether the node will retrieve Country, State, or County COVID-19 data
- Specify the location you are interested in: geocode (latitude/longitude), place ID, or postal key
- The location either via latitude/longitude, place id, or postal code. Examples:
Review the node information documentation in the Node-RED right hand side bar for techniques that allow you to programmatically pass in the above parameters via a
msg.twcparams json object.
Review the TWC Disease Tracker API documentation
The Weather Company offers TWC Weather Data Packages that are available for purchase. The Node-RED node in this tutorial implements the Disease Tracking API service and is free for Call for Code participants (please review the Terms of Service).
The TWC Disease Tracker API allows you to track the progression of the COVID-19 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.
See the online documentation for more information about The Weather Company APIs for Disease Tracking.
The API returns an array of JSON objects containing COVID-19 data which you can integrate into dashboards or applications.
Experiment with Node-RED charts and tables
The node-red-dashboard package provides a variety of UI elements in the Node-RED palette that you can use to construct a dashboard. These gauges, charts, sliders, drop down lists, entryfields, and buttons can be wired to build informative dashboards with very little code.
The node-red-node-ui-table package provides a table element in the Node-RED palette that you can use to construct robust tabular data.
These nodes will be wired to build a COVID-19 Data Dashboard that visualizes Country (US) and State data in a chart and in a table.
Build a Call for Code COVID-19 Disease Tracking Dashboard using TWC Disease Tracker API
The node-red-contrib-twc-covid19-tracker GitHub repository includes a collection of Node-RED Dashboard examples that display COVID-19 statistics.
Two examples are provided in the examples folder.
- Test each of the TWC COVID-19 APIs by importing this covid19-api-test.json flow.
- Here is an example Node-RED Dashboard that displays 60 days of COVID-19 historical data in a table and on a chart. This flow requires node-red-dashboard and node-red-node-ui-table. Import this Node-RED-covid19-dashboard.json flow.
Deploy the Node-RED flows
To deploy the Node-RED flows, click the red Deploy from your UI.
To launch the Node-RED Dashboard, click on the dashboard tab in the right sidebar. Click on the arrow icon in the upper right corner.
Build a Call for Code COVID-19 dashboard solution
Now that you have completed this tutorial, you are ready to modify these example flows and your own Node-RED Dashboard to build a Call for Code COVID data visualization solution. As a possible enhancement, you could add a map that displays infection hotspot or allow your user to enter, select, or display specific county information.