In the backdrop of the ongoing pandemic situation, multiple data sources on the internet seek to aggregate and disseminate Covid-19 related statistics. This, coupled with different sources publishing fake news as information without due diligence, has led to a deluge of cluttered, unreliable information on the web. The statement – “We’re not just fighting an epidemic; we’re fighting an infodemic” by the WHO Director-General Tedros Adhanom Ghebreyesus aptly summarises the current situation. The World Economic Forum has rightly identified Misinformation as one of the top 10 global risks that threaten our world. Marred by misinformation and fake news in the digital world, it is becoming increasingly difficult to rely on and seek insightful trends from coronavirus-related sources on the web. This avalanche of misinformation infested data has led to a dire need for carefully sifting through, cleaning, curating and organizing it before disseminating it to the world.
With data analytics assisting global response against the pandemic, it becomes increasingly significant for both government and private organizations providing humanitarian response to rely on reliable data sources. This article discusses Smartable AI’s Coronavirus Smartable API that leverages technology towards Smartable AI’s mission statement of fighting misinformation by providing reliable, timely information in an organized manner that is easier to make sense of. The API powers the popular stats page This API powers the popular COVID-19 consolidated statistics dashboard at https://smartable.ai/apps/coronavirus/. To that end, this article discusses the technical specifications of the Coronavirus Smartable API in detail and outlines the steps towards its usage.
What is the Coronavirus Smartable API?
The Coronavirus Smartable API is a REST-based API service that provides programmatic access to global and regional coronavirus data, including the latest news, numbers, historical values, and geo-breakdowns. The API facilitates near real-time data by aggregating and cleaning up numbers from different credible sources. It also provides access to historical country-specific Covid-19 statistics. In addition to coronavirus-related statistics, the API also facilitates access to relevant and reliable region-specific curated news articles from different sources on the web.
How does the Coronavirus Smartable API work?
The Coronavirus Smartable API enables users to query global and regional-level coronavirus data, including the latest news, numbers, historical values, and geo-breakdowns. It sets itself apart from other Covid-19 data sources with the use of Artificial Intelligence (AI) for reliable information gathering from credible sources, its stability, and detailed and near real-time nature. Refreshed at an interval of one hour, the API aggregates data from credible sources such as country/state government portals, Wikipedia pages, news reports, Johns Hopkins University CSSE 2019-nCoV Dashboard, WHO situation reports, CDC situation updates, and DXY.cn.
The REST-based API takes the location of interest as an input. It returns statistics such as the number of Covid-19 cases, deaths and recoveries, increase or decrease in the number of cases from yesterday, and historical statistics for that location, including the geographic breakdown when applicable. Another endpoint of the API also facilitates retrieving relevant and reliable news articles based on the location of interest.
Smartable AI – the organization behind this initiative seeks a collaborative effort to disseminate reliable information through the API. In that regard, it enables users to report issues related to the API on Github.
Who is the Coronavirus Smartable API for exactly?
The Coronavirus Smartable API is intended to serve application developers and web developers, including startups and enterprises, looking to integrate a reliable service that provides access to near real-time Covid-19 related statistical data and related news articles in their application or website. The API primarily caters to developers of apps and services in the humanitarian crisis response and data visualization space. The API is available for developers and enterprises through a freemium model of subscription.
How to connect to the Coronavirus Smartable API Tutorial
The following is a step-by-step tutorial for connecting to the Coronavirus Smartable API.
Step 1: Sign Up on RapidAPI
A RapidAPI account is required to connect to the Coronavirus Smartable API. You can sign up for a RapidAPI account by navigating to the RapidAPI website and clicking on the Sign-Up button at the top right!
RapidAPI supports signing up using Google, Github, or Facebook.
Step 2: Subscribing to the Coronavirus Smartable API
Having signed up and logged in to RapidAPI, you would need to navigate to the Coronavirus Smartable API page on RapidAPI platform to subscribe and connect to the API.
You would need to navigate to the Pricing Page of the Coronavirus Smartable API to subscribe to the Coronavirus Smartable API. The API is available as a freemium model of subscribtion and would require you to select a subscription plan. Please select the appropriate plan and navigate to the Coronavirus Smartable API page.
Step 3: Test the API Connection
We will test the API connection with the “GetStats” endpoint of the API. So please click on the “GetStats” in the list in the left-most section of the page. You may scroll down in the centre section to observe and note the location parameter to be sent with the request to the “GetStats” endpoint. The parameter “location” has been set to “US”, indicating that we would be querying the “GetStats” endpoint for information specific to the United States of America.
You can go ahead and click on “Test Endpoint”. A successful connection would result in a “200 OK” response in the Results tab on this page. You should also be able to see the results returned for the “location” string.
Now that you have subscribed and tested the connection to the Coronavirus Smartable API let’s learn more about its usage!
Endpoints of the Coronavirus Smartable API
The Coronavirus Smartable API has two endpoints – “GetStats” and “GetNews” to facilitate programmatic access to Covid-19 statistical data and related news articles. The endpoints with the relevant information on their usage are as follows:
GetStats
This endpoint facilitates retrieval of Covid-19 related near real-time and historical statistical information for the user input “location
” string.
This endpoint requires one parameter:
- “
location
” – indicating the location of interest that the user intends to query. The user is expected to enter the ISO 3166-2 location code for the corresponding location of interest. This parameter set as “global
” would result in the global-level statistics being returned.
The API response contains the number of confirmed Covid-19 cases, deaths and recoveries, increase or decrease in the number of cases from yesterday, and historical statistics for that location, including the geographic breakdown when applicable.
GetNews
This endpoint facilitates retrieval of the latest Covid-19 related news information for the user input “location
” string.
This endpoint requires one parameter:
- “
location
” – indicating the location of interest that the user intends to query. The user is expected to enter the ISO 3166-2 location code for the corresponding location of interest. This parameter set as “global
” would result in the global-level news articles being returned.
The API response contains a list of URLs pointing to the latest Covid-19 related news articles from different sources, specific to the user input location of interest.
How to use the Coronavirus Smartable API with Python?
The following code snippet depicts the request with the required parameter to the “GetStats” endpoint of the Coronavirus Smartable API with Python. It uses the “requests” library to send a GET request to the endpoint with the parameter “location” specified in the “url” variable.
The “x-rapidapi-key
” value in the “headers” dictionary would need to be replaced with your actual key which can be obtained from the Coronavirus Smartable API page in the Header Parameters section.
import requests url = "https://coronavirus-smartable.p.rapidapi.com/stats/v1/US/" headers = { 'x-rapidapi-key': "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 'x-rapidapi-host': "coronavirus-smartable.p.rapidapi.com" } response = requests.request("GET", url, headers=headers) print(response.text)
How to use the Coronavirus Smartable API with PHP?
The following code snippet depicts the request with the required parameter to the “GetStats” endpoint of the Coronavirus Smartable API with PHP. It uses the “curl” function of PHP to send a GET request to the endpoint with the parameter “location” specified in the “CURLOPT_URL”.
The “x-rapidapi-key
” value in the “CURLOPT_HTTPHEADER” object would need to be replaced with your actual key which can be obtained from the Coronavirus Smartable API page in the Header Parameters section.
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://coronavirus-smartable.p.rapidapi.com/stats/v1/US/", CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: coronavirus-smartable.p.rapidapi.com", "x-rapidapi-key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
How to use the Coronavirus Smartable API with Ruby?
The following code snippet depicts the request with the required parameter to the “GetStats” endpoint of the Coronavirus Smartable API with Ruby. The “x-rapidapi-key
” value in the “request” object would need to be replaced with your actual key which can be obtained from the Coronavirus Smartable API page in the Header Parameters section.
require 'uri' require 'net/http' require 'openssl' url = URI("https://coronavirus-smartable.p.rapidapi.com/stats/v1/US/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) request["x-rapidapi-key"] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request["x-rapidapi-host"] = 'coronavirus-smartable.p.rapidapi.com' response = http.request(request) puts response.read_body
How to use the Coronavirus Smartable API with JavaScript?
The following code snippet depicts the request with the required parameter to the “GetStats” endpoint of the Coronavirus Smartable API with JavaScript. It uses JQuery’s “ajax” function to send a GET request to the endpoint with the parameter “location” specified in the “settings” object.
The “x-rapidapi-key
” value in the “headers” object would need to be replaced with your actual key which can be obtained from the Coronavirus Smartable API page in the Header Parameters section.
const settings = { "async": true, "crossDomain": true, "url": "https://coronavirus-smartable.p.rapidapi.com/stats/v1/US/", "method": "GET", "headers": { "x-rapidapi-key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "x-rapidapi-host": "coronavirus-smartable.p.rapidapi.com" } }; $.ajax(settings).done(function (response) { console.log(response); });
Alternatives to the Coronavirus Smartable API
A few alternatives APIs that provide access to Covid-19 statistics and other related information similar to the Coronavirus Smartable API are:
- Covid-19 Tracker API
- This API facilitates retrieval of present and historical content on Covid-19 from trusted sources worldwide.
- COVID-19 Statistics
- This API facilitates access to statistics from public data by Johns Hopkins CSSE.
- COVID-19 data
- This API facilitates Covid-19 related country-specific statistics at an update interval of 15 minutes.
- Covid-19
- This API provides total, incremental and time-series covid numbers across continents, countries and states, updated daily.
Benefits of the Coronavirus Smartable API
The Coronavirus Smartable API enables its users by providing programmatic access to near real-time and historical Covid-19 related statistical information in addition to relevant location-specific news articles from credible sources. This information can aid organizations in planning humanitarian responses to alleviate the losses caused due to the pandemic. Visualizing such reliable location-specific information in intuitive dashboards with graphs, charts, and maps can help authorities and policymakers suggest appropriate preventive measures quickly. Thus the API seeks to disseminate reliable near real-time information as relevant statistics and region-specific news articles aggregated from credible sources.
Summary
The Coronavirus Smartable API is a powerful tool for app and web developers, intended for seamless integration of near real-time Covid-19 related statistical information and location-specific news articles in their application or website. The API facilitates programmatic access to near real-time and historical numerical data such as active cases, number of deaths, number of recovered cases, increase or decrease in cases etc., based on the location of interest input by the user. Due to its focus on providing reliable and timely information, the API could cater to developers and enterprises working towards developing holistic yet granular dashboards for humanitarian crisis response teams monitoring the Covid-19 situation.
Leave a Reply