Make data.cdc.gov data pull helpers more generic and use httr2.#155
Merged
Conversation
data.cdc.gov data pull helpers more generic, add pull_nssp helper.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #155 +/- ##
==========================================
+ Coverage 63.76% 64.29% +0.52%
==========================================
Files 28 28
Lines 1551 1574 +23
==========================================
+ Hits 989 1012 +23
Misses 562 562 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
data.cdc.gov data pull helpers more generic, add pull_nssp helper.data.cdc.gov data pull helpers more generic and use httr2.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the data pull helpers for data.cdc.gov to be more generic, replacing the previous httr-based implementation with a new httr2‐based workflow. In addition, it updates the documentation, tests, and API endpoint configuration to support the new design.
- Updated vignette chunks to use httptest2 and removed obsolete httr calls.
- Introduced functions for constructing data.cdc.gov endpoints and managing API credentials.
- Revised tests and data mocks to align with the new API request implementations.
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vignettes/pull-nhsn.Rmd | Updated chunk labels and switched to httptest2; duplicate ENV assignment noted. |
| tests/testthat/* | Added tests for warning behavior and replaced httptest with httptest2. |
| R/pull_data_cdc_gov.R | Migrated API requests from httr to httr2 and improved error-handling logic. |
| man/*.Rd & R/constants.R | Updated documentation to reference new functions and dataset IDs. |
| NAMESPACE & DESCRIPTION | Updated exports and dependencies to reflect changes with httr2 and httptest2. |
Comments suppressed due to low confidence (1)
R/pull_data_cdc_gov.R:193
- Ensure that checking nrow(df) >= limit correctly captures the case where the query result is exactly at the limit, which could indicate truncated data. Verify that this behavior is intended or consider providing additional guidance in the documentation.
if (error_on_limit && nrow(df) >= limit) {
dylanhmorris
enabled auto-merge (squash)
June 10, 2025 22:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #156
Prerequisite for #148 ; decided to separate this off for ease of review.
httrwithhttr2andhttptestwithhttptest2pull_nhsn()into a light wrapper of more generic functions for API calls in general and interactions with data.cdc.gov in particular