Live EPA AirNow API Agent

<< Click to Display Table of Contents >>

Navigation:  Live > Agents > Web API Agents > Web API Open Data >

Live EPA AirNow API Agent

The EPA AirNow Agent is a data loading agent available in EQuIS Live for obtaining Air Quality Information data from EPA's AirNow web API into EQuIS Live.

 

Adding Station

 

Before using the EPA AirNow Agent, add one or more stations to the DT_LOGGER table:

1.Execute the equis.get_ids stored procedure to get a new LOGGER_ID, or add the station (DT_LOGGER row) in EQuIS Professional.

2.Set LOGGER_CODE to a non-null value.

3.Set LIVE_DATA_SOURCE to http://www.airnowapi.org.

4.Set CUSTOM_FIELD_1 to an AirNow API key. An AirNow API key can be obtained from AirNow.

5.Set FACILITY_ID and SYS_LOC_CODE to a facility and system location code, or set CUSTOM_FIELD_2 to a ZIP code (e.g., 60525), or latitude | longitude (e.g., 41.7940 | -87.8499).

6.Set CUSTOM_FIELD_3 to the distance (in miles) from the facility, or ZIP code, or latitude | longitude, or set it to NULL to use AirNow's default distance.

7.Set STATUS_FLAG to 'A' to activate the logger.

 

Loading Data

 

The EPA AirNow Agent or Historical Data Loader can be run as a scheduled EQuIS Information Agent (EIA), at the desired frequency, to automatically load data as often as needed. The EPA AirNow current observations data is reported hourly and the historical observations data is reported daily. Therefore, the EPA AirNow Agent report should not be run more than once per hour, and the Historical Data Loader report should not be run more than once per day.

 

The Agent and Historical Data Loader reports can also be run in EQuIS Professional or Enterprise (using the EZView widget) to load the data manually, without having to schedule an EIA.

 

The EPA AirNow Agent will load data for all loggers with LIVE_DATA_SOURCE set to http://www.airnowapi.org. It gets current hourly values, plus, if a logger's DT_LOGGER.START_DATE is NULL, it gets daily historical values from a logger's site (DT_LOGGER.LOGGER_CODE) most recent date (in DT_LOGGER_DATUM.DATUM_UTC_DT) until today's date, and from a logger's oldest date (in DT_LOGGER_DATUM.DATUM_UTC_DT) back to the earliest recorded value taken at that logger's site, or until it reaches the EPA AirNow's maximum number of API key requests per hour limit (see Limitations of Use section below).

 

The EPA AirNow Historical Data Loader allows you to select the loggers, date range, and whether or not to get current hourly values. It has the following input parameters:

Logger(s)Select the stations for which to load data. If no stations are selected, the agent will load data for all EPA AirNow stations.

Date Range – Select a date range for the historical values; choose from start and end dates, recent, or recent and older. The recent and older option is similar to the EPA AirNow Agent; it gets daily historical values from a logger's most recent value till now, and from a logger's oldest value back, till there are no more values, or until it reaches AirNow's maximum number of API key requests per hour limit. If the recent option is selected, it gets daily historical values from a logger's most recent value till now, but not older values. If the start and end dates option is selected, start and end dates must be specified.

Get current hourly values (in addition to daily historical values)? – Check this box to get current hourly values.

Update existing values? – Check this box to update existing EQuIS Live data values.

 

A series can be activated or deactivated, by setting its STATUS_FLAG = "A" or "R", to start or stop (respectively) obtaining data for it. A series' SERIES_DESC and SERIES_UNIT may be changed, but not the SERIES_NAME; it uniquely identifies the series using the parameter name from the EPA AirNow API.

 

Limitations of Use

 

EPA AirNow limits the number of API key requests to 500 per hour per API service (i.e., 500 requests per hour for hourly ZIP code requests, plus 500 requests per hour for hourly latitude and longitude requests, plus 500 requests per hour for daily ZIP code requests, plus 500 requests per hour for daily latitude and longitude requests, per API key). Due to this limitation, the agent may not get all of available values in a single execution. It is recommended to use an EIA for the historical data loading when requesting large amounts of data.