~hrbrmstr/cdcfluview

d8ae30d2f93077076dc710e44a9ec2753c182780 — hrbrmstr 3 years ago 1f5996a
CRAN failure / #28 fix
M .Rbuildignore => .Rbuildignore +2 -0
@@ 22,3 22,5 @@
^README.gfm-ascii_identifiers_files
^README.gfm-ascii_identifiers_files/
^README.gfm-ascii_identifiers_files/.*
^man/figures$
^man/figures/.*$

M CRAN-RELEASE => CRAN-RELEASE +2 -2
@@ 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).

M DESCRIPTION => DESCRIPTION +4 -3
@@ 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

M NEWS.md => NEWS.md +6 -0
@@ 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

M R/agd-ipt.r => R/agd-ipt.r +2 -1
@@ 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",

M R/datasets.r => R/datasets.r +1 -1
@@ 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

M README.Rmd => README.Rmd +1 -5
@@ 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


M cdcfluview.Rproj => cdcfluview.Rproj +2 -0
@@ 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

M cran-comments.md => cran-comments.md +5 -6
@@ 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

M crunch/mkdata.r => crunch/mkdata.r +1 -1
@@ 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,

M man/census_regions.Rd => man/census_regions.Rd +1 -1
@@ 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}

M tests/testthat/test-cdcfluview.R => tests/testthat/test-cdcfluview.R +4 -4
@@ 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"))