Air Monitors Agent
Copyright © 2018 EarthSoft, Inc • Modified: 12 Dec 2018
The Air Monitors Agent is a data loading agent available in EQuIS Live for obtaining data from Air Monitors.
Before using the Air Monitors 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 LIVE_DATA_SOURCE to airmonitors.
3.Set LOGGER_CODE to a station's UniqueId (go to https://api.airmonitors.net/3.5/GET/[AccountId]/[LicenceKey]/stations to get a list of stations that you have access to, where for example [AccountId] = 123456-C and [LicenceKey] = 1234-1234-1234-1234-1234-1234-1234-1234).
4.Set CUSTOM_FIELD_1 to an encrypted AccountId. Please contact firstname.lastname@example.org to encrypt your AccountId.
5.Set CUSTOM_FIELD_2 to an encrypted LicenceKey. Please contact email@example.com to encrypt your LicenceKey.
6.Set STATUS_FLAG to 'A' to activate the logger.
Before using the Air Monitors Agent or Historical Data Loader, the units and statuses must be added to the RT_REMAP and RT_REMAP_DETAIL database tables, for example by using this SQL file. The file contains all of the possible Air Monitors statuses, but the units are specific to an AccountId, and therefore, should be replaced with units specific to your AccountId(s). A complete list of units can be obtained for an AccountId by going to https://api.airmonitors.net/3.5/GET/[AccountId]/[LicenceKey]/units where, for example, [AccountId] = 123456-C and [LicenceKey] = 1234-1234-1234-1234-1234-1234-1234-1234.
After the units and statuses have been added to the RT_REMAP and RT_REMAP_DETAIL tables, and the Air Monitors Agent or Historical Data Loader is run, the remapped units will be added to RT_UNIT.UNIT_CODE and DT_LOGGER_SERIES.SERIES_UNIT (when a new series is added), and the statuses will be added to the DT_LOGGER_DATUM.DATUM_QUALIFIER (when new datum is added).
Note: The RT_REMAP_DETAIL internal_values and external_values are swapped, so that multiple 'external' values can be remapped to the same 'internal' value. See the example below.
Adding these two rows is not possible due to the unique key constraint AK_RT_REMAP_DETAIL
•One row with external_value = 'Micrograms Per Cubic Meter', internal_value = 'ug/m3'
•One row with external_value = 'Micrograms / Cubic Meter', internal_value = 'ug/m3'
Rather, these two rows must be added as
•One row with internal_value = 'Micrograms Per Cubic Meter', external_value = 'ug/m3'
•One row with internal_value = 'Micrograms / Cubic Meter', external_value = 'ug/m3'
The Air Monitors 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 Air Monitors Agent or Historical Data Loader 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 Air Monitors Agent will load data for all loggers with LIVE_DATA_SOURCE set to airmonitors. The agent will request data from the logger's most recent date (in DT_LOGGER_DATUM.DATUM_UTC_DT) until today's date. If a logger does not have any values, the agent will get values for the past day.
The Air Monitors Historical Data Loader allows for the selection of the loggers, date range, and whether or not to update existing values.
The Air Monitors Agent and Historical Data Loader adds a DT_LOGGER_SERIES for each of a station's parameters (e.g., the parameter with SERIES_NAME = NO2 (Parts Per Billion)). A series can be deactivated, by setting its STATUS_FLAG = R, to stop 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 SensorLabel and UnitName from the Air Monitors API.