diff --git a/CRAN-RELEASE b/CRAN-RELEASE index a6f23dd..8e78a32 100644 --- a/CRAN-RELEASE +++ b/CRAN-RELEASE @@ -1,2 +1,2 @@ -This package was submitted to CRAN on 2019-01-24. -Once it is accepted, delete this file and tag the release (commit 2b6698f1c2). +This package was submitted to CRAN on 2020-04-02. +Once it is accepted, delete this file and tag the release (commit c2b16f4911). diff --git a/DESCRIPTION b/DESCRIPTION index 6cf80a2..67e476c 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.1 -Date: 2020-04-01 +Version: 0.9.2 +Date: 2020-10-13 Authors@R: c( person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-5670-2640")), @@ -25,17 +25,18 @@ Description: The 'U.S.' Centers for Disease Control and Prevention (CDC) maintai mortality surveillance data. The web interface makes it difficult and time-consuming to select and retrieve influenza data. Tools are provided to access the data provided by the portal's underlying 'API'. -URL: https://git.rud.is/hrbrmstr/cdcfluview -BugReports: https://gitlab.com/hrbrmstr/cdcfluview/issues +URL: https://github.com/hrbrmstr/cdcfluview +BugReports: https://github.com/hrbrmstr/cdcfluview/issues License: MIT + file LICENSE LazyData: true Suggests: testthat, covr Depends: - R (>= 3.2.0) + R (>= 3.5.0) Imports: httr, + progress, tools, dplyr, jsonlite, @@ -48,4 +49,4 @@ Imports: readr, MMWRweek, units (>= 0.4-6) -RoxygenNote: 7.1.0 +RoxygenNote: 7.1.1 diff --git a/NAMESPACE b/NAMESPACE index e2143b4..f95a936 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -20,6 +20,7 @@ export(surveillance_areas) export(who_nrevss) import(MMWRweek) import(httr) +import(progress) import(units) import(xml2) importFrom(dplyr,"%>%") diff --git a/NEWS.md b/NEWS.md index cfad521..e27c41e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,9 @@ -#cdcfluview 0.9.1 +# cdcfluview 0.9.2 + +- Underlying hidden API changed (h/t @Ian-McGovern — #25 & CRAN & Travis) for `age_group_distribution()` so + this has been fixed and the warnings for `dplyr::progress_estimated()` were also fixed. + +# cdcfluview 0.9.1 - renamed `pi_mortality` columns regarding the week to `week_*` instead of `wk_*` for consistency with `ilinet` (#21). diff --git a/R/agd-ipt.r b/R/agd-ipt.r index c8c3e00..6dd6724 100644 --- a/R/agd-ipt.r +++ b/R/agd-ipt.r @@ -41,7 +41,7 @@ age_group_distribution <- function(years = NULL) { typ_names <- c("virusid", "vir_description", "vir_label", "vir_startmmwrid", "vir_endmmwrid", "vir_displayorder", "vir_colorname", "vir_color_hexvalue", "vir_labtypeid", "vir_sortid") - vir_names <- c("virusid", "ageid", "count", "mmwrid", "seasonid", "publishyearweekid", "loaddatetime") + vir_names <- c("virusid", "ageid", "count", "mmwrid", "seasonid") sea_df <- stats::setNames(xdat$Season, sea_names) age_df <- stats::setNames(xdat$Age, age_names) @@ -54,7 +54,7 @@ age_group_distribution <- function(years = NULL) { class(vir_df) <- c("tbl_df", "tbl", "data.frame") vir_df_cols <- c("sea_label", "age_label", "vir_label", "count", "mmwrid", "seasonid", - "publishyearweekid", "sea_description", "sea_startweek", + "sea_description", "sea_startweek", "sea_endweek", "vir_description", "vir_startmmwrid", "vir_endmmwrid") vir_df <- vir_df[,vir_df_cols] diff --git a/R/cdcfluview-package.R b/R/cdcfluview-package.R index 4cb4414..e0ce4df 100644 --- a/R/cdcfluview-package.R +++ b/R/cdcfluview-package.R @@ -1,7 +1,7 @@ #' Retrieve Flu Season Data from the United States Centers for Disease Control and Prevention ('CDC') 'FluView' Portal #' #' The U.S. Centers for Disease Control (CDC) maintains a portal -#' for +#' 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 @@ -11,7 +11,7 @@ #' @name cdcfluview #' @docType package #' @author Bob Rudis (bob@@rud.is) -#' @import httr MMWRweek xml2 units +#' @import httr MMWRweek xml2 units progress #' @importFrom purrr map map_df map_chr map_lgl discard keep #' @importFrom readr read_csv type_convert #' @importFrom tools file_path_sans_ext diff --git a/R/get-flu-data.r b/R/get-flu-data.r index 1ed8d0e..63e9c54 100644 --- a/R/get-flu-data.r +++ b/R/get-flu-data.r @@ -142,9 +142,9 @@ get_flu_data <- function(region="hhs", sub_region=1:10, files <- unzip(out_file, exdir=out_dir, overwrite=TRUE) - pb <- dplyr::progress_estimated(length(files)) + pb <- progress::progress_bar$new(total = length(files)) lapply(files, function(x) { - pb$tick()$print() + pb$tick() ct <- ifelse(grepl("who", x, ignore.case=TRUE), 1, 1) suppressMessages(readr::read_csv(x, skip=ct)) }) -> file_list diff --git a/R/get-weekly-flu-report.r b/R/get-weekly-flu-report.r index defb1f4..98c0afc 100644 --- a/R/get-weekly-flu-report.r +++ b/R/get-weekly-flu-report.r @@ -27,12 +27,12 @@ get_weekly_flu_report <- function() { # for each period extract the state information and # shove it all into a data frame - pb <- dplyr::progress_estimated(length(periods)) + pb <- progress::progress_bar$new(total = length(periods)) suppressWarnings(suppressMessages( purrr::map_df(periods, function(period) { - pb$tick()$print() + pb$tick() tp <- sprintf("//timeperiod[@number='%s' and @year='%s']", period["number"], period["year"]) diff --git a/README.Rmd b/README.Rmd index 0f52d84..e75e63d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -72,10 +72,12 @@ All development happens in branches now with only critical fixes being back-port ```{r eval=FALSE} # CRAN install.packages("cdcfluview") -# master branch -devtools::install_git("https://sr.ht/~hrbrmstr/cdcfluview") -devtools::install_git("https://gitlab.com/hrbrmstr/cdcfluview") -devtools::install_github("hrbrmstr/cdcfluview") + +# main branch +remotes::install_git("https://git.rud.is/hrbrmstr/cdcfluview.git") +remotes::install_git("https://sr.ht/~hrbrmstr/cdcfluview") +remotes::install_git("https://gitlab.com/hrbrmstr/cdcfluview") +remotes::install_github("hrbrmstr/cdcfluview") ``` ## Usage @@ -85,7 +87,7 @@ library(cdcfluview) library(hrbrthemes) library(tidyverse) -# current verison +# current version packageVersion("cdcfluview") ``` diff --git a/README.md b/README.md index ec12c3e..49c87cb 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Control and Prevention (‘CDC’) ‘FluView’ Portal ## Description The U.S. Centers for Disease Control (CDC) maintains a portal - for accessing + 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 @@ -107,10 +107,12 @@ back-ported to the master branch when necessary. ``` r # CRAN install.packages("cdcfluview") -# master branch -devtools::install_git("https://sr.ht/~hrbrmstr/cdcfluview") -devtools::install_git("https://gitlab.com/hrbrmstr/cdcfluview") -devtools::install_github("hrbrmstr/cdcfluview") + +# main branch +remotes::install_git("https://git.rud.is/hrbrmstr/cdcfluview.git") +remotes::install_git("https://sr.ht/~hrbrmstr/cdcfluview") +remotes::install_git("https://gitlab.com/hrbrmstr/cdcfluview") +remotes::install_github("hrbrmstr/cdcfluview") ``` ## Usage @@ -120,9 +122,9 @@ library(cdcfluview) library(hrbrthemes) library(tidyverse) -# current verison +# current versoon packageVersion("cdcfluview") -## [1] '0.9.1' +## [1] '0.9.2' ``` ### Age Group Distribution of Influenza Positive Tests Reported by Public Health Laboratories @@ -137,7 +139,6 @@ glimpse(age_group_distribution(years=2015)) ## $ count 0, 1, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 3, 2, 2, 3, 3, 3, 0, 0, 2, 0, 1, 1, 0, 0… ## $ mmwrid 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2… ## $ seasonid 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,… -## $ publishyearweekid 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3… ## $ sea_description "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16", "… ## $ sea_startweek 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2… ## $ sea_endweek 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2… diff --git a/cran-comments.md b/cran-comments.md index cdf5279..38c1034 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,10 +1,12 @@ ## Test environments -* local OS X install, R 3.6.3 -* ubuntu 14.04 (on travis-ci), R 3.6.3 -* win-builder (devel and release) +* local R installation, R 4.0.3 +* ubuntu 16.04 (on travis-ci), R 4.0.3 +* win-builder (devel) ## R CMD check results -0 errors | 0 warnings | 1 note +0 errors | 0 warnings | 0 notes -This an update to fix tibble CRAN check warnings. +* This is a maintanance/bug-fix release +* Fixed CRAN check error for age_group_distribution function +* Fixed dplyr warning diff --git a/man/cdcfluview.Rd b/man/cdcfluview.Rd index 3944ec8..a4871a8 100644 --- a/man/cdcfluview.Rd +++ b/man/cdcfluview.Rd @@ -6,7 +6,7 @@ \title{Retrieve Flu Season Data from the United States Centers for Disease Control and Prevention ('CDC') 'FluView' Portal} \description{ The U.S. Centers for Disease Control (CDC) maintains a portal -\url{http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html} for +\url{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