### Install pyaqsapi from Source using Git and Pip Source: https://usepa.github.io/pyaqsapi/_sources/manual/Install_pyaqsapi Installs pyaqsapi from its source code repository on GitHub. This method involves cloning the repository, installing build dependencies from a requirements file, and then building and installing the package using setuptools and pip. ```console git clone https://github.com/USEPA/pyaqsapi.git ``` ```console pip install -r requirements.txt ``` ```console python -m build . ``` ```console python -m pip install . ``` -------------------------------- ### Install pyaqsapi dependencies from source Source: https://usepa.github.io/pyaqsapi/manual/Install_pyaqsapi Installs the necessary dependencies for building and installing pyaqsapi from source. This command should be run from the root directory of the cloned repository and requires pip. ```shell pip install -r requirements.txt ``` -------------------------------- ### Build and install pyaqsapi from source Source: https://usepa.github.io/pyaqsapi/manual/Install_pyaqsapi Builds the pyaqsapi package from the source code and then installs it using pip. These commands should be executed from the root directory of the cloned repository. They require Python's build module and pip. ```shell python -m build . ``` ```shell python -m pip install . ``` -------------------------------- ### Clone pyaqsapi repository Source: https://usepa.github.io/pyaqsapi/manual/Install_pyaqsapi Clones the pyaqsapi source code repository from GitHub. This is the first step for users who wish to install the package from source. It requires Git to be installed. ```shell git clone https://github.com/USEPA/pyaqsapi.git ``` -------------------------------- ### Install pyaqsapi using pip Source: https://usepa.github.io/pyaqsapi/_sources/manual/Install_pyaqsapi Installs the pyaqsapi package directly from the Python Package Index (PyPI) using pip. This is the simplest installation method and requires no external dependencies beyond pip itself. ```console pip install pyaqsapi ``` -------------------------------- ### GET /bysite/monitors Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves a table of monitors and their metadata for a given site, parameter, and date range. ```APIDOC ## GET /bysite/monitors ### Description Retrieves a table of monitors and their metadata for a given site, parameter, and date range. ### Method GET ### Endpoint /bysite/monitors ### Parameters #### Query Parameters - **parameter** (str) - Required - The parameter code of the air pollutant. - **bdate** (date) - Required - The beginning date for data selection. - **edate** (date) - Required - The end date for data selection. - **stateFIPS** (str) - Required - The 2-digit state FIPS code. - **countycode** (str) - Required - The 3-digit county FIPS code. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date | None) - Optional - The "beginning date of last change" for filtering data based on update time. - **cedate** (date | None) - Optional - The "end date of last change" for filtering data based on update time. - **return_header** (bool | None) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns a pandas DataFrame. ### Response #### Success Response (200) - **data** (DataFrame or AQSAPI_V2) - A table of monitors and related metadata for the specified criteria. ``` -------------------------------- ### Load pyaqsapi in Python Source: https://usepa.github.io/pyaqsapi/index Imports the pyaqsapi library into a Python script or environment. It is essential to load the package within the same virtual environment where it was installed. ```python import pyaqsapi as aqs ``` -------------------------------- ### GET /bysite/monitors Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves a table of all monitors at a specified site for a given date range and parameter. ```APIDOC ## GET /bysite/monitors ### Description Retrieves a table of all monitors at a specified site for a given date range and parameter. This endpoint is useful for understanding the monitoring network's activity within a specific geographic area and time. ### Method GET ### Endpoint /bysite/monitors ### Parameters #### Query Parameters - **parameter** (str) - Required - The parameter code of the air pollutant. - **bdate** (date) - Required - The begin date of the data selection. - **edate** (date) - Required - The end date of the data selection. - **stateFIPS** (str) - Required - The 2-digit state FIPS code. - **countycode** (str) - Required - The 3-digit county FIPS code. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date | None) - Optional - The beginning date of last change filter. - **cedate** (date | None) - Optional - The end date of last change filter. - **return_header** (bool | None) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns only the requested data (default: FALSE). ### Request Example ```python import pyaqsapi as aqs from datetime import date response = aqs.bysite.monitors( parameter="42401", bdate=date(year=2015, month=5, day=1), edate=date(year=2019, month=5, day=2), stateFIPS="15", countycode="001", sitenum="0007" ) ``` ### Response #### Success Response (200) - **monitors** (DataFrame or AQSAPI_V2) - A pandas DataFrame or AQSAPI_V2 object containing monitor data. #### Response Example (DataFrame representation of monitor data) ``` -------------------------------- ### Get Daily Summary Data by Site Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves daily summary air quality data for a specific site and time frame. It handles API limitations by making multiple calls for data spanning more than one year, with a delay between calls. Input parameters include pollutant code, start and end dates, state FIPS, county code, site number, and optional date filters for data changes and header return. ```python import pyaqsapi as aqs from datetime import date # Example: Retrieve daily summary ozone data for a specific site and date response = aqs.bysite.dailysummary( parameter="44201", bdate=date(year=2017, month=6, day=18), edate=date(year=2017, month=6, day=18), stateFIPS="37", countycode="183", sitenum="0014" ) ``` -------------------------------- ### GET /bysite/dailysummary Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves daily summary data for a specified site, parameter, and date range. This function handles fetching data for multiple years by making repeated API calls, with a delay between calls. ```APIDOC ## GET /bysite/dailysummary ### Description Retrieves daily summary data for a specified site, parameter, and date range. This function handles fetching data for multiple years by making repeated API calls, with a delay between calls. ### Method GET ### Endpoint /bysite/dailysummary ### Parameters #### Query Parameters - **parameter** (str) - Required - The parameter code of the air pollutant. - **bdate** (date) - Required - The beginning date for data selection. - **edate** (date) - Required - The end date for data selection. - **stateFIPS** (str) - Required - The 2-digit state FIPS code. - **countycode** (str) - Required - The 3-digit county FIPS code. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date | None) - Optional - The "beginning date of last change" for filtering data based on update time. - **cedate** (date | None) - Optional - The "end date of last change" for filtering data based on update time. - **return_header** (bool | None) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns a pandas DataFrame. ### Request Example ```python import pyaqsapi as aqs from datetime import date # Example for daily summary data aqs.bysite.dailysummary( parameter="44201", bdate=date(year=2017, month=6, day=18), edate=date(year=2017, month=6, day=18), stateFIPS="37", countycode="183", sitenum="0014" ) ``` ### Response #### Success Response (200) - **data** (DataFrame or AQSAPI_V2) - Daily summary data for the requested site, county, state, and time frame. ``` -------------------------------- ### Retrieve Ozone Transaction Data by Site (Python) Source: https://usepa.github.io/pyaqsapi/pyaqsapi This Python code snippet demonstrates how to retrieve ozone transaction data for a specific site, county, and date range using the pyaqsapi library. It specifies the parameter for ozone, the start and end dates, and the FIPS codes for the state and county, along with the site number. Dependencies include the 'datetime' module and the 'pyaqsapi' library. The output is transaction data for the specified criteria. ```python from datetime import date import pyaqsapi as aqs aqs.bysite.transactionsample(parameter="44201", bdate=date(year=2017, month=6, day=18), edate=date(year=2017, month=6, day=18,), stateFIPS="37", countycode="183", sitenum="0014") ``` -------------------------------- ### Get Monitor Data by Site Source: https://usepa.github.io/pyaqsapi/pyaqsapi Fetches monitor information and related metadata for a given site, parameter, and date range. This function requires specifying the pollutant, state FIPS, county code, site number, and the desired date range. Optional parameters include dates for last data change and a flag to return a header object. ```python import pyaqsapi as aqs from datetime import date # Example: Retrieve monitor data for a specific site and date range monitors_data = aqs.bysite.monitors( _parameter="44201", _bdate=date(year=2020, month=1, day=1), _edate=date(year=2020, month=12, day=31), _stateFIPS="37", _countycode="183", _sitenum="0014" ) ``` -------------------------------- ### GET /pyaqsapi/bysite/aqs_quarterlysummary Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves quarterly summary data for a specific air quality parameter, site, and date range. The API call is optimized to handle requests spanning multiple years by making individual calls for each calendar year. ```APIDOC ## GET /pyaqsapi/bysite/aqs_quarterlysummary ### Description Retrieves quarterly summary data for a specific air quality parameter, site, and date range. The API call is optimized to handle requests spanning multiple years by making individual calls for each calendar year. ### Method GET ### Endpoint /pyaqsapi/bysite/aqs_quarterlysummary ### Parameters #### Query Parameters - **parameter** (str) - Required - The parameter code for the air pollutant. - **bdate** (date) - Required - The start date for the data retrieval. - **edate** (date) - Required - The end date for the data retrieval. - **stateFIPS** (str) - Required - The 2-digit FIPS code for the state. - **countycode** (str) - Required - The 3-digit FIPS code for the county. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date | None) - Optional - The "beginning date of last change" to filter data by. - **cedate** (date | None) - Optional - The "end date of last change" to filter data by. - **return_header** (bool | None) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns data requested. ### Request Example ```python import pyaqsapi as aqs from datetime import date aqs.bysite.aqs_quarterlysummary( parameter="88101", bdate=date(year=2016, month=1, day=1), edate=date(year=2016, month=12, day=31), stateFIPS="37", countycode="183", sitenum="0014") ``` ### Response #### Success Response (200) - **AQSAPI_V2 | DataFrame** - Quarterly summary data or an AQSAPI_V2 object. ``` -------------------------------- ### Get Sample Data for Site - pyaqsapi Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves aggregated sample data at the site level. This function allows filtering by parameter, date range, state FIPS, county code, site number, and optionally by last change date and sample duration. It can return either a pandas DataFrame or an AQSAPI_V2 object. ```python pyaqsapi.bysite.sampledata(_parameter : str_, _bdate : date_, _edate : date_, _stateFIPS : str_, _countycode : str_, _sitenum : str_, _cbdate : date | None = None_, _cedate : date | None = None_, _duration : str | None = None_, _return_header : bool | None = False_) ``` -------------------------------- ### Get Quarterly Summaries for Site - pyaqsapi Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves quarterly summary data for a specific site. It handles multi-year requests by making individual API calls for each year, with a 5-second delay between calls to avoid overloading the API. For quarterly data, only the year from bdate and edate is used, returning all four quarters. ```python import pyaqsapi as aqs from datetime import date aqs.bysite.aqs_quarterlysummary( parameter="88101", bdate=date(year=2016, month=1, day=1), edate=date(year=2016, month=1, day=31), stateFIPS="37", countycode="183", sitenum="0014" ) ``` -------------------------------- ### Variable Descriptions and Usage Source: https://usepa.github.io/pyaqsapi/_sources/manual/pyaqsapiFunctions-Long Explains common variables used across various pyaqsapi functions, providing context for their purpose and data selection. ```APIDOC ## Variable Descriptions and Usage ### Description This section details the common variables used with `pyaqsapi` functions. These variables help in filtering and defining the scope of the data you wish to retrieve from the AQS Data Mart API. ### Available Variables - **AQSobject**: An object of type `AQSAPI_V2` returned by aggregate functions when `return_header` is set to `True`. - **bdate**: A date object specifying the beginning date for data selection. Only data on or after this date will be returned. - **cbdate** (optional): A date object representing the 'beginning date of last change'. This is used to filter data based on when it was last updated. ``` -------------------------------- ### Data Mart Aggregate Functions by Site Source: https://usepa.github.io/pyaqsapi/manual/pyaqsapiFunctions-Long The bysite submodule provides functions to aggregate data at the site level. It includes various summary, monitor, and QA functions. ```APIDOC ## Data Mart Aggregate Functions by Site ### Description The `bysite` submodule exports functions that aggregate data at the site level. These functions are useful for analyzing air quality data specific to individual monitoring sites. ### Functions Exported - `bysite.annualsummary` - `bysite.dailysummary` - `bysite.helperfunctions` - `bysite.monitors` - `bysite.qa_annualpeferomanceeval` - `bysite.qa_annualperformanceevaltransaction` - `bysite.qa_blanks` - `bysite.qa_collocated_assessments` - `bysite.qa_flowrateaudit` - `bysite.qa_flowrateverification` - `bysite.qa_one_point_qc` - `bysite.qa_pep_audit` - `bysite.quarterlysummary` - `bysite.sampledata` - `bysite.transactionsample ### Common Parameters All functions in the `bysite` submodule accept the following primary parameters: #### Query Parameters - **parameter** (string) - Required - The pollutant parameter to query. - **bdate** (string) - Required - The begin date for the data query (YYYY-MM-DD). - **edate** (string) - Required - The end date for the data query (YYYY-MM-DD). - **stateFIPS** (string) - Required - The FIPS code for the state. - **countycode** (string) - Required - The FIPS code for the county. - **sitenum** (string) - Required - The site number. #### Optional Parameters - **cbdate** (string) - Optional - The begin date for a secondary date range, used with specific functions (e.g., `sampledata`, `dailysummary`). - **cedate** (string) - Optional - The end date for a secondary date range, used with specific functions (e.g., `sampledata`, `dailysummary`). - **return_header** (boolean) - Optional - If True, returns the header in the response. Defaults to False. - **duration** (string) - Optional - Used only with `sampledata` functions to specify the data duration. ``` -------------------------------- ### pyaqsapi Core Functions Source: https://usepa.github.io/pyaqsapi/_sources/manual/pyaqsapiFunctions-Long Lists the core functions exported by the pyaqsapi package, which are available after loading specific submodules. ```APIDOC ## pyaqsapi Core Functions ### Description These are the primary functions exported by the `pyaqsapi` package. To use them, relevant submodules like `pyaqsapi.bysite`, `pyaqsapi.bycounty`, etc., may need to be loaded. ### Available Functions - `pyaqsapi.aqs_cbsas` - `pyaqsapi.aqs_classes` - `pyaqsapi.aqs_counties_by_state` - `pyaqsapi.aqs_credentials` - `pyaqsapi.aqs_fields_by_service` - `pyaqsapi.aqs_isavailable` - `pyaqsapi.aqs_knownissues` - `pyaqsapi.aqs_mas` - `pyaqsapi.aqs_parameters_by_class` - `pyaqsapi.aqs_pqaos` - `pyaqsapi.aqs_removeheader` - `pyaqsapi.aqs_revisionhistory` - `pyaqsapi.aqs_sampledurations` - `pyaqsapi.aqs_sign_up` - `pyaqsapi.aqs_sites_by_county` - `pyaqsapi.aqs_states` ### Related Submodules The following submodules contain additional functions: - `pyaqsapi.bysite` - `pyaqsapi.bycounty` - `pyaqsapi.bycbsa` - `pyaqsapi.bybox` - `pyaqsapi.byma` - `pyaqsapi.bystate` - `pyaqsapi.bypqao` ``` -------------------------------- ### GET /bysite/qa_annualpeferomanceeval Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves quality assurance performance evaluation data aggregated by site for a specified parameter, date range, and site details. ```APIDOC ## GET /bysite/qa_annualpeferomanceeval ### Description Retrieves quality assurance performance evaluation data, aggregated by site for a parameter code. This endpoint filters data based on the provided parameter, site number, county code, and state FIPS, within a specified date range. ### Method GET ### Endpoint /bysite/qa_annualpeferomanceeval ### Parameters #### Query Parameters - **parameter** (str) - Required - The parameter code of the air pollutant. - **bdate** (date) - Required - The begin date of the data selection. - **edate** (date) - Required - The end date of the data selection. - **stateFIPS** (str) - Required - The 2-digit state FIPS code. - **countycode** (str) - Required - The 3-digit county FIPS code. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date | None) - Optional - The beginning date of last change filter. - **cedate** (date | None) - Optional - The end date of last change filter. - **return_header** (bool | None) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns only the requested data (default: FALSE). ### Request Example ```python import pyaqsapi as aqs from datetime import date response = aqs.bysite.qa_annualpeferomanceeval( parameter="42401", bdate=date(year=2015, month=5, day=1), edate=date(year=2019, month=5, day=2), stateFIPS="15", countycode="001", sitenum="0007" ) ``` ### Response #### Success Response (200) - **qa_data** (DataFrame or AQSAPI_V2) - A pandas DataFrame or AQSAPI_V2 object containing quality assurance performance evaluation data for the specified site and time frame. #### Response Example (DataFrame representation of QA data) ``` -------------------------------- ### GET /qa_flowrateaudit Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves quality assurance flow rate audit data aggregated by parameter, state, county, and site for a specified date range. ```APIDOC ## GET /qa_flowrateaudit ### Description Return Quality assurance flowrate audit data. Return a table containing flow rate audit data aggregated by parameter code, stateFIPS, countycode and site number for bdate - edate time frame. ### Method GET ### Endpoint /qa_flowrateaudit ### Parameters #### Query Parameters - **parameter** (str or list) - Required - The parameter code(s) for the air pollutant. - **bdate** (date) - Required - The beginning date for data selection. - **edate** (date) - Required - The end date for data selection. - **stateFIPS** (str) - Required - The 2-digit state FIPS code. - **countycode** (str) - Required - The 3-digit county FIPS code. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date | None) - Optional - The beginning date of last change for filtering data. - **cedate** (date | None) - Optional - The end date of last change for filtering data. - **return_header** (bool | None) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns data only (default False). ### Request Example ```python import pyaqsapi as aqs from datetime import date response = aqs.bysite.qa_flowrateaudit( parameter="88101", bdate=date(year=2018, month=1, day=1), edate=date(year=2018, month=1, day=31), stateFIPS="01", countycode="073", sitenum="2003" ) ``` ### Response #### Success Response (200) - **data** (DataFrame or AQSAPI_V2) - Flow rate audit data for the requested site, county, state, and time period. #### Response Example ```json { "data": [ { "key": "88101-01-073-2003-2018-01-01", "parameter": "88101", "dateLocal": "2018-01-01T00:00:00.000-0600", "state": "Alabama", "county": "Autauga", "site_number": "2003", "site_address": "123 MAIN ST, PRATTVILLE, AL 36067", "latitude": 32.45, "longitude": -86.45, "datum": "WGS84", "precision": "1", "sample_duration": "1", "pollutant_standard": "AL HWY 14 AT RD 24", "aqi": null, "primary_pollutant_indicator": "N", "validity_indicator": "Y", "flag_code": null, "flowrate_audit_flags": "0" } ] } ``` ``` -------------------------------- ### Retrieve Site Monitors using pyaqsapi Source: https://usepa.github.io/pyaqsapi/pyaqsapi Fetches a table of all monitors for a specified site, parameter, and date range. Requires site details (state FIPS, county code, site number) and a date range. Returns a pandas DataFrame. ```python import pyaqsapi as aqs from datetime import date aqs.bysite.monitors(parameter="42401", bdate=date(year=2015, month=5, day=1), edate=date(year=2019, month=5, day=2), stateFIPS="15", countycode="001", sitenum="0007") ``` -------------------------------- ### GET /qa_pep_audit Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves Performance Evaluation Program (PEP) audit data aggregated by parameter code, stateFIPS, countycode, and site number for a specified time frame. ```APIDOC ## GET /qa_pep_audit ### Description Retrieves Performance Evaluation Program (PEP) audit data aggregated by parameter code, stateFIPS, countycode, and site number for a specified time frame. ### Method GET ### Endpoint /qa_pep_audit ### Parameters #### Query Parameters - **parameter** (str) - Required - The parameter code of the air pollutant. - **bdate** (date) - Required - The begin date of the data selection. - **edate** (date) - Required - The end date of the data selection. - **stateFIPS** (str) - Required - The 2-digit state FIPS code. - **countycode** (str) - Required - The 3-digit county code. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date | None) - Optional - The "beginning date of last change" to filter data. - **cedate** (date | None) - Optional - The "end date of last change" to filter data. - **return_header** (bool | None) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns only the requested data. ### Request Example (No specific example provided in the source text for this endpoint, but it would follow a similar structure to qa_one_point_qc) ### Response #### Success Response (200) - **data** (pandas DataFrame or AQSAPI_V2 object) - The requested PEP audit data. ``` -------------------------------- ### GET /pyaqsapi/bysite/sampledata Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves sample data aggregated at the site level for a given air quality parameter, site, and date range. It allows filtering by a specific duration code and by the last change date. ```APIDOC ## GET /pyaqsapi/bysite/sampledata ### Description Retrieves sample data aggregated at the site level for a given air quality parameter, site, and date range. It allows filtering by a specific duration code and by the last change date. ### Method GET ### Endpoint /pyaqsapi/bysite/sampledata ### Parameters #### Query Parameters - **parameter** (str) - Required - The parameter code for the air pollutant. Can be a list or a single string. - **bdate** (date) - Required - The start date for the data retrieval. - **edate** (date) - Required - The end date for the data retrieval. - **stateFIPS** (str) - Required - The 2-digit FIPS code for the state. - **countycode** (str) - Required - The 3-digit FIPS code for the county. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date | None) - Optional - The "beginning date of last change" to filter data by. - **cedate** (date | None) - Optional - The "end date of last change" to filter data by. - **duration** (str | None) - Optional - The parameter duration code to filter returned data. Use `aqs_sampledurations()` for a list of available codes. - **return_header** (bool | None) - Optional - If FALSE (default), returns only the requested data. If TRUE, returns an AQSAPI_v2 object. ### Response #### Success Response (200) - **AQSAPI_V2 | DataFrame** - Sample data aggregated at the site level matching the input criteria. ``` -------------------------------- ### Retrieve Ozone Monitoring Data with pyaqsapi Source: https://usepa.github.io/pyaqsapi/pyaqsapi This code snippet demonstrates how to retrieve ozone monitoring data for a specific site using the 'pyaqsapi' library. It specifies the parameter, date range, state, county, and site number. The function handles data retrieval, including potential multi-year data limitations and API call pacing. ```python import pyaqsapi as aqs from datetime import date aqs.bysite.sampledata(parameter="44201", bdate=date(year=2017, month=6, day=18), edate=date(year=2017, month=6, day=18), stateFIPS="37", countycode="183", sitenum="0014") ``` -------------------------------- ### GET /qa_one_point_qc Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves One Point QC data for a specified site, pollutant, and date range. This function handles data retrieval by making repeated calls to the AQS API for yearly data segments. ```APIDOC ## GET /qa_one_point_qc ### Description Retrieves One Point QC data for a specified site, pollutant, and date range. This function handles data retrieval by making repeated calls to the AQS API for yearly data segments. ### Method GET ### Endpoint /qa_one_point_qc ### Parameters #### Query Parameters - **parameter** (str) - Required - The parameter code of the air pollutant. - **bdate** (date) - Required - The begin date of the data selection. - **edate** (date) - Required - The end date of the data selection. - **stateFIPS** (str) - Required - The 2-digit state FIPS code. - **countycode** (str) - Required - The 3-digit county code. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date | None) - Optional - The "beginning date of last change" to filter data. - **cedate** (date | None) - Optional - The "end date of last change" to filter data. - **return_header** (bool | None) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns only the requested data. ### Request Example ```python import pyaqsapi as aqs from datetime import date aqs.bysite.qa_one_point_qc( parameter="44201", bdate=date(year=2018, month=1, day=1), edate=date(year=2018, month=1, day=31), stateFIPS="25", countycode="001", sitenum="0002" ) ``` ### Response #### Success Response (200) - **data** (pandas DataFrame or AQSAPI_V2 object) - The requested air quality data. ``` -------------------------------- ### GET /qa_annualperformanceevaltransaction Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves raw annual performance evaluation data in a transaction format (RD) for a specific monitoring site and parameter. It aggregates data by site for the given time frame and filters based on provided location and date parameters. ```APIDOC ## GET /qa_annualperformanceevaltransaction ### Description Retrieves raw annual performance evaluation data in a transaction format (RD) for a specific monitoring site and parameter. It aggregates data by site for the given time frame and filters based on provided location and date parameters. ### Method GET ### Endpoint /qa_annualperformanceevaltransaction ### Parameters #### Query Parameters - **parameter** (str or list) - Required - The parameter code of the air pollutant. - **bdate** (date) - Required - The begin date for data selection. - **edate** (date) - Required - The end date for data selection. - **stateFIPS** (str) - Required - The 2-digit state FIPS code. - **countycode** (str) - Required - The 3-digit county FIPS code. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date) - Optional - The beginning date of last change to filter data. - **cedate** (date) - Optional - The end date of last change to filter data. - **return_header** (bool) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns only the requested data (default: False). ### Request Example ```python import pyaqsapi as aqs from datetime import date response = aqs.bysite.qa_annualperformanceevaltransaction( parameter="44201", bdate=date(year=2017, month=1, day=1), edate=date(year=2017, month=12, day=31), stateFIPS="01", countycode="003", sitenum="0010" ) ``` ### Response #### Success Response (200) - **DataFrame** or **AQSAPI_V2 object** - Quality assurance performance evaluation data for a single monitoring site. ``` -------------------------------- ### Data Mart - Site Level Aggregates Source: https://usepa.github.io/pyaqsapi/_sources/manual/pyaqsapiFunctions-Long Provides functions to aggregate air quality data at the site level. This includes summaries, monitor information, and QA data. ```APIDOC ## Data Mart Aggregate Functions by Site ### Description Functions that aggregate air quality data at the site level. ### Functions - **bysite.annualsummary**: Retrieves annual summary data for a site. - **bysite.dailysummary**: Retrieves daily summary data for a site. - **bysite.monitors**: Retrieves information about monitors at a site. - **bysite.qa_annualpeferomanceeval**: Retrieves QA annual performance evaluation data for a site. - **bysite.qa_annualperformanceevaltransaction**: Retrieves QA annual performance evaluation transaction data for a site. - **bysite.qa_blanks**: Retrieves QA blank data for a site. - **bysite.qa_collocated_assessments**: Retrieves QA collocated assessment data for a site. - **bysite.qa_flowrateaudit**: Retrieves QA flow rate audit data for a site. - **bysite.qa_flowrateverification**: Retrieves QA flow rate verification data for a site. - **bysite.qa_one_point_qc**: Retrieves QA one-point QC data for a site. - **bysite.qa_pep_audit**: Retrieves QA PEP audit data for a site. - **bysite.quarterlysummary**: Retrieves quarterly summary data for a site. - **bysite.sampledata**: Retrieves sample data for a site. - **bysite.transactionsample**: Retrieves transaction sample data for a site. ### Parameters (Common to most bysite functions) #### Query Parameters - **parameter** (string) - Required - The air quality parameter to query. - **bdate** (string) - Required - The beginning date for the query (YYYY-MM-DD). - **edate** (string) - Required - The end date for the query (YYYY-MM-DD). - **stateFIPS** (string) - Required - The FIPS code for the state. - **countycode** (string) - Required - The FIPS code for the county. - **sitenum** (string) - Required - The site number. - **cbdate** (string) - Optional - The beginning date for the "common" period (used with sampledata, dailysummary, annualdata, quarterlysummary). - **cedate** (string) - Optional - The end date for the "common" period (used with sampledata, dailysummary, annualdata, quarterlysummary). - **return_header** (boolean) - Optional - Whether to return a header row (defaults to False). - **duration** (string) - Optional - The duration for sample data queries (only used with sampledata). ### Example Usage (bysite.sampledata) ```json { "example": "GET /api/bysite/sampledata?parameter=O3&bdate=2023-01-01&edate=2023-01-31&stateFIPS=06&countycode=001&sitenum=1001" } ``` ``` -------------------------------- ### POST /transactionsample Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves transaction sample data aggregated by site for a specified parameter, date range, and location. It handles multi-year requests by making individual calls for each year and includes a delay between calls to prevent API overload. ```APIDOC ## POST /transactionsample ### Description Retrieves transaction sample data aggregated by site in the AQS Submission Transaction Format (RD) raw data. This endpoint allows filtering by parameter, state, county, site, and date range. It also supports optional filtering by data last changed dates and can return additional header information. ### Method POST ### Endpoint `/transactionsample` ### Parameters #### Query Parameters - **parameter** (str) - Required - The parameter code of the air pollutant. Accepts a list or a single string. - **bdate** (date) - Required - The beginning date for data selection. - **edate** (date) - Required - The end date for data selection. - **stateFIPS** (str) - Required - The 2-digit state FIPS code. - **countycode** (str) - Required - The 3-digit county FIPS code. - **sitenum** (str) - Required - The 4-digit site number. - **cbdate** (date) - Optional - The beginning date for data last changed filter. - **cedate** (date) - Optional - The end date for data last changed filter. - **return_header** (bool) - Optional - If TRUE, returns an AQSAPI_v2 object; otherwise, returns only the requested data. Defaults to False. ### Request Body This endpoint does not explicitly define a request body in the provided documentation. Parameters are expected as query parameters. ### Request Example ```json { "parameter": "44201", "bdate": "2017-06-18", "edate": "2017-06-18", "stateFIPS": "37", "countycode": "183", "sitenum": "0014" } ``` ### Response #### Success Response (200) - **data** (DataFrame | AQSAPI_V2) - Transaction sample (raw) data in the AQS submission transaction format (RD) corresponding to the inputs provided. #### Response Example ```json { "data": [ { "Parameter Code": "44201", "Parameter Name": "Ozone", "Date Local": "2017-06-18", "Time Local": "13:00", "POC": "1", "Latitude": "35.9946", "Longitude": "-78.8775", "Datum": "WGS84", "Parameter Code": "44201", "Arithmetic Meaning": "Average", "First Max Value": "0.059", "First Max Hour": "12", "Units of Measure": "ppm", "Method Code": "4", "Method Name": "Pulsed Fluorescence \"Federal Reference Method\" (40 CFR part 50, Appendix D)\n", "State Name": "North Carolina", "County Name": "Wake", "Site Number": "0014", "Site Name": "Millbrook School", "StateFIPS": "37", "CountyFIPS": "183", "CO Site ID": "", "CO Site Name": "", "CBSA Name": "Raleigh-Cary, NC", "CBSA Code": "39340", "Regulatory Interval Type": "L", "Latitude": "35.9946", "Longitude": "-78.8775", "Elevation": "139.9", "Elevation Unit": "METERS", "Collection Method": "", "State Abbreviation": "NC" } ] } ``` ``` -------------------------------- ### Get Quarterly Summary Data by Site - Python Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves aggregated quarterly summary statistics for a specific site and parameter. This function returns data including mean value, maxima, and percentiles for the specified time frame. It's useful for analyzing trends over quarters. ```python import pyaqsapi as aqs from datetime import date # Example usage (assuming you have the necessary parameters defined): # aqs.bysite.quarterlysummary( # _parameter='44201', # _bdate=date(2023, 1, 1), # _edate=date(2023, 12, 31), # _stateFIPS='06', # _countycode='037', # _sitenum='1001' # ) ``` -------------------------------- ### Get PEP Audit Data by Site - Python Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves PEP audit data for a specific site within a given date range. It handles multiple years by making repeated API calls, with a 5-second delay between calls. This function is useful for analyzing historical PEP audit data. ```python import pyaqsapi as aqs from datetime import date # Example: Return a DataFrame of pep Audit data for FRM PM2.5 at the Huntsville Old Airport site (#0014) in Madison County, AL for 2017 - 2019:aqs.bysite.qa_pep_audit( parameter="88101", bdate=date(year=2017, month=1, day=1), edate=date(year=2019, month=12, day=31), stateFIPS="01", countycode="089", sitenum="0014" ) ``` -------------------------------- ### Get Annual Performance Evaluation Data using pyaqsapi Source: https://usepa.github.io/pyaqsapi/pyaqsapi Retrieves aggregated annual performance evaluation data for a specific monitoring site and parameter. Filters data by date range and site identifiers (state FIPS, county code, site number). Returns a pandas DataFrame or AQSAPI_V2 object. ```python pyaqsapi.bysite.qa_annualpeferomanceeval(_parameter : str_, _bdate : date_, _edate : date_, _stateFIPS : str_, _countycode : str_, _sitenum : str_, _cbdate : date | None = None_, _cedate : date | None = None_, _return_header : bool | None = False_) ``` -------------------------------- ### Data Mart Aggregate Functions by County Source: https://usepa.github.io/pyaqsapi/manual/pyaqsapiFunctions-Long The bycounty submodule allows aggregation of data at the county level, offering various summary and QA functions. ```APIDOC ## Data Mart Aggregate Functions by County ### Description The `bycounty` submodule exports functions that aggregate data at the county level. These functions are useful for analyzing air quality data across entire counties. ### Functions Exported - `bycounty.annualsummary` - `bycounty.dailysummary` - `bycounty.helperfunctions` - `bycounty.monitors` - `bycounty.qa_annualperformanceeval` - `bycounty.qa_annualperformanceevaltransaction` - `bycounty.qa_blanks` - `bycounty.qa_collocated_assessments` - `bycounty.qa_flowrateaudit` - `bycounty.qa_flowrateverification` - `bycounty.qa_one_point_qc` - `bycounty.qa_pep_audit` - `bycounty.quarterlysummary` - `bycounty.sampledata` - `bycounty.transactionsample ### Common Parameters All functions in the `bycounty` submodule accept the following primary parameters: #### Query Parameters - **parameter** (string) - Required - The pollutant parameter to query. - **bdate** (string) - Required - The begin date for the data query (YYYY-MM-DD). - **edate** (string) - Required - The end date for the data query (YYYY-MM-DD). - **stateFIPS** (string) - Required - The FIPS code for the state. - **countycode** (string) - Required - The FIPS code for the county. #### Optional Parameters - **cbdate** (string) - Optional - The begin date for a secondary date range, used with specific functions (e.g., `sampledata`, `dailysummary`). - **cedate** (string) - Optional - The end date for a secondary date range, used with specific functions (e.g., `sampledata`, `dailysummary`). - **return_header** (boolean) - Optional - If True, returns the header in the response. Defaults to False. - **duration** (string) - Optional - Used only with `sampledata` functions to specify the data duration. ```