software-review icon indicating copy to clipboard operation
software-review copied to clipboard

presubmission request for R package RAQSAPI v2.0.5

Open mccroweyclinton-EPA opened this issue 6 months ago • 35 comments

Submitting Author Name: Clinton Mccrowey Submitting Author Github Handle: @mccroweyclinton-EPA Version submitted: 2.0.5 Repository: https://github.com/USEPA/RAQSAPI Submission type: submission Language: en


Retrieve air monitoring data and associated metadata from the US Environmental Protection Agency's Air Quality System service using functions. See https://aqs.epa.gov/aqsweb/documents/data_api.html for details about the US EPA Data Mart API.


Scope

  • Please indicate which category or categories from our package fit policies or statistical package categories this package falls under. (Please check one or more appropriate boxes below):

    Data Lifecycle Packages

    • [X] data retrieval
    • [ ] data extraction
    • [ ] data munging
    • [ ] data deposition
      • [ ] data validation and testing
    • [ ] workflow automation
    • [ ] version control
    • [ ] citation management and bibliometrics
    • [ ] scientific software wrappers
    • [ ] field and lab reproducibility tools
    • [ ] database software bindings
    • [ ] geospatial data
    • [ ] text analysis

    Statistical Packages

    • [ ] Bayesian and Monte Carlo Routines
    • [ ] Dimensionality Reduction, Clustering, and Unsupervised Learning
    • [ ] Machine Learning
    • [ ] Regression and Supervised Learning
    • [ ] Exploratory Data Analysis (EDA) and Summary Statistics
    • [ ] Spatial Analyses
    • [ ] Time Series Analyses
    • [ ] Probability Distributions
  • Explain how and why the package falls under these categories (briefly, 1-2 sentences). Please note any areas you are unsure of: RAQSAPI is a R package that was designed specifically as a simple interface to the US Environmental Protection Agency Air Quality System Data Mart API which is a data store of ambient air pollution data collected by EPA, state, local, and tribal air pollution control agencies from over thousands of monitors. AQS also contains meteorological data, descriptive information about each monitoring station (including its geographic location and its operator), and data quality assurance/quality control information.

  • If submitting a statistical package, have you already incorporated documentation of standards into your code via the srr package?

  • Who is the target audience and what are scientific applications of this package?
    Environmental scientists and data scientist

  • Are there other R packages that accomplish the same thing? If so, how does yours differ or meet our criteria for best-in-category?

aqsr, RAQSAPI is still under active development and will be updated reflecting future changes to the AQS Data MART API. RAQSAPI is developed by EPA staff. RAQSAPI allow for multi year data pulls. Also RAQSAPI is the only package that I am aware of that is available from CRAN.

mccroweyclinton-EPA avatar Jun 26 '25 15:06 mccroweyclinton-EPA

@ropensci-review-bot check package

mpadge avatar Jun 26 '25 15:06 mpadge

Thanks, about to send the query.

ropensci-review-bot avatar Jun 26 '25 15:06 ropensci-review-bot

:rocket:

The following problems were found in your submission template:

  • submission type must be one of [Standard, Estandar, Stats]
  • HTML variable [editor] is missing
  • HTML variable [reviewers-list] is missing
  • HTML variable [due-dates-list] is missing Editors: Please ensure these problems with the submission template are rectified. Package checks have been started regardless.

:wave:

ropensci-review-bot avatar Jun 26 '25 15:06 ropensci-review-bot

Checks for RAQSAPI (v2.0.5)

git hash: 3df1ef76

  • :heavy_check_mark: Package is already on CRAN.
  • :heavy_check_mark: has a 'codemeta.json' file.
  • :heavy_multiplication_x: does not have a 'contributing' file.
  • :heavy_multiplication_x: The following function has no documented return value: [aqs_qa_annualpeferomanceeval_by_site]
  • :heavy_check_mark: uses 'roxygen2'.
  • :heavy_check_mark: 'DESCRIPTION' has a URL field.
  • :heavy_check_mark: 'DESCRIPTION' has a BugReports field.
  • :heavy_check_mark: Package has at least one HTML vignette
  • :heavy_multiplication_x: These functions do not have examples: [aqs_metadata_service, aqs_services_by_box, aqs_services_by_cbsa, aqs_services_by_county, aqs_services_by_MA, aqs_services_by_pqao, aqs_services_by_site, aqs_services_by_state, aqs_qa_annualpeferomanceeval_by_site].
  • :heavy_check_mark: Package has continuous integration checks.
  • :heavy_multiplication_x: Package coverage failed
  • :heavy_multiplication_x: R CMD check found 1 error.
  • :heavy_check_mark: R CMD check found no warnings.

Important: All failing checks above must be addressed prior to proceeding

Package License: MIT + file LICENSE


1. Package Dependencies

Details of Package Dependency Usage (click to open)

The table below tallies all function calls to all packages ('ncalls'), both internal (r-base + recommended, along with the package itself), and external (imported and suggested packages). 'NA' values indicate packages to which no identified calls to R functions could be found. Note that these results are generated by an automated code-tagging system which may not be entirely accurate.

type package ncalls
internal RAQSAPI 325
internal base 123
internal stats 4
internal utils 2
internal methods 1
imports purrr 207
imports lubridate 15
imports glue 7
imports dplyr 6
imports tibble 6
imports httr2 2
imports rlang 2
imports stringr 1
imports lifecycle NA
imports magrittr NA
suggests covr NA
suggests devtools NA
suggests keyring NA
suggests knitr NA
suggests markdown NA
suggests rmarkdown NA
suggests roxygen2 NA
suggests spelling NA
suggests testthat NA
suggests usethis NA
suggests withr NA
linking_to NA NA

Click below for tallies of functions used in each package. Locations of each call within this package may be generated locally by running 's <- pkgstats::pkgstats(<path/to/repo>)', and examining the 'external_calls' table.

RAQSAPI

aqsmultiyearparams (64), aqs_services_by_county (42), aqs_services_by_site (42), aqs_services_by_state (42), aqs_services_by_MA (27), aqs_services_by_pqao (24), aqs_services_by_box (15), aqs_services_by_cbsa (15), format_multiple_params_for_api (15), aqs (11), format_variables_for_api (4), aqs_metadata_service (3), aqs_annualsummary_by_box (1), aqs_annualsummary_by_cbsa (1), aqs_annualsummary_by_county (1), aqs_annualsummary_by_site (1), aqs_annualsummary_by_state (1), aqs_cbsas (1), aqs_classes (1), aqs_counties_by_state (1), aqs_credentials (1), aqs_dailysummary_by_box (1), aqs_dailysummary_by_cbsa (1), aqs_dailysummary_by_county (1), aqs_dailysummary_by_site (1), aqs_dailysummary_by_state (1), aqs_fields_by_service (1), aqs_isavailable (1), aqs_knownissues (1), aqs_mas (1), aqs_monitors_by_box (1), aqs_monitors_by_cbsa (1), RAQSAPI_error_msg (1)

purrr

pmap (207)

base

c (31), format (28), list (28), all (6), is.na (6), with (5), I (4), class (2), names (2), vector (2), character (1), length (1), message (1), paste (1), return (1), sys.call (1), Sys.getenv (1), sys.parent (1), url (1)

lubridate

is.Date (4), year (4), ymd (4), day (1), month (1), years (1)

glue

glue (7)

dplyr

select_if (6)

tibble

tibble (6)

stats

filter (4)

httr2

last_response (1), request (1)

rlang

abort (1), call_name (1)

utils

globalVariables (1), history (1)

methods

as (1)

stringr

str_c (1)

NOTE: Some imported packages appear to have no associated function calls; please ensure with author that these 'Imports' are listed appropriately.


2. Statistical Properties

This package features some noteworthy statistical properties which may need to be clarified by a handling editor prior to progressing.

Details of statistical properties (click to open)

The package has:

  • code in R (99% in 13 files) and YAML (1% in 1 files)
  • 1 authors
  • 13 vignettes
  • no internal data file
  • 10 imported packages
  • 102 exported functions (median 12 lines of code)
  • 128 non-exported functions in R (median 21 lines of code)

Statistical properties of package structure as distributional percentiles in relation to all current CRAN packages The following terminology is used:

  • loc = "Lines of Code"
  • fn = "function"
  • exp/not_exp = exported / not exported

All parameters are explained as tooltips in the locally-rendered HTML version of this report generated by the checks_to_markdown() function

The final measure (fn_call_network_size) is the total number of calls between functions (in R), or more abstract relationships between code objects in other languages. Values are flagged as "noteworthy" when they lie in the upper or lower 5th percentile.

measure value percentile noteworthy
files_R 13 66.1
files_vignettes 20 99.9
files_tests 12 89.4
loc_R 2160 83.4
loc_vignettes 1678 96.0 TRUE
loc_tests 869 80.9
num_vignettes 13 99.8 TRUE
n_fns_r 230 90.5
n_fns_r_exported 102 95.3 TRUE
n_fns_r_not_exported 128 86.4
n_fns_per_file_r 10 88.3
num_params_per_fn 7 84.0
loc_per_fn_r 14 43.0
loc_per_fn_r_exp 12 28.1
loc_per_fn_r_not_exp 21 64.7
rel_whitespace_R 18 82.4
rel_whitespace_vignettes 15 87.1
rel_whitespace_tests 12 69.0
doclines_per_fn_exp 82 85.2
doclines_per_fn_not_exp 0 0.0 TRUE
doclines_per_fn_src 2 94.9
fn_call_network_size 170 85.7

2a. Network visualisation

Click to see the interactive network visualisation of calls between objects in package


3. goodpractice and other checks

Details of goodpractice checks (click to open)

3a. Continuous Integration Badges

R-CMD-check

GitHub Workflow Results

id name conclusion sha run_number date
9487307653 R-CMD-check success 3df1ef 146 2024-06-12
9487307652 test-coverage success 3df1ef 34 2024-06-12

3b. goodpractice results

R CMD check with rcmdcheck

R CMD check generated the following error:

  1. checking tests ... Running ‘spelling.R’ Comparing ‘spelling.Rout’ to ‘spelling.Rout.save’ ... OK Running ‘testthat.R’ ERROR Running the tests in ‘tests/testthat.R’ failed. Last 13 lines of output: 9. └─httr2::req_perform(., verbosity = 0) 10. └─httr2:::handle_resp(req, resp, error_call = error_call) 11. └─httr2:::resp_failure_cnd(req, resp, error_call = error_call) 12. ├─rlang::catch_cnd(...) 13. │ ├─rlang::eval_bare(...) 14. │ ├─base::tryCatch(...) 15. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers) 16. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler) 18. │ └─base::force(expr) 19. └─rlang::abort(...)

[ FAIL 8 | WARN 0 | SKIP 0 | PASS 24 ] Error: Test failures Execution halted

R CMD check generated the following test_fail:

  1. library(testthat)

library(RAQSAPI) Use the function RAQSAPI::aqs_credentials(username, key) before using other RAQSAPI functions See ?RAQSAPI::aqs_credentials for more information

test_check("RAQSAPI") [ FAIL 8 | WARN 0 | SKIP 0 | PASS 24 ]

══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-bybox.R:21:3'): bybox functions ──────────────────────────────── <purrr_error_indexed/rlang_error/error/condition> Error in purrr::pmap(.l = params, .f = aqs_services_by_box): i In index: 1. Caused by error in req_perform(): ! HTTP 400 Bad Request.

  • At server request time: Thu, 26 Jun 2025 15:55:07 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/sampleData/byBox?email=&key=&param=44201&bdate=20150501&edate=20150502&minlon=-87.0&maxlon=-86.7&minlat=33.3&maxlat=33.6 with status_code: 400 and status message: 400 Server error message: variable is missing or the value is empty: email
  • At server request time: Thu, 26 Jun 2025 15:55:07 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/sampleData/byBox?email=&key=&param=44201&bdate=20150501&edate=20150502&minlon=-87.0&maxlon=-86.7&minlat=33.3&maxlat=33.6 with status_code: 400 and status message: 400 Server error message: email address: , requires the following format: local-part@domain. ── Error ('test-byCBSA.R:21:3'): byCBSA functions ────────────────────────────── <purrr_error_indexed/rlang_error/error/condition> Error in purrr::pmap(.l = params, .f = aqs_services_by_cbsa): i In index: 1. Caused by error in req_perform(): ! HTTP 400 Bad Request.
  • At server request time: Thu, 26 Jun 2025 15:55:08 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/monitors/byCBSA?email=&key=&param=42602&bdate=20170101&edate=20170102&cbsa=16740 with status_code: 400 and status message: 400 Server error message: variable is missing or the value is empty: email
  • At server request time: Thu, 26 Jun 2025 15:55:08 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/monitors/byCBSA?email=&key=&param=42602&bdate=20170101&edate=20170102&cbsa=16740 with status_code: 400 and status message: 400 Server error message: email address: , requires the following format: local-part@domain. ── Error ('test-bycounty.R:21:3'): bycounty functions ────────────────────────── <purrr_error_indexed/rlang_error/error/condition> Error in purrr::pmap(.l = params, .f = aqs_services_by_county): i In index: 1. Caused by error in req_perform(): ! HTTP 400 Bad Request.
  • At server request time: Thu, 26 Jun 2025 15:55:08 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/annualData/byCounty?email=&key=&param=88101&bdate=20160101&edate=20160228&state=37&county=183 with status_code: 400 and status message: 400 Server error message: variable is missing or the value is empty: email
  • At server request time: Thu, 26 Jun 2025 15:55:08 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/annualData/byCounty?email=&key=&param=88101&bdate=20160101&edate=20160228&state=37&county=183 with status_code: 400 and status message: 400 Server error message: email address: , requires the following format: local-part@domain. ── Error ('test-byMA.R:21:3'): byMA functions ────────────────────────────────── <purrr_error_indexed/rlang_error/error/condition> Error in purrr::pmap(.l = params, .f = aqs_services_by_MA): i In index: 1. Caused by error in req_perform(): ! HTTP 400 Bad Request.
  • At server request time: Thu, 26 Jun 2025 15:55:09 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/qaBlanks/byMA?email=&key=&param=88101&bdate=20180101&edate=20180131&agency=0013 with status_code: 400 and status message: 400 Server error message: variable is missing or the value is empty: email
  • At server request time: Thu, 26 Jun 2025 15:55:09 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/qaBlanks/byMA?email=&key=&param=88101&bdate=20180101&edate=20180131&agency=0013 with status_code: 400 and status message: 400 Server error message: email address: , requires the following format: local-part@domain. ── Error ('test-bypqao.R:21:3'): bypqao functions ────────────────────────────── <purrr_error_indexed/rlang_error/error/condition> Error in purrr::pmap(.l = params, .f = aqs_services_by_pqao): i In index: 1. Caused by error in req_perform(): ! HTTP 400 Bad Request.
  • At server request time: Thu, 26 Jun 2025 15:55:10 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/qaBlanks/byPQAO?email=&key=&param=88101&bdate=20180101&edate=20180131&pqao=0013 with status_code: 400 and status message: 400 Server error message: variable is missing or the value is empty: email
  • At server request time: Thu, 26 Jun 2025 15:55:10 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/qaBlanks/byPQAO?email=&key=&param=88101&bdate=20180101&edate=20180131&pqao=0013 with status_code: 400 and status message: 400 Server error message: email address: , requires the following format: local-part@domain. ── Error ('test-bysite.R:21:3'): bysite functions ────────────────────────────── <purrr_error_indexed/rlang_error/error/condition> Error in purrr::pmap(.l = params, .f = aqs_services_by_site): i In index: 1. Caused by error in req_perform(): ! HTTP 400 Bad Request.
  • At server request time: Thu, 26 Jun 2025 15:55:10 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/sampleData/bySite?email=&key=&param=44201&bdate=20170618&edate=20170618&state=37&county=183&site=0014 with status_code: 400 and status message: 400 Server error message: variable is missing or the value is empty: email
  • At server request time: Thu, 26 Jun 2025 15:55:10 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/sampleData/bySite?email=&key=&param=44201&bdate=20170618&edate=20170618&state=37&county=183&site=0014 with status_code: 400 and status message: 400 Server error message: email address: , requires the following format: local-part@domain. ── Error ('test-bystate.R:22:1'): bystate functions ──────────────────────────── <purrr_error_indexed/rlang_error/error/condition> Error in purrr::pmap(.l = params, .f = aqs_services_by_state): i In index: 1. Caused by error in req_perform(): ! HTTP 400 Bad Request.
  • At server request time: Thu, 26 Jun 2025 15:55:11 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/monitors/byState?email=&key=&param=88101&bdate=20170101&edate=20171231&state=01 with status_code: 400 and status message: 400 Server error message: variable is missing or the value is empty: email
  • At server request time: Thu, 26 Jun 2025 15:55:11 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/monitors/byState?email=&key=&param=88101&bdate=20170101&edate=20171231&state=01 with status_code: 400 and status message: 400 Server error message: email address: , requires the following format: local-part@domain. ── Error ('test-RAQSAPlistfunctions.R:28:3'): list functions ─────────────────── <httr2_http_400/httr2_http/httr2_error/rlang_error/rlang_error/error/condition> Error in req_perform(., verbosity = 0): HTTP 400 Bad Request.
  • At server request time: Thu, 26 Jun 2025 15:55:12 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/metaData/fieldsByService?email=&key=&service=list with status_code: 400 and status message: 400 Server error message: variable is missing or the value is empty: email
  • At server request time: Thu, 26 Jun 2025 15:55:12 GMT RAQSAPI experienced an error while processing the following url: https://aqs.epa.gov/data/api/metaData/fieldsByService?email=&key=&service=list with status_code: 400 and status message: 400 Server error message: email address: , requires the following format: local-part@domain. Backtrace: ▆
    1. ├─... %>% expect_match(regexp = "Success") at test-RAQSAPlistfunctions.R:28:3
    2. ├─testthat::expect_match(., regexp = "Success")
    3. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
    4. │ └─rlang::eval_bare(expr, quo_get_env(quo))
    5. ├─RAQSAPI::aqs_fields_by_service(service = "list", return_header = TRUE)
    6. │ └─RAQSAPI:::aqs_metadata_service(filter = "fieldsByService", service = service)
    7. │ └─RAQSAPI:::aqs(...)
    8. │ └─AQSrequest %>% req_perform(verbosity = 0)
    9. └─httr2::req_perform(., verbosity = 0)
  1. └─httr2:::handle_resp(req, resp, error_call = error_call)
  2. └─httr2:::resp_failure_cnd(req, resp, error_call = error_call)
    
  3.   ├─rlang::catch_cnd(...)
    
  4.   │ ├─rlang::eval_bare(...)
    
  5.   │ ├─base::tryCatch(...)
    
  6.   │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
    
  7.   │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
    
  8.   │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
    
  9.   │ └─base::force(expr)
    
  10.   └─rlang::abort(...)
    

[ FAIL 8 | WARN 0 | SKIP 0 | PASS 24 ] Error: Test failures Execution halted

R CMD check generated the following check_fail:

  1. rcmdcheck_tests_pass

Test coverage with covr

ERROR: Test Coverage Failed

Cyclocomplexity with cyclocomp

The following function have cyclocomplexity >= 15:

function cyclocomplexity
checkaqsparams 41

Static code analyses with lintr

lintr found the following 161 potential issues:

message number of times
Avoid library() and require() calls in packages 14
Avoid the assignment pipe %<>%; prefer using <- and %>% separately. 113
Lines should not be more than 80 characters. This line is 108 characters. 1
Lines should not be more than 80 characters. This line is 291 characters. 28
Lines should not be more than 80 characters. This line is 81 characters. 1
Lines should not be more than 80 characters. This line is 83 characters. 1
Lines should not be more than 80 characters. This line is 85 characters. 2
Lines should not be more than 80 characters. This line is 88 characters. 1

Package Versions

package version
pkgstats 0.2.0.58
pkgcheck 0.1.2.136

Editor-in-Chief Instructions:

Processing may not proceed until the items marked with :heavy_multiplication_x: have been resolved.

ropensci-review-bot avatar Jun 26 '25 15:06 ropensci-review-bot

I need to make a correction, I just searched for my package, "RAQSAPI" in the issues section for this repository looking for this issue and discovered that there is another R package, epair, that appears to work similarly to RAQSAPI, I was totally unaware of this package until now. It looks like epair has already been accepted into ropensci. I am unsure if this project is still being maintain since it has been 3 years since the last commit.

I am unsure if I should rescind my presubmission request since it seems like there is already another package that has been accepted into ropensci that achieves the same goal as RAQSAPI.

mccroweyclinton-EPA avatar Jun 26 '25 20:06 mccroweyclinton-EPA

I should also note that for some reason RAQSAPI is already listed on rOpensci's R-universe for some reason even though I never requested that.

mccroweyclinton-EPA avatar Jun 27 '25 15:06 mccroweyclinton-EPA

No, it's on the USEPA universe. The rOpenSci bit is just the branding for r-universe as a whole. The universe name is the first sub-domain of the URL.

mpadge avatar Jun 27 '25 15:06 mpadge

@mpadge, thanks for the clarification.

mccroweyclinton-EPA avatar Jun 27 '25 15:06 mccroweyclinton-EPA

Responding to the issues reported by @ropensci-review-bot

Checks for RAQSAPI (v2.0.5)

git hash: 3df1ef76

  • ✖️ does not have a 'contributing' file.

I will consider adding this

  • ✖️ The following function has no documented return value: [aqs_qa_annualpeferomanceeval_by_site]

Is this an error? That function does have a documented return value.

  • ✖️ These functions do not have examples: [aqs_metadata_service, aqs_services_by_box, aqs_services_by_cbsa, aqs_services_by_county, aqs_services_by_MA, aqs_services_by_pqao, aqs_services_by_site, aqs_services_by_state, aqs_qa_annualpeferomanceeval_by_site].

These functions are intended as internal helper function, not to be called by end users. I have added @internal @roxygen2 tags to these function that I will push as a future commit soon.

  • ✖️ R CMD check found 1 error.

This package is a wrapper around the EPA AQS Datamart API, all functions work without issue, though sometimes a unit test may fail due to connection issues. I am working toward adding mock unit testing to hopefully deal with such issues.

mccroweyclinton-EPA avatar Jun 30 '25 13:06 mccroweyclinton-EPA

Thanks @mccroweyclinton-EPA, responses to your questions follow:

  • ✖️ does not have a 'contributing' file.

I will consider adding this

Our Dev Guide clearly states:

Having a contributing file as .github/CONTRIBUTING.md or docs/CONTRIBUTING.md is compulsory.


Your next question

  • ✖️ The following function has no documented return value: [aqs_qa_annualpeferomanceeval_by_site]

Is this an error? That function does have a documented return value.

Took me a bit of looking around to find out what was up there too - note the report, and read very carefully:

  • ✖️ The following function has no documented return value: [aqs_qa_annualpeferomanceeval_by_site]

There's a typo there that needs to be fixed.


  • ✖️ These functions do not have examples: [aqs_metadata_service, aqs_services_by_box, aqs_services_by_cbsa, aqs_services_by_county, aqs_services_by_MA, aqs_services_by_pqao, aqs_services_by_site, aqs_services_by_state, aqs_qa_annualpeferomanceeval_by_site].

These functions are intended as internal helper function, not to be called by end users. I have added @internal @roxygen2 tags to these function that I will push as a future commit soon.

Great, thanks, but please also note that documentation of internal functions is very helpful for anybody contributing to your package, and there's no reason not to have example code in internal functions if it helps other understand them (although of course not necessary, and @inernal or @noRd will suppress the check failure 👍 ).


  • ✖️ R CMD check found 1 error.

This package is a wrapper around the EPA AQS Datamart API, all functions work without issue, though sometimes a unit test may fail due to connection issues. I am working toward adding mock unit testing to hopefully deal with such issues.

That's good to hear. Don't forget the list of options for mocking test results in the Dev Guide.

Once you do have all checks passing, please ping the bot again and we'll proceed from there. Feel free to ask any questions along the way :rocket:

mpadge avatar Jul 01 '25 07:07 mpadge

I am in the process of making the changes that you've requested. I have not completed yet. One issue that I am having is with the pkgcheck github action. For some reason the github action will not run, though I can run it locally. It has been added to the repo. Is this the place to request assistance with getting that setup or should I ask elsewhere like on the pkgcheck repo?

mccroweyclinton-EPA avatar Jul 21 '25 15:07 mccroweyclinton-EPA

Also looking at the goodpractice test results before, in order for unit testing to work, the goodpractice workflow would need to provide credentials to access the API. Those failures were not due to connection issues but were because the tests above did not provide credentials to the API server.

mccroweyclinton-EPA avatar Jul 21 '25 19:07 mccroweyclinton-EPA

Thanks @mccroweyclinton-EPA for the progress update. The pkgcheck action is indeed running as expected. It is, however, failing for reasons given on the issue output. (And also note that it is set up so to cancel any run as soon as another one starts, hence all the cancelled runs.) Note also that your tests should generally not rely on getting actual results from external APIs (among other reasons, because such tests would likely fail on CRAN), and should instead use some form of mocking, for which see links in our Dev Guide, notably including our http testing book. You should be able to generate mocked results using your API credentials, but then have those results tested in any environments with or without the appropriate credentials.

mpadge avatar Jul 22 '25 08:07 mpadge

thanks @mpadge for your response, I see that you've deleted my previous response. Is this github issue the place where I should be discussing this or is there a better way to communicate with the ropensci team about issues that I am having?

With regards to the pkgcheck github action, that is fine if that is the expected output but I have been watching the running time on previous commits, one had a run time of over 6hrs, there was one run that ran for over 3hr though I don't see that one anymore. I am unsure if the time was recalculated. I don't want to waste a lot of my organization's available run time. I can run my full suite of unit tests via github actions without mock in a few minutes, add a few more for minutes to run goodpractice, devtools::check and a total package rebuild and we are still less than 15 minutes total. Is there a reason why pgkcheck is taking so long to run?

mccroweyclinton-EPA avatar Jul 23 '25 16:07 mccroweyclinton-EPA

Thanks for asking @mccroweyclinton-EPA, and no worries about discussing these things here, although you can always open an issue in your own repo regarding highly specific issues, and ping me (or whomever) from there. But generally, pre-submission requests are here for exactly these kinds of Q&A exchanges, to help get your package into shape preparing for a full submission.

As for the long pkgcheck-action run times, those should now be fixed. Apologies for any inconvenience along the way! (And note also that you'll nevertheless be very unlikely to waste your org run time, which is effectively unlimited for open-source repos. It's just that individual runs get cancelled after 6 hours.)

mpadge avatar Jul 24 '25 14:07 mpadge

@mpadge I am also recieving this warning from the pkgcheck github action:

pkgcheckThe `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

mccroweyclinton-EPA avatar Jul 28 '25 16:07 mccroweyclinton-EPA

@mccroweyclinton-EPA Please ignore that warning - it is also ignored by 'pkgcheck', and merely appears in the output. It'll be fixed via https://github.com/assignUser/octolog/issues/18

mpadge avatar Jul 29 '25 13:07 mpadge

@mpadge, I have implemented many of the things that you and the ropensci bot have suggested

  • unit test mocks implemented with httptest2, (I have been working on this for a while now, but never deployed it until now. Thanks for the motivation to get this implemented).
  • all functions should have @return roxygen2 tags

remaining issues:

  1. I am working with management and legal counsel at my organization to see about adding a contributing document. It appears that they are ok with accepting outside code contributions, I just need to get someone to ok the contributing document.

I have a few other pkgcheck/goodpractice issues that need to be resolved. I may need assistance with solving some of those issues:

  1. I keep getting this issue
use '<-' for assignment instead of '='.
       '<-' use the standard, and R users and developers are
       used it and it is easier to read your code for them if
       you use '<-'

I discussed this issue earlier, goodpractice is incorrectly flagging the magrittr assingment pipe ('%<>%') as '=', I am unsure of how to stop pkgcheck/goodpractice from marking this as an issue. I have added a .lintr configuration flag to the project so that lintr no longer flags this as an issue but goodprace/pkgcheck still flags this as an issue. Since you have said earlier that using this pipe is not wrong, just that it is recommended not to use it, I have decided to keep the assignment pipe in my code as I believe the concept is easy enough to understand, does not add unnecessary code complication (IMO) and makes the code a lot more readable.

  1. I have reformatted the code to use 125 character line widths, with 2 space indentation, I understand that this is not standard practice, but it does improve the readability of the code, at least for me, since I usually work using a very wide aspect ratio monitor. Unfortunately pkgcheck/goodpractice is flagging this as an issue that needs to be addressed. Again I have set the line length in the included .lintr configuration flag so I am unsure of how to deal with this. Even though using wide line lengths is not considered normal practice, it isn't necessarily a bad thing.

  2. I am getting a "package coverage failed error" from the pkgcheck github action, I am unsure of why this is the case. I will look further into this. the covr package works fine when running locally.

  3. I am running into a goodpractice check that is complaining about high cyclomatic complexity for the checkaqsparams function which is a non-exported, internal helper function that is used to validate user submitted parameters before they are passed on to the API. I can't really think of a better way to implement this functionality without having high cyclomatic complexity. Since almost evey exported API function uses this function to validate parameters. Someone really needs to come up with a better way of validating parameters in R.

mccroweyclinton-EPA avatar Aug 01 '25 18:08 mccroweyclinton-EPA

Thanks for the updates @mccroweyclinton-EPA. The goodpractice linter checks are okay, as they only raise :eyes:, and not actual failures (✖️ ). Everyone should feel free to use their own styles, as you have, as long as everything is clear and sufficiently justified.

The failed package coverage item is because you don't seem to have a coverage workflow running in your repo. The easiest way to set that up is usethis::use_github_workflow("test-coverage"). Once that's been successfully run that check failure should disappear.

Finally, the cyclomatic complexity check is also goodpractice, so not an actual failure. Nevertheless, those checks should be taken seriously, and they generally flag places where code can be improved. Looking at your checkaqsparams function, I see a lot of repetition of essentially identical code structures. This is just an opinion, but if I were writing that, I'd structure it as a single function along the lines of,

check_one_param <- function(param, check_fns, fn_collate = "||", error = TRUE, err_msg = "") {
	ret <- NULL
	if (!param %in% names(ellipsis_args)) {
		return(ret)
	}
	these_args <- ellipsis_args[[param]]
	fn_results <- lapply(check_fns, function(f) do.call(f, these_args))
	fn_results_okay <- do.call(fn_collate, fn_results)
	if (!fn_results_okay) {
		ret <- c(error = error, errmessage = err_msg)
	}
	return(ret)
}

All of your checks could then be specified as some kind of list-structure and the whole thing run as a single lapply call, instead of your current sequence of individual calls. (You'd also need to add at least one additional parameter flagging whether check_fns are negated or not, but something like that should generally work.) That's just a suggestion, but one which would make that function easier to maintain, and easier to understand.

Once you're satisfied with the state of things, feel free to call @ropensci-review-bot check package here. Once that confirm that all is good, we can proceed to a full submission. As always, feel free to ask any questions along the way. Thanks!

mpadge avatar Aug 03 '25 13:08 mpadge

@mpadge, I just ran across a new issue. Since implementing httptest2, I have noticed that running test with mocks is a bit of a hit or miss. After repeated tests I have noticed that when I run test via the rstudio "Test" button under the build tab in the Environment pane, the unit tests usually run with out any issues. When I run test in the R console using devtools::test_local function, the unit test often time fail. I do not understand why that would cause an issue. I am using the same arguments for the build and test functions as is supplied to the build and test function in RStudio. I have also tried deleting the mock files generated under the testthat folder to regenerate the mock cache files.

mccroweyclinton-EPA avatar Aug 07 '25 20:08 mccroweyclinton-EPA

Hi @mccroweyclinton-EPA , I'm not sure about that, but suspect that you might see more consistent results by running testthat::test_local() or testthat::test_file() functions, rather than indirectly via devtools. Either way, when mocked tests fail you should see information on the difference between mocked results and those generated by current tests. Failures in different environments generally indicate a need to use the httptest2 redacting abilities to redact variable information such as timestamps. Happy to help more if you ping directly from your repo.

mpadge avatar Aug 12 '25 09:08 mpadge

@mpadge , thank you for the lead. There does in fact seem to be an issue with how httptest2 is redacting. I will look further.

mccroweyclinton-EPA avatar Aug 12 '25 21:08 mccroweyclinton-EPA

@mccroweyclinton-EPA - I think you're tagging the wrong person :)

mpage avatar Aug 12 '25 22:08 mpage

edited, sorry to both of you.

mccroweyclinton-EPA avatar Aug 13 '25 16:08 mccroweyclinton-EPA

Happy to help more if you ping directly from your repo.

@mpadge I have sent you an invite to be on the team for the repository as a collaborator. Please accept.

mccroweyclinton-EPA avatar Aug 15 '25 20:08 mccroweyclinton-EPA

Happy to help more if you ping directly from your repo.

@mpadge I have sent you an invite to be on the team for the repository as a collaborator. Please accept.

Thanks, but I don't think that's necessary. Just ping me from issues within the repo if you have any specific questions on httptest2 redacting or the likes, and we can discuss further there.

mpadge avatar Aug 18 '25 09:08 mpadge

Happy to help more if you ping directly from your repo.

@mpadge I have sent you an invite to be on the team for the repository as a collaborator. Please accept.

Thanks, but I don't think that's necessary. Just ping me from issues within the repo if you have any specific questions on httptest2 redacting or the likes, and we can discuss further there.

@mpadge the problem with that is that for some reason I can not mention anyone outside of my organization. This maybe a restriction imposed on our enterprise account by the admins.

mccroweyclinton-EPA avatar Aug 18 '25 16:08 mccroweyclinton-EPA

@ropensci-review-bot check package

ldecicco-USGS avatar Oct 31 '25 20:10 ldecicco-USGS

Thanks, about to send the query.

ropensci-review-bot avatar Oct 31 '25 20:10 ropensci-review-bot

:rocket:

The following problems were found in your submission template:

  • submission type must be one of [Standard, Estandar, Stats, Pre-submission, pre-envio]
  • HTML variable [editor] is missing
  • HTML variable [reviewers-list] is missing
  • HTML variable [due-dates-list] is missing Editors: Please ensure these problems with the submission template are rectified. Package checks have been started regardless.

:wave:

ropensci-review-bot avatar Oct 31 '25 20:10 ropensci-review-bot