Browse Source

CRAN failure / #28 fix

master
boB Rudis 5 months ago
parent
commit
d8ae30d2f9
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
12 changed files with 31 additions and 24 deletions
  1. +2
    -0
      .Rbuildignore
  2. +2
    -2
      CRAN-RELEASE
  3. +4
    -3
      DESCRIPTION
  4. +6
    -0
      NEWS.md
  5. +2
    -1
      R/agd-ipt.r
  6. +1
    -1
      R/datasets.r
  7. +1
    -5
      README.Rmd
  8. +2
    -0
      cdcfluview.Rproj
  9. +5
    -6
      cran-comments.md
  10. +1
    -1
      crunch/mkdata.r
  11. +1
    -1
      man/census_regions.Rd
  12. +4
    -4
      tests/testthat/test-cdcfluview.R

+ 2
- 0
.Rbuildignore View File

@ -22,3 +22,5 @@
^README.gfm-ascii_identifiers_files
^README.gfm-ascii_identifiers_files/
^README.gfm-ascii_identifiers_files/.*
^man/figures$
^man/figures/.*$

+ 2
- 2
CRAN-RELEASE View File

@ -1,2 +1,2 @@
This package was submitted to CRAN on 2020-04-02.
Once it is accepted, delete this file and tag the release (commit c2b16f4911).
This package was submitted to CRAN on 2021-02-27.
Once it is accepted, delete this file and tag the release (commit 1f5996a).

+ 4
- 3
DESCRIPTION View File

@ -3,8 +3,8 @@ Type: Package
Encoding: UTF-8
Title: Retrieve Flu Season Data from the United States Centers for Disease Control
and Prevention ('CDC') 'FluView' Portal
Version: 0.9.2
Date: 2020-10-13
Version: 0.9.4
Date: 2021-02-27
Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5670-2640")),
@ -16,7 +16,8 @@ Authors@R: c(
comment = c(ORCID = "0000-0002-1791-9449")),
person("James", "Turtle", email = "jturtle@predsci.com", role = "ctb",
comment = c(ORCID = "0000-0003-0735-7769")),
person("Andrew", "Bates", role = "ctb")
person("Andrew", "Bates", role = "ctb"),
person("Ian", "McGovern", role = "ctb")
)
Maintainer: Bob Rudis <bob@rud.is>
Description: The 'U.S.' Centers for Disease Control and Prevention (CDC) maintain


+ 6
- 0
NEWS.md View File

