Browse Source

CRAN failure / #28 fix

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

2
.Rbuildignore

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

4
CRAN-RELEASE

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

7
DESCRIPTION

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

6
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 # cdcfluview 0.9.2
- Underlying hidden API changed (h/t @Ian-McGovern — #25 & CRAN & Travis) for `age_group_distribution()` so - Underlying hidden API changed (h/t @Ian-McGovern — #25 & CRAN & Travis) for `age_group_distribution()` so

3
R/agd-ipt.r

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

2
R/datasets.r

@ -35,7 +35,7 @@ NULL
#' @keywords datasets #' @keywords datasets
#' @name census_regions #' @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) #' @usage data(census_regions)
#' @note Last updated 2015-08-09. #' @note Last updated 2015-08-09.
#' @format A data frame with 51 rows and 2 variables #' @format A data frame with 51 rows and 2 variables

6
README.Rmd

@ -11,10 +11,6 @@ hrbrpkghelpr::global_opts()
hrbrpkghelpr::stinking_badges() 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. 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). 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 ## 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 ## What's Inside The Tin

2
cdcfluview.Rproj

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

11
cran-comments.md

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

2
crunch/mkdata.r

@ -26,7 +26,7 @@ str(hhs_regions)
library(rvest) library(rvest)
library(magrittr) 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 pg %>% html_table() %>% extract2(1) %>% as.list -> cens
do.call(rbind.data.frame, lapply(names(cens), function(x) { do.call(rbind.data.frame, lapply(names(cens), function(x) {
data.frame(region=x, data.frame(region=x,

2
man/census_regions.Rd

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

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

Loading…
Cancel
Save