Skip to content

Commit

Permalink
New code to better display issues with API calls and minor other mino…
Browse files Browse the repository at this point in the history
…r documentation related improvements
  • Loading branch information
mccroweyclinton-EPA committed Feb 16, 2024
1 parent 91c0c69 commit 5944be4
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 54 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, httr2]
branches: [main, httr2, test_github_workflow]
pull_request:
branches: [main, httr2]
branches: [main, httr2, test_github_workflow]

name: R-CMD-check

Expand All @@ -26,8 +26,8 @@ jobs:

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RAQSAPIKEY: ${{ secrets.RAQSAPIKEY }}
RAQSAPIUSERNAME: ${{ secrets.RAQSAPIUSERNAME }}
RAQSAPIKEY: ${{ vars.RAQSAPIKEY }}
RAQSAPIUSERNAME: ${{ vars.RAQSAPIUSERNAME }}
R_KEEP_PKG_SOURCE: yes

steps:
Expand Down
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ Suggests:
testthat (>= 3.0.0),
usethis,
withr
SystemRequirements: package manual requires pandoc (>= 1.14) http://pandoc.org
RoxygenNote: 7.2.3
SystemRequirements: package manual and Vignettes require pandoc
(>= 1.14) http://pandoc.org)
RoxygenNote: 7.3.1
VignetteBuilder: knitr
BuildVignettes: true
ByteCompile: true
Expand Down
22 changes: 11 additions & 11 deletions MD5
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
d3a7f7cc6aca27a043309d5bf9f32edc *codemeta.json
bfa24dfc7e0f2f217163fa917e8d2392 *cran-comments.md
bfa24dfc7e0f2f217163fa917e8d2392 *cran-comments.Rmd
7b3092d9d1ec246090f159fd55deeb57 *DESCRIPTION
32b197cb6b7fa3ce90996cf9cad52d01 *DESCRIPTION
1dc95961c4c280f8645a65d15662725f *dev/contributing.md
4fc13def6ec5d889261f1f22a13ba542 *dev/contributing.Rmd
74e297a0dc0b508ed18e3821264958d0 *dev/countlinesofcode.R
Expand Down Expand Up @@ -116,10 +116,10 @@ f41ed996be135fb35afe00641621da61 *man/figures/lifecycle-questioning.svg
306bef67d1c636f209024cf2403846fd *man/figures/lifecycle-soft-deprecated.svg
ed42e3fbd7cc30bc6ca8fa9b658e24a8 *man/figures/lifecycle-stable.svg
bf2f1ad432ecccee3400afe533404113 *man/figures/lifecycle-superseded.svg
7ce4525010156c02adaf819a8c835134 *man/RAQSAPI.Rd
792c28b91a2c0b5e0b060a2f18a20464 *man/RAQSAPI.Rd
797940f405cb85557ee355e7eae5894d *NAMESPACE
904839971aff979c1716322c7d8bcdff *NEWS.md
b63d94a18d37de10925e09e6c3bb2eeb *R/AQSAPI_helperfunctions.R
d214f5204ba0d95601a92910109aad5e *R/AQSAPI_helperfunctions.R
a3558975d0256839b174ab7868833075 *R/bybox.R
bd8b36cc7325d4fc8b8ed894f0046678 *R/bycbsa.R
253ea551f88c65c1c49feff3cb33f552 *R/bycounty.R
Expand All @@ -133,7 +133,7 @@ d82b1ff8ee144afca1879e5b8dc58840 *R/byma.R
e6e3b87e48f4403642382987b0f40714 *R/setupfunctions.R
6e659bb3bbf313dc819d4c029f0b22d0 *R/zzz.R
a69de5455537022556f014579766be59 *RAQSAPI.Rproj
feb8f6defa51349e6110273bedcc046b *README.md
4a756ab5cecfa9d56c075e6ed5353d6b *README.md
b2370e0e3f63a29557cd8f74746d74f6 *README.Rmd
7ed08f3fb96a77ec01c95c2ad7964250 *revdep/data.sqlite
34952a5944548ea4fc132a9899f8e6ab *revdep/email.yml
Expand Down Expand Up @@ -1329,8 +1329,8 @@ f7ea691da1baf266047ed7af4b0c4629 *tests/testthat/test-bypqao.R
051416af24d0386f084eb13a14053ce1 *tests/testthat/test-bystate.R
014b81fb9c8d2350e1347841f41b24a3 *tests/testthat/test-helperfunctions.R
e897203bb026b43141e5bc00dfe3cecd *tests/testthat/test-RAQSAPlistfunctions.R
183ed69a443baffdf0454255cade3fcc *vignettes/Acknowledgements.html
18cea3348cace002e6c706d373beb524 *vignettes/Acknowledgements.Rmd
a55434f85eb9ec8d1c4706997b49cc10 *vignettes/Acknowledgements.html
1798121e142b3da718a2e54435a7ef9a *vignettes/Acknowledgements.Rmd
22d607e5d49e10047a911e5d42183c34 *vignettes/acs-nano.csl
0ec78b946a45069323acf54a24c77566 *vignettes/american-chemical-society.csl
e1df58c4692ce8a6e9743bf9d594ff9e *vignettes/AQSAPI.bib
Expand All @@ -1347,9 +1347,9 @@ ad142c2e81fca7371499f09e294c1dba *vignettes/pyaqsapi.R
733ccd06aa9a7988d1ea78f52c528e55 *vignettes/pyaqsapi.Rmd
8774f9c513ba8110c612b8ccfb9603e3 *vignettes/RAQSAPIFunctions-Brief.html
1dbae57a3f574ccd77b4d2af2c76e831 *vignettes/RAQSAPIFunctions-Brief.Rmd
9b96ebd481321226caedaa7ab4472d05 *vignettes/RAQSAPIFunctions-Long.html
d7c4cb348a250e4f40d1d510cec2df3d *vignettes/RAQSAPIFunctions-Long.R
e923e364682d337856051526b5b8b3a6 *vignettes/RAQSAPIFunctions-Long.Rmd
f1b8ea1d165c0d47b105678c37b32c57 *vignettes/RAQSAPIFunctions-Long.html
7146486d6cb6c29314f88f0e2bbb5ab2 *vignettes/RAQSAPIFunctions-Long.R
e845be67ff86dba758853123789979e5 *vignettes/RAQSAPIFunctions-Long.Rmd
d375e86106c359f735a25d53764b7f8e *vignettes/RAQSAPIPurpose.html
2a912d01a36839facb5c2c6dff2d1c7f *vignettes/RAQSAPIPurpose.R
9d564369cb22e187ed61da9fafcac002 *vignettes/RAQSAPIPurpose.Rmd
Expand All @@ -1360,7 +1360,7 @@ d375e86106c359f735a25d53764b7f8e *vignettes/RAQSAPIPurpose.html
95acca4cbbfe5ebbfcb4c0a3978038bf *vignettes/RAQSAPIvignette.Rmd
42a066ce73b20f2538877f8e4eac1d84 *vignettes/TimelinessofAQSData.html
fddf2cec564191b24c0213f260c0f932 *vignettes/TimelinessofAQSData.Rmd
4a6f61ae81515d8b770f30841ef17fc1 *vignettes/Troubleshooting.html
1fee66dbee4d04b47a0b7747ea282a5b *vignettes/Troubleshooting.Rmd
3c09aefb6ebd2dd7f1e623f3eb341b6e *vignettes/Troubleshooting.html
9388c6af388ceb5b62fee3e414452c83 *vignettes/Troubleshooting.Rmd
2f01e9fde3b3c8b82aafc174e2b66833 *vignettes/UsingRAQSAPI.html
969189538d2ec6a0e10ea6d7350ab612 *vignettes/UsingRAQSAPI.Rmd
10 changes: 5 additions & 5 deletions R/AQSAPI_helperfunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,11 @@ RAQSAPI_error_msg <- function(AQSresponse)
resp_body_json()