@ -1,3 +1,9 @@
# cdcfluview 0.9.4
- the CDC FluView hidden API changed the returned value structure for the
`age_group_distribution()` function endpoint. There is now a new column
`incl_wkly_rates_and_strata` in the returned data frame. Fixes #28 and
CRAN failures.
# cdcfluview 0.9.2
- Underlying hidden API changed (h/t @Ian-McGovern — #25 & CRAN & Travis) for `age_group_distribution()` so


+ 2
- 1
R/agd-ipt.r View File

@ -36,7 +36,7 @@ age_group_distribution <- function(years = NULL) {
xdat <- jsonlite::fromJSON(xdat, flatten=TRUE)
sea_names <- c("seasonid", "sea_description", "sea_startweek", "sea_endweek", "sea_enabled",
"sea_label", "sea_showlabtype")
"sea_label", "sea_showlabtype", "incl_wkly_rates_and_strata")
age_names <- c("ageid", "age_label", "age_color_hexvalue", "age_enabled")
typ_names <- c("virusid", "vir_description", "vir_label", "vir_startmmwrid", "vir_endmmwrid",
"vir_displayorder", "vir_colorname", "vir_color_hexvalue", "vir_labtypeid",
@ -51,6 +51,7 @@ age_group_distribution <- function(years = NULL) {
vir_df <- dplyr::left_join(vir_df, sea_df, "seasonid")
vir_df <- dplyr::left_join(vir_df, age_df, "ageid")
vir_df <- dplyr::left_join(vir_df, typ_df, "virusid")
class(vir_df) <- c("tbl_df", "tbl", "data.frame")
vir_df_cols <- c("sea_label", "age_label", "vir_label", "count", "mmwrid", "seasonid",


+ 1
- 1
R/datasets.r View File

@ -35,7 +35,7 @@ NULL
#' @keywords datasets
#' @name census_regions
#'
#' @references \url{https://www.cdc.gov/std/stats12/images/CensusMap.png}
#' @references \url{https://www.cdc.gov/std/stats/}
#' @usage data(census_regions)
#' @note Last updated 2015-08-09.
#' @format A data frame with 51 rows and 2 variables


+ 1
- 5
README.Rmd View File

@ -11,10 +11,6 @@ hrbrpkghelpr::global_opts()
hrbrpkghelpr::stinking_badges()
```
# I M P O R T A N T
The CDC migrated to a new non-Flash portal and back-end APIs changed. This is a complete reimagining of the package and --- as such --- all your code is going to break...eventually. Older functions have been deprecated with warnings and will be removed at some point.
All folks providing feedback, code or suggestions will be added to the DESCRIPTION file. Please include how you would prefer to be cited in any issues you file.
If there's a particular data set from https://www.cdc.gov/flu/weekly/fluviewinteractive.htm that you want and that isn't in the package, please file it as an issue and be as specific as you can (screen shot if possible).
@ -25,7 +21,7 @@ Retrieve Flu Season Data from the United States Centers for Disease Control and
## Description
The U.S. Centers for Disease Control (CDC) maintains a portal <http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html> for accessing state, regional and national influenza statistics as well as Mortality Surveillance Data. The Flash interface makes it difficult and time-consuming to select and retrieve influenza data. This package provides functions to access the data provided by the portal's underlying API.
The U.S. Centers for Disease Control (CDC) maintains a portal <https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html> for accessing state, regional and national influenza statistics as well as Mortality Surveillance Data. The Flash interface makes it difficult and time-consuming to select and retrieve influenza data. This package provides functions to access the data provided by the portal's underlying API.
## What's Inside The Tin


+ 2
- 0
cdcfluview.Rproj View File

@ -3,6 +3,7 @@ Version: 1.0
RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: No
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
@ -19,4 +20,5 @@ PackageInstallArgs: --no-multiarch --with-keep.source
PackageBuildArgs: --resave-data
PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace
QuitChildProcessesOnExit: Yes

+ 5
- 6
cran-comments.md View File

@ -1,12 +1,11 @@
## Test environments
* local R installation, R 4.0.3
* ubuntu 16.04 (on travis-ci), R 4.0.3
* local R installation, R 4.0.4
* ubuntu 16.04 (on travis-ci), R 4.0.4
* win-builder (devel)
## R CMD check results
0 errors | 0 warnings | 0 notes
0 errors | 0 warnings | 1 note
* This is a maintanance/bug-fix release
* Fixed CRAN check error for age_group_distribution function
* Fixed dplyr warning
* Fixed one failing test
* Fixed one API URL

+ 1
- 1
crunch/mkdata.r View File

@ -26,7 +26,7 @@ str(hhs_regions)
library(rvest)
library(magrittr)
pg <- html("http://www.cdc.gov/std/stats11/census.htm")
pg <- html("https://www.cdc.gov/std/stats18/census.htm")
pg %>% html_table() %>% extract2(1) %>% as.list -> cens
do.call(rbind.data.frame, lapply(names(cens), function(x) {
data.frame(region=x,


+ 1
- 1
man/census_regions.Rd View File

@ -24,6 +24,6 @@ This dataset contains the states belonging to the (presently) 4
Last updated 2015-08-09.
}
\references{
\url{https://www.cdc.gov/std/stats12/images/CensusMap.png}
\url{https://www.cdc.gov/std/stats/}
}
\keyword{datasets}

+ 4
- 4
tests/testthat/test-cdcfluview.R View File

@ -12,7 +12,7 @@ test_that("New API works", {
expect_that(hospitalizations("eip", years=2017), is_a("data.frame"))
expect_that(hospitalizations("eip", "Colorado", years=2017), is_a("data.frame"))
expect_that(hospitalizations("ihsp", years=2017), is_a("data.frame"))
expect_that(hospitalizations("ihsp", "Oklahoma", years=2017), is_a("data.frame"))
expect_that(hospitalizations("ihsp", "Oklahoma", years=2010), is_a("data.frame"))
skip_on_cran()
@ -63,15 +63,15 @@ context("old API functionality")
test_that("Old API works", {
expect_that(dim(get_flu_data("hhs", years=2015)), equals(c(520L, 15L)))
skip_on_cran()
expect_that(dim(get_flu_data("hhs", years=2015)), equals(c(520L, 15L)))
expect_that(dim(get_state_data(2008)), equals(c(2494L, 8L)))
invisible(get_flu_data())
invisible(get_hosp_data())
invisible(get_hosp_data(years = 2019))
invisible(get_flu_data(data_source="all"))


Loading…
Cancel
Save