diff --git a/.Rbuildignore b/.Rbuildignore index 20efd59..7a86fee 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -22,3 +22,5 @@ ^README.gfm-ascii_identifiers_files ^README.gfm-ascii_identifiers_files/ ^README.gfm-ascii_identifiers_files/.* +^man/figures$ +^man/figures/.*$ diff --git a/CRAN-RELEASE b/CRAN-RELEASE index 8e78a32..60a7acf 100644 --- a/CRAN-RELEASE +++ b/CRAN-RELEASE @@ -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). diff --git a/DESCRIPTION b/DESCRIPTION index 67e476c..8698b4b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 Description: The 'U.S.' Centers for Disease Control and Prevention (CDC) maintain diff --git a/NEWS.md b/NEWS.md index e27c41e..be4c7f4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/R/agd-ipt.r b/R/agd-ipt.r index 6dd6724..663f848 100644 --- a/R/agd-ipt.r +++ b/R/agd-ipt.r @@ -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", diff --git a/R/datasets.r b/R/datasets.r index 322badb..205b861 100644 --- a/R/datasets.r +++ b/R/datasets.r @@ -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 diff --git a/README.Rmd b/README.Rmd index e75e63d..a1a79ec 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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 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 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 diff --git a/cdcfluview.Rproj b/cdcfluview.Rproj index 0a63de6..c08ee92 100644 --- a/cdcfluview.Rproj +++ b/cdcfluview.Rproj @@ -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 diff --git a/cran-comments.md b/cran-comments.md index 38c1034..7da41e0 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -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 diff --git a/crunch/mkdata.r b/crunch/mkdata.r index b9f4c50..8315295 100644 --- a/crunch/mkdata.r +++ b/crunch/mkdata.r @@ -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, diff --git a/man/census_regions.Rd b/man/census_regions.Rd index ac0f00e..96e0c14 100644 --- a/man/census_regions.Rd +++ b/man/census_regions.Rd @@ -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} diff --git a/tests/testthat/test-cdcfluview.R b/tests/testthat/test-cdcfluview.R index d032bae..629ad9e 100644 --- a/tests/testthat/test-cdcfluview.R +++ b/tests/testthat/test-cdcfluview.R @@ -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"))