msg <- glue("At server request time: {AQSresponse$headers$Date}
RAQSAPI experienced an error while processing the following url:
{AQSresponse$url}\n
with status_code: {AQSresponse$status_code}
and status message: {AQSresponse$status}
Server error message: {AQSerr$Header[[1]]$error}")
RAQSAPI experienced an error while processing the following url:
{gsub('(.)', '\\1 ', AQSresponse$url)}\n
with status_code: {AQSresponse$status_code}
and status message: {AQSresponse$status}
Server error message: {AQSerr$Header[[1]]$error}")

return(msg)
#nocov end
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ status](https://www.r-pkg.org/badges/version/RAQSAPI)](https://CRAN.R-project.or
downloads](https://cranlogs.r-pkg.org/badges/RAQSAPI)](https://cran.r-project.org/package=RAQSAPI)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![license](https://img.shields.io/badge/license-CC0-lightgrey.svg)](https://choosealicense.com/)
[![Last-changedate](https://img.shields.io/badge/last%20change-%202024--01--03-yellowgreen.svg)](/commits/master)
[![Last-changedate](https://img.shields.io/badge/last%20change-%202024--02--16-yellowgreen.svg)](/commits/master)
<!-- badges: end -->

# EPA Disclaimer
Expand Down Expand Up @@ -408,8 +408,7 @@ those sources with them RAQSAPI would not be possible.
- README badges are provided by R package `badgecreator`<sup>5</sup>.
- The R package `usethis`<sup>6</sup> was used to generate GitHub
actions for Continuous integration (CI).
- Code cleanup was assisted by the R package
`lintr`<sup>7</sup><data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAWElEQVR42mNgGPTAxsZmJsVqQApgmGw1yApwKcQiT7phRBuCzzCSDSHGMKINIeDNmWQlA2IigKJwIssQkHdINgxfmBBtGDEBS3KCxBc7pMQgMYE5c/AXPwAwSX4lV3pTWwAAAABJRU5ErkJggg==>
- Code cleanup was assisted by the R package `lintr`<sup>7</sup>
- the function *install.packages* are provided by the R package
`utils`<sup>8</sup>
- the function *install_github* are provided by the R package
Expand Down
2 changes: 1 addition & 1 deletion man/RAQSAPI.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/Acknowledgements.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ with them RAQSAPI would not be possible.
* README badges are provided by R package `badgecreator`[@package:badgecreatr].
* The R package `usethis`[@package:usethis] was used to generate GitHub actions
for Continuous integration (CI).
* Code cleanup was assisted by the R package `lintr`[@package:lintr]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAWElEQVR42mNgGPTAxsZmJsVqQApgmGw1yApwKcQiT7phRBuCzzCSDSHGMKINIeDNmWQlA2IigKJwIssQkHdINgxfmBBtGDEBS3KCxBc7pMQgMYE5c/AXPwAwSX4lV3pTWwAAAABJRU5ErkJggg==
* Code cleanup was assisted by the R package `lintr`[@package:lintr]
* the function *install.packages* are provided by the R package `utils`[@RBase]
* the function *install_github* are provided by the R package `remotes`[
@package:remotes]
Expand Down
26 changes: 13 additions & 13 deletions vignettes/RAQSAPIFunctions-Long.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## ----RAQSAPIfun_all, echo = FALSE, comment = NA----------------------------------------------------------------------------------------
## ----RAQSAPIfun_all, echo = FALSE, comment = NA---------------------------------------------------------------------------------------------------------------------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>" )
invisible(library(magrittr, warn.conflicts = FALSE, quietly = TRUE))
invisible(library(stringr, warn.conflicts = FALSE, quietly = TRUE))
Expand Down Expand Up @@ -106,21 +106,21 @@ RAQSAPI_functions <- c(
RAQSAPI_functions %>%
cat(sep = " \n")

## ----SIGNUPANDCREDENTIALS, echo = FALSE, comment = NA----------------------------------------------------------------------------------
## ----SIGNUPANDCREDENTIALS, echo = FALSE, comment = NA---------------------------------------------------------------------------------------------------------------------------------------------------------------
signupandcredentials <- paste(".sign_up", ".credentials", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = signupandcredentials) %>%
cat(sep = " \n")

## ----METADATAFUNCTIONS, echo = FALSE, comment = NA-------------------------------------------------------------------------------------
## ----METADATAFUNCTIONS, echo = FALSE, comment = NA------------------------------------------------------------------------------------------------------------------------------------------------------------------
metadatafunctions <- paste(".available",
".field_by_service",
".fields_by_service",
".knownissues", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = metadatafunctions) %>%
cat(sep = " \n")

## ----LISTFUNCTIONS, echo = FALSE, comment = NA-----------------------------------------------------------------------------------------
## ----LISTFUNCTIONS, echo = FALSE, comment = NA----------------------------------------------------------------------------------------------------------------------------------------------------------------------
listfunctions <- paste(".states",
".counties_by_state",
".sites_by_county",
Expand All @@ -134,49 +134,49 @@ listfunctions <- paste(".states",
str_subset(string = RAQSAPI_functions, pattern = listfunctions) %>%
cat(sep = " \n")

## ----_by_Sitefunctions, echo = FALSE, comment = NA-------------------------------------------------------------------------------------
## ----_by_Sitefunctions, echo = FALSE, comment = NA------------------------------------------------------------------------------------------------------------------------------------------------------------------
by_sitefunctions <- paste("_by_site", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = by_sitefunctions) %>%
cat(sep = " \n")

## ----_by_countyfuncions, echo = FALSE, comment = NA------------------------------------------------------------------------------------
## ----_by_countyfuncions, echo = FALSE, comment = NA-----------------------------------------------------------------------------------------------------------------------------------------------------------------
by_countyfunctions <- paste("._by_county", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = by_countyfunctions) %>%
cat(sep = " \n")

## ----_by_STATEfunctions, echo = FALSE, comment = NA------------------------------------------------------------------------------------
## ----_by_STATEfunctions, echo = FALSE, comment = NA-----------------------------------------------------------------------------------------------------------------------------------------------------------------
by_STATEfunctions <- paste("._by_state", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = by_STATEfunctions) %>%
cat(sep = " \n")

## ----_by_MAfunctions, echo = FALSE, comment = NA---------------------------------------------------------------------------------------
## ----_by_MAfunctions, echo = FALSE, comment = NA--------------------------------------------------------------------------------------------------------------------------------------------------------------------
by_MAfunctions <- paste("._by_MA", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = by_MAfunctions) %>%
cat(sep = " \n")

## ----bycbsafunctions, echo = FALSE, comment = NA---------------------------------------------------------------------------------------
## ----bycbsafunctions, echo = FALSE, comment = NA--------------------------------------------------------------------------------------------------------------------------------------------------------------------
by_cbsafunctions <- paste("._by_cbsa", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = by_cbsafunctions) %>%
cat(sep = " \n")

## ----_by_pqaofunctions, echo = FALSE, comment = NA-------------------------------------------------------------------------------------
## ----_by_pqaofunctions, echo = FALSE, comment = NA------------------------------------------------------------------------------------------------------------------------------------------------------------------
by_pqaofunctions <- paste("._by_pqao", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = by_pqaofunctions) %>%
cat(sep = " \n")

## ----_by_BOXfunctions, echo = FALSE, comment = NA--------------------------------------------------------------------------------------
## ----_by_BOXfunctions, echo = FALSE, comment = NA-------------------------------------------------------------------------------------------------------------------------------------------------------------------
by_BOXfunctions <- paste("._by_box", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = by_BOXfunctions) %>%
cat(sep = " \n")

## ----misc, echo = FALSE, comment = NA--------------------------------------------------------------------------------------------------
## ----misc, echo = FALSE, comment = NA-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
misc_functions <- paste("aqs_removeheader", sep = '|')

str_subset(string = RAQSAPI_functions, pattern = misc_functions) %>%
Expand Down
15 changes: 7 additions & 8 deletions vignettes/RAQSAPIFunctions-Long.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -257,18 +257,19 @@ The RAQSAPI::aqs_credentials function takes two parameters:
## Data Mart API metadata functions
```{r METADATAFUNCTIONS, echo = FALSE, comment = NA}
metadatafunctions <- paste(".available",
".field_by_service",
".fields_by_service",
".knownissues", sep = '|')
str_subset(string = RAQSAPI_functions, pattern = metadatafunctions) %>%
cat(sep = " \n")
```
These functions return Data Mart meta data
These functions return the status of Data Mart API or metadata associated with
it.

The RAQSAPI::aqs_isavailable function takes no parameters and returns a
table which details the status of the AQS API.

The RAQSAPI::aqs_field_by_Service function takes one parameter, service,
The RAQSAPI::aqs_fields_by_service function takes one parameter, service,
which is a R character object which represents the services provided by
the AQS API. For a list of available services see
[Air Quality System (AQS) API - Services Overview](
Expand Down Expand Up @@ -300,7 +301,7 @@ listfunctions <- paste(".states",
str_subset(string = RAQSAPI_functions, pattern = listfunctions) %>%
cat(sep = " \n")
```
List functions return the status, API options or groupings that can be used in
List functions return the API options or groupings that can be used in
conjunction with other API calls. By default each function in this category
returns results as a tibble. If return_header parameter is set to TRUE a
AQSAPI_v2 object is returned instead.
Expand Down Expand Up @@ -580,8 +581,7 @@ functions in this family of functions aggregate data at the county level.
* duration (optional): (This parameter is only used in conjunction with
*\*sampledata_by_*\* functions).

### Data Mart aggregate functions by Monitoring agency (MA)

### Data Mart aggregate functions _by_state
```{r _by_STATEfunctions, echo = FALSE, comment = NA}
by_STATEfunctions <- paste("._by_state", sep = '|')
Expand All @@ -607,6 +607,7 @@ functions in this family of functions aggregate data at the state level.
* duration (optional): (This parameter is only used in conjunction with
*\*sampledata_by_*\* functions).

### Data Mart aggregate functions by Monitoring agency (MA)
```{r _by_MAfunctions, echo = FALSE, comment = NA}
by_MAfunctions <- paste("._by_MA", sep = '|')
Expand Down Expand Up @@ -707,8 +708,6 @@ Functions in this family of functions aggregate data by a
* duration (optional): (This parameter is only used in conjunction with
*\*sampledata_by_*\* functions).

### Data Mart aggregate functions _by_state

### RAQSAPI Miscellaneous functions
```{r misc, echo = FALSE, comment = NA}
misc_functions <- paste("aqs_removeheader", sep = '|')
Expand Down
12 changes: 6 additions & 6 deletions vignettes/Troubleshooting.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ vignette: >

# Troubleshooting

parameters must be supplied exactly as they are specified, for example the
Parameters must be supplied exactly as they are specified, for example the
stateFIPS for Alabama is "01", entering a value of "1" for the stateFIPS
may lead to unexpected results. Do not omit leading zeros in parameters that
expect them.
Expand All @@ -22,8 +22,8 @@ In Functions that have the return_header=TRUE option set the returned object is
an AQSAPI_v2 object, this is a 2 item list where the first object is a tibble
with the label \$Header, the second, a tibble with the label \$Data. sampledata
functions are limited by the API to one calendar year of data per API call so if
the user requests multiple years of data the sampledata call will return multiple
AQSAPI_v2 objects, one for each call to the API. The returned result is a list
of AQSAPI_v2 objects. In R to access the data in each item in the list the user
will need to use the "double bracket operator" ("[[", "]]") not the single
bracket operator ("[", "]").
the user requests multiple years of data the sampledata call will return
multiple AQSAPI_v2 objects, one for each call to the API. The returned result is
a list of AQSAPI_v2 objects. In R to access the data in each item in the list
the user will need to use the "double bracket operator" ("[[", "]]") not the
single bracket operator ("[", "]").

0 comments on commit 5944be4

Please sign in to comment.