Browse Source

Fixes #25

master
boB Rudis 1 month ago
parent
commit
1f5996af24
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
12 changed files with 48 additions and 36 deletions
  1. +2
    -2
      CRAN-RELEASE
  2. +7
    -6
      DESCRIPTION
  3. +1
    -0
      NAMESPACE
  4. +6
    -1
      NEWS.md
  5. +2
    -2
      R/agd-ipt.r
  6. +2
    -2
      R/cdcfluview-package.R
  7. +2
    -2
      R/get-flu-data.r
  8. +2
    -2
      R/get-weekly-flu-report.r
  9. +7
    -5
      README.Rmd
  10. +9
    -8
      README.md
  11. +7
    -5
      cran-comments.md
  12. +1
    -1
      man/cdcfluview.Rd

+ 2
- 2
CRAN-RELEASE View File

@@ -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).

+ 7
- 6
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.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

+ 1
- 0
NAMESPACE View File

@@ -20,6 +20,7 @@ export(surveillance_areas)
export(who_nrevss)
import(MMWRweek)
import(httr)
import(progress)
import(units)
import(xml2)
importFrom(dplyr,"%>%")


+ 6
- 1
NEWS.md View File

@@ -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).


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

@@ -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]


+ 2
- 2
R/cdcfluview-package.R View File

@@ -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
#' <http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html> for
#' <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
@@ -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


+ 2
- 2
R/get-flu-data.r View File

@@ -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


+ 2
- 2
R/get-weekly-flu-report.r View File

@@ -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"])


+ 7
- 5
README.Rmd View File

@@ -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")
```



+ 9
- 8
README.md View File

@@ -42,7 +42,7 @@ Control and Prevention (‘CDC’) ‘FluView’ Portal
## Description

The U.S. Centers for Disease Control (CDC) maintains a portal
<http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html> for accessing
<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
@@ -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 <int> 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 <int> 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2…
## $ seasonid <int> 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,…
## $ publishyearweekid <int> 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3038, 3…
## $ sea_description <chr> "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16", "Season 2015-16", "…
## $ sea_startweek <int> 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2806, 2…
## $ sea_endweek <int> 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2857, 2…


+ 7
- 5
cran-comments.md View File

@@ -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

+ 1
- 1
man/cdcfluview.Rd View File

@@ -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


Loading…
Cancel
Save