Browse Source

0.9.1

master
boB Rudis 4 years ago
parent
commit
c2b16f4911
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 11
      DESCRIPTION
  2. 1
      NAMESPACE
  3. 1
      NEWS.md
  4. 1
      R/cdcfluview-package.R
  5. 2
      R/get-weekly-flu-report.r
  6. 2
      R/mmwr-map.r
  7. 20
      README.Rmd
  8. 883
      README.md
  9. 26
      cran-comments.md
  10. 5
      man/cdc_basemap.Rd
  11. 1
      man/cdcfluview.Rd
  12. 4
      man/census_regions.Rd
  13. BIN
      man/figures/README-cdc-basemaps-1.png
  14. BIN
      man/figures/README-cdc-basemaps-2.png
  15. BIN
      man/figures/README-cdc-basemaps-3.png
  16. BIN
      man/figures/README-cdc-basemaps-4.png
  17. BIN
      man/figures/README-cdc-basemaps-5.png
  18. BIN
      man/figures/README-cdc-basemaps-6.png
  19. BIN
      man/figures/README-ili-df-1.png
  20. BIN
      man/figures/README-ili-df-2.png
  21. BIN
      man/figures/README-ili-df-3.png
  22. BIN
      man/figures/README-ili-df-4.png
  23. BIN
      man/figures/README-ili-weekly-activity-1.png
  24. BIN
      man/figures/README-nat-pi-mortality-1.png
  25. BIN
      man/figures/README-surveillance-areas-1.png
  26. BIN
      man/figures/README-who-vrevss-1.png
  27. 9
      man/get_flu_data.Rd
  28. 7
      man/get_hosp_data.Rd
  29. 4
      man/hhs_regions.Rd
  30. 7
      man/hospitalizations.Rd
  31. 4
      man/mmwrid_map.Rd
  32. 5
      man/pi_mortality.Rd
  33. 3
      man/who_nrevss.Rd

11
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.0 Version: 0.9.1
Date: 2019-01-23 Date: 2020-04-01
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")),
@ -20,12 +20,12 @@ Authors@R: c(
) )
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
a portal <http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html> for a portal <https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html> for
accessing state, regional and national influenza statistics as well as accessing state, regional and national influenza statistics as well as
mortality surveillance data. The web interface makes it difficult and mortality surveillance data. The web interface makes it difficult and
time-consuming to select and retrieve influenza data. Tools are provided time-consuming to select and retrieve influenza data. Tools are provided
to access the data provided by the portal's underlying 'API'. to access the data provided by the portal's underlying 'API'.
URL: https://gitlab.com/hrbrmstr/cdcfluview URL: https://git.rud.is/hrbrmstr/cdcfluview
BugReports: https://gitlab.com/hrbrmstr/cdcfluview/issues BugReports: https://gitlab.com/hrbrmstr/cdcfluview/issues
License: MIT + file LICENSE License: MIT + file LICENSE
LazyData: true LazyData: true
@ -39,6 +39,7 @@ Imports:
tools, tools,
dplyr, dplyr,
jsonlite, jsonlite,
tibble,
stats, stats,
utils, utils,
sf, sf,
@ -47,4 +48,4 @@ Imports:
readr, readr,
MMWRweek, MMWRweek,
units (>= 0.4-6) units (>= 0.4-6)
RoxygenNote: 6.1.1 RoxygenNote: 7.1.0

1
NAMESPACE

@ -40,6 +40,7 @@ importFrom(readr,read_csv)
importFrom(readr,type_convert) importFrom(readr,type_convert)
importFrom(sf,st_read) importFrom(sf,st_read)
importFrom(stats,setNames) importFrom(stats,setNames)
importFrom(tibble,tibble)
importFrom(tools,file_path_sans_ext) importFrom(tools,file_path_sans_ext)
importFrom(utils,URLencode) importFrom(utils,URLencode)
importFrom(utils,globalVariables) importFrom(utils,globalVariables)

1
NEWS.md

@ -2,6 +2,7 @@
- renamed `pi_mortality` columns regarding the week to `week_*` instead of `wk_*` - renamed `pi_mortality` columns regarding the week to `week_*` instead of `wk_*`
for consistency with `ilinet` (#21). for consistency with `ilinet` (#21).
- fixed CRAN check errors
# cdcfluview 0.9.0 # cdcfluview 0.9.0

1
R/cdcfluview-package.R

@ -15,6 +15,7 @@
#' @importFrom purrr map map_df map_chr map_lgl discard keep #' @importFrom purrr map map_df map_chr map_lgl discard keep
#' @importFrom readr read_csv type_convert #' @importFrom readr read_csv type_convert
#' @importFrom tools file_path_sans_ext #' @importFrom tools file_path_sans_ext
#' @importFrom tibble tibble
#' @importFrom dplyr left_join bind_rows mutate filter data_frame %>% arrange #' @importFrom dplyr left_join bind_rows mutate filter data_frame %>% arrange
#' @importFrom jsonlite fromJSON #' @importFrom jsonlite fromJSON
#' @importFrom stats setNames #' @importFrom stats setNames

2
R/get-weekly-flu-report.r

@ -44,7 +44,7 @@ get_weekly_flu_report <- function() {
color <- xml2::xml_text(xml2::xml_find_all(kids, "color"), TRUE) color <- xml2::xml_text(xml2::xml_find_all(kids, "color"), TRUE)
label <- xml2::xml_text(xml2::xml_find_all(kids, "label"), TRUE) label <- xml2::xml_text(xml2::xml_find_all(kids, "label"), TRUE)
dplyr::data_frame( tibble::tibble(
year = period["year"], year = period["year"],
week_number = period["number"], week_number = period["number"],
state = abbrev, state = abbrev,

2
R/mmwr-map.r

@ -15,7 +15,7 @@
.tmp <- lapply(1962:2050, .start_date) .tmp <- lapply(1962:2050, .start_date)
mapply(function(.x, .y) { mapply(function(.x, .y) {
data_frame( tibble::tibble(
wk_start = seq(.tmp[[.x]], .tmp[[.y]], "1 week"), wk_start = seq(.tmp[[.x]], .tmp[[.y]], "1 week"),
wk_end = wk_start + 6, wk_end = wk_start + 6,
year_wk_num = 1:length(wk_start) year_wk_num = 1:length(wk_start)

20
README.Rmd

@ -3,13 +3,13 @@ output: rmarkdown::github_document
editor_options: editor_options:
chunk_output_type: console chunk_output_type: console
--- ---
```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE} ```{r pkg-knitr-opts, include=FALSE}
knitr::opts_chunk$set(message=FALSE, warning=FALSE, fig.retina=2) hrbrpkghelpr::global_opts()
options(width=120) ```
```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges()
``` ```
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/cdcfluview)](https://cran.r-project.org/package=cdcfluview)
[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/cdcfluview.svg?branch=master)](https://travis-ci.org/hrbrmstr/cdcfluview)
[![Coverage Status](https://img.shields.io/codecov/c/github/hrbrmstr/cdcfluview/master.svg)](https://codecov.io/github/hrbrmstr/cdcfluview?branch=master)
# I M P O R T A N T # I M P O R T A N T
@ -181,9 +181,9 @@ count(xdf, weekend, activity_level_label) %>%
```{r nat-pi-mortality} ```{r nat-pi-mortality}
(nat_pi <- pi_mortality("national")) (nat_pi <- pi_mortality("national"))
select(nat_pi, wk_end, percent_pni, baseline, threshold) %>% select(nat_pi, week_end, percent_pni, baseline, threshold) %>%
gather(measure, value, -wk_end) %>% gather(measure, value, -week_end) %>%
ggplot(aes(wk_end, value)) + ggplot(aes(week_end, value)) +
geom_line(aes(group=measure, color=measure)) + geom_line(aes(group=measure, color=measure)) +
scale_y_percent() + scale_y_percent() +
scale_color_ipsum(name = NULL, labels=c("Baseline", "Percent P&I", "Threshold")) + scale_color_ipsum(name = NULL, labels=c("Baseline", "Percent P&I", "Threshold")) +
@ -231,4 +231,4 @@ cloc::cloc_pkg_md()
## Code of Conduct ## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms. Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

883
README.md

File diff suppressed because it is too large

26
cran-comments.md

@ -1,30 +1,10 @@
## Test environments ## Test environments
* local OS X install, R 3.6.3
* local OS X install, R 3.5.2 * ubuntu 14.04 (on travis-ci), R 3.6.3
* local Ubuntu 16.04 R 3.5.2
* ubuntu 16.04 (on travis-ci), R current/devel
* win-builder (devel and release) * win-builder (devel and release)
## R CMD check results ## R CMD check results
0 errors | 0 warnings | 1 note 0 errors | 0 warnings | 1 note
* This is a maintenance update. This an update to fix tibble CRAN check warnings.
## Reverse dependencies
None
---
The CDC removed 2 old API endpoints so those functions have been removed.
There was a bug in the computation of "start week" that resulted in
the "ISO" day being used vs the MMWR/"epi" day being used. This
has also been fixed.
Only some examples run on CRAN due to their time consuming nature and the need
to make external network API calls. Monthly tests are performed on Travis-CI
<https://travis-ci.org/hrbrmstr/cdcfluview> and the package itself has 88%
code coverage during tests <https://codecov.io/github/hrbrmstr/cdcfluview?branch=master>.
All package functions are also evaluated on each new generation of the README.

5
man/cdc_basemap.Rd

@ -4,8 +4,9 @@
\alias{cdc_basemap} \alias{cdc_basemap}
\title{Retrieve CDC U.S. Basemaps} \title{Retrieve CDC U.S. Basemaps}
\usage{ \usage{
cdc_basemap(basemap = c("national", "hhs", "census", "states", "spread", cdc_basemap(
"surv")) basemap = c("national", "hhs", "census", "states", "spread", "surv")
)
} }
\arguments{ \arguments{
\item{basemap}{select the CDC basemap. One of: \item{basemap}{select the CDC basemap. One of:

1
man/cdcfluview.Rd

@ -3,7 +3,6 @@
\docType{package} \docType{package}
\name{cdcfluview} \name{cdcfluview}
\alias{cdcfluview} \alias{cdcfluview}
\alias{cdcfluview-package}
\title{Retrieve Flu Season Data from the United States Centers for Disease Control and Prevention ('CDC') 'FluView' Portal} \title{Retrieve Flu Season Data from the United States Centers for Disease Control and Prevention ('CDC') 'FluView' Portal}
\description{ \description{
The U.S. Centers for Disease Control (CDC) maintains a portal The U.S. Centers for Disease Control (CDC) maintains a portal

4
man/census_regions.Rd

@ -4,7 +4,9 @@
\name{census_regions} \name{census_regions}
\alias{census_regions} \alias{census_regions}
\title{Census Region Table} \title{Census Region Table}
\format{A data frame with 51 rows and 2 variables} \format{
A data frame with 51 rows and 2 variables
}
\usage{ \usage{
data(census_regions) data(census_regions)
} }

BIN
man/figures/README-cdc-basemaps-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
man/figures/README-cdc-basemaps-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
man/figures/README-cdc-basemaps-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
man/figures/README-cdc-basemaps-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
man/figures/README-cdc-basemaps-5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
man/figures/README-cdc-basemaps-6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
man/figures/README-ili-df-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
man/figures/README-ili-df-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
man/figures/README-ili-df-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
man/figures/README-ili-df-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

BIN
man/figures/README-ili-weekly-activity-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
man/figures/README-nat-pi-mortality-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
man/figures/README-surveillance-areas-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
man/figures/README-who-vrevss-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

9
man/get_flu_data.Rd

@ -4,9 +4,12 @@
\alias{get_flu_data} \alias{get_flu_data}
\title{Retrieves state, regional or national influenza statistics from the CDC (deprecated)} \title{Retrieves state, regional or national influenza statistics from the CDC (deprecated)}
\usage{ \usage{
get_flu_data(region = "hhs", sub_region = 1:10, get_flu_data(
data_source = "ilinet", years = as.numeric(format(Sys.Date(), region = "hhs",
"\%Y"))) sub_region = 1:10,
data_source = "ilinet",
years = as.numeric(format(Sys.Date(), "\%Y"))
)
} }
\arguments{ \arguments{
\item{region}{one of "\code{hhs}", "\code{census}", "\code{national}", \item{region}{one of "\code{hhs}", "\code{census}", "\code{national}",

7
man/get_hosp_data.Rd

@ -4,8 +4,11 @@
\alias{get_hosp_data} \alias{get_hosp_data}
\title{Retrieves influenza hospitalization statistics from the CDC (deprecated)} \title{Retrieves influenza hospitalization statistics from the CDC (deprecated)}
\usage{ \usage{
get_hosp_data(area = "flusurvnet", age_group = "overall", get_hosp_data(
years = as.numeric(format(Sys.Date(), "\%Y")) - 1) area = "flusurvnet",
age_group = "overall",
years = as.numeric(format(Sys.Date(), "\%Y")) - 1
)
} }
\arguments{ \arguments{
\item{area}{one of "\code{flusurvnet}", "\code{eip}", "\code{ihsp}", or two \item{area}{one of "\code{flusurvnet}", "\code{eip}", "\code{ihsp}", or two

4
man/hhs_regions.Rd

@ -4,7 +4,9 @@
\name{hhs_regions} \name{hhs_regions}
\alias{hhs_regions} \alias{hhs_regions}
\title{HHS Region Table} \title{HHS Region Table}
\format{A data frame with 59 rows and 4 variables} \format{
A data frame with 59 rows and 4 variables
}
\usage{ \usage{
data(hhs_regions) data(hhs_regions)
} }

7
man/hospitalizations.Rd

@ -4,8 +4,11 @@
\alias{hospitalizations} \alias{hospitalizations}
\title{Laboratory-Confirmed Influenza Hospitalizations} \title{Laboratory-Confirmed Influenza Hospitalizations}
\usage{ \usage{
hospitalizations(surveillance_area = c("flusurv", "eip", "ihsp"), hospitalizations(
region = "all", years = NULL) surveillance_area = c("flusurv", "eip", "ihsp"),
region = "all",
years = NULL
)
} }
\arguments{ \arguments{
\item{surveillance_area}{one of "\code{flusurv}", "\code{eip}", or "\code{ihsp}"} \item{surveillance_area}{one of "\code{flusurv}", "\code{eip}", or "\code{ihsp}"}

4
man/mmwrid_map.Rd

@ -4,7 +4,9 @@
\name{mmwrid_map} \name{mmwrid_map}
\alias{mmwrid_map} \alias{mmwrid_map}
\title{MMWR ID to Calendar Mappings} \title{MMWR ID to Calendar Mappings}
\format{A data frame with 4,592 rows and 4 columns} \format{
A data frame with 4,592 rows and 4 columns
}
\description{ \description{
The CDC uses a unique "Morbidity and Mortality Weekly Report" identifier The CDC uses a unique "Morbidity and Mortality Weekly Report" identifier
for each week that starts at 1 (Ref: < https://www.cdc.gov/mmwr/preview/mmwrhtml/su6004a9.htm>). for each week that starts at 1 (Ref: < https://www.cdc.gov/mmwr/preview/mmwrhtml/su6004a9.htm>).

5
man/pi_mortality.Rd

@ -4,8 +4,7 @@
\alias{pi_mortality} \alias{pi_mortality}
\title{Pneumonia and Influenza Mortality Surveillance} \title{Pneumonia and Influenza Mortality Surveillance}
\usage{ \usage{
pi_mortality(coverage_area = c("national", "state", "region"), pi_mortality(coverage_area = c("national", "state", "region"), years = NULL)
years = NULL)
} }
\arguments{ \arguments{
\item{coverage_area}{coverage area for data (national, state or region)} \item{coverage_area}{coverage area for data (national, state or region)}
@ -29,7 +28,7 @@ NCHS Mortality Surveillance System data are presented by the week the death occu
at the national, state, and HHS Region levels. Data on the percentage of deaths due at the national, state, and HHS Region levels. Data on the percentage of deaths due
to P&I on a national level are released two weeks after the week of death to allow to P&I on a national level are released two weeks after the week of death to allow
for collection of enough data to produce a stable percentage. States and HHS regions for collection of enough data to produce a stable percentage. States and HHS regions
with less than 20% of the expected total deaths (average number of total deaths with less than 20\% of the expected total deaths (average number of total deaths
reported by week during 2008-2012) will be marked as insufficient data. Collection reported by week during 2008-2012) will be marked as insufficient data. Collection
of complete data is not expected at the time of initial report, and a reliable of complete data is not expected at the time of initial report, and a reliable
percentage of deaths due to P&I is not anticipated at the U.S. Department of Health percentage of deaths due to P&I is not anticipated at the U.S. Department of Health

3
man/who_nrevss.Rd

@ -4,8 +4,7 @@
\alias{who_nrevss} \alias{who_nrevss}
\title{Retrieve WHO/NREVSS Surveillance Data} \title{Retrieve WHO/NREVSS Surveillance Data}
\usage{ \usage{
who_nrevss(region = c("national", "hhs", "census", "state"), who_nrevss(region = c("national", "hhs", "census", "state"), years = NULL)
years = NULL)
} }
\arguments{ \arguments{
\item{region}{one of "\code{national}", "\code{hhs}", "\code{census}", or "\code{state}"} \item{region}{one of "\code{national}", "\code{hhs}", "\code{census}", or "\code{state}"}

Loading…
Cancel
Save