Contributing to nycOpenData
Source:CONTRIBUTING.md
Thanks for your interest in contributing to nycOpenData! This package provides convenient R wrappers around NYC Open Data (Socrata) API endpoints and returns results as tidy tibbles with optional filtering, sorting, and row limits.
This guide explains how to report issues, propose changes, and submit pull requests.
Code of Conduct
Be respectful and constructive. Assume good intent. Harassment or discrimination of any kind is not tolerated. Please refer to CODE_OF_CONDUCT.md for full details.
Ways to Contribute
You can help by:
- Reporting bugs or confusing behavior.
- Suggesting improvements to documentation or examples.
- Adding wrappers for additional NYC Open Data datasets.
- Improving tests and edge-case handling (timeouts, API errors, schema changes).
- Improving performance or developer ergonomics.
Filing Issues
Please open an issue with:
- What you expected to happen
- What actually happened
- A minimal reproducible example (copy/paste-able using the
reprexpackage). -
sessionInfo()output.
If the issue is dataset-specific, include:
- The dataset name and/or NYC Open Data dataset ID (e.g.,
erm2-nwe9). - Any filters used in the function call.
- Whether the issue is intermittent (likely related to rate limits or timeouts).
Development Setup
2) Install Dependencies
Ensure you have the following packages installed for development:
install.packages(c('devtools', 'roxygen2', 'testthat', 'pkgdown', 'vcr', 'webmockr', 'covr'))Development Workflow
Adding New Datasets
With about 40 scripts currently in the package, we maintain a strict standard for new data-pulling functions. All new wrappers should:
- Return a
tbl_df(tibble). -
Use
httr::GETfor API calls to ensure consistency with our error-handling logic. -
Include standard parameters:
limit,filters, andtimeout_sec. - Match existing patterns: Use the standardized column naming conventions provided by the NYC Open Data API.
Testing with vcr
This package uses the vcr package to mock API responses, ensuring tests are fast and reliable even without an internet connection.
-
Write a test in
tests/testthat/using avcr::use_cassette()block. - Record the response: Run the test with an active internet connection to create the initial YAML ‘cassette’.
-
Verify the fixture: Ensure the
.ymlfile is created intests/testthat/fixtures/. - No Secrets: Ensure you do not record any sensitive API keys or tokens in the cassettes.
Documentation
We use roxygen2 for documentation. Before submitting a PR:
- Run
devtools::document()to update the NAMESPACE and help files. - Run
pkgdown::build_site()to ensure the documentation website renders correctly.