Browse Source

Fixed #6

tags/v0.5.2
boB Rudis 7 years ago
parent
commit
8ae60beea8
  1. 4
      DESCRIPTION
  2. 4
      NEWS.md
  3. 2
      R/cdcfluview-package.R
  4. 4
      R/datasets.r
  5. 4
      R/get_flu_data.r
  6. 4
      R/get_state_data.r
  7. 6
      R/get_weekly_flu_report.r
  8. 6
      R/mortalty.r
  9. 4
      man/cdcfluview.Rd
  10. 2
      man/census_regions.Rd
  11. 2
      man/get_flu_data.Rd
  12. 2
      man/get_mortality_surveillance_data.Rd
  13. 2
      man/get_state_data.Rd
  14. 4
      man/get_weekly_flu_report.Rd
  15. 2
      man/hhs_regions.Rd

4
DESCRIPTION

@ -1,8 +1,8 @@
Package: cdcfluview Package: cdcfluview
Type: Package Type: Package
Title: Retrieve U.S. Flu Season Data from the CDC FluView Portal Title: Retrieve U.S. Flu Season Data from the CDC FluView Portal
Version: 0.5.0 Version: 0.5.1
Date: 2016-09-25 Date: 2016-12-05
Author: Bob Rudis (bob@rud.is) Author: Bob Rudis (bob@rud.is)
Maintainer: Bob Rudis <bob@rud.is> Maintainer: Bob Rudis <bob@rud.is>
Description: The U.S. Centers for Disease Control (CDC) maintains a portal Description: The U.S. Centers for Disease Control (CDC) maintains a portal

4
NEWS.md

@ -1,3 +1,7 @@
# cscfluview 0.5.1
* Replaced `http` URLs with `https` as `http` ones no longer work (fixes #6)
# cdcfluview 0.5.0 # cdcfluview 0.5.0
* Fixed issue with WHO data format change * Fixed issue with WHO data format change

2
R/cdcfluview-package.R

@ -1,7 +1,7 @@
#' Retrieve Flu Season Data from the CDC FluView Portal #' Retrieve Flu Season Data from the CDC FluView Portal
#' #'
#' The U.S. Centers for Disease Control (CDC) maintains a portal #' The U.S. Centers for Disease Control (CDC) maintains a portal
#' \code{http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html} for #' \code{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 Flash interface makes it difficult #' Mortality Surveillance Data. The Flash interface makes it difficult
#' and time-consuming to select and retrieve influenza data. This package #' and time-consuming to select and retrieve influenza data. This package

4
R/datasets.r

@ -15,7 +15,7 @@
#' @keywords datasets #' @keywords datasets
#' @name hhs_regions #' @name hhs_regions
#' #'
#' @references \url{http://www.hhs.gov/iea/regional/} #' @references \url{https://www.hhs.gov/iea/regional/}
#' @usage data(hhs_regions) #' @usage data(hhs_regions)
#' @note Last updated 2015-08-09. #' @note Last updated 2015-08-09.
#' @format A data frame with 59 rows and 4 variables #' @format A data frame with 59 rows and 4 variables
@ -35,7 +35,7 @@ NULL
#' @keywords datasets #' @keywords datasets
#' @name census_regions #' @name census_regions
#' #'
#' @references \url{http://www.cdc.gov/std/stats12/images/CensusMap.png} #' @references \url{https://www.cdc.gov/std/stats12/images/CensusMap.png}
#' @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

4
R/get_flu_data.r

@ -1,7 +1,7 @@
#' Retrieves state, regional or national influenza statistics from the CDC #' Retrieves state, regional or national influenza statistics from the CDC
#' #'
#' Uses the data source from the #' Uses the data source from the
#' \href{http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html}{CDC FluView} #' \href{https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html}{CDC FluView}
#' and provides flu reporting data as either a single data frame or a list of #' and provides flu reporting data as either a single data frame or a list of
#' data frames (depending on whether either \code{WHO NREVSS} or \code{ILINet} #' data frames (depending on whether either \code{WHO NREVSS} or \code{ILINet}
#' (or both) is chosen. #' (or both) is chosen.
@ -75,7 +75,7 @@ get_flu_data <- function(region="hhs", sub_region=1:10,
out_file <- tempfile(fileext=".zip") out_file <- tempfile(fileext=".zip")
tmp <- httr::POST("http://gis.cdc.gov/grasp/fluview/FluViewPhase2CustomDownload.ashx", tmp <- httr::POST("https://gis.cdc.gov/grasp/fluview/FluViewPhase2CustomDownload.ashx",
body=params, body=params,
write_disk(out_file)) write_disk(out_file))

4
R/get_state_data.r

@ -1,7 +1,7 @@
#' Retrieves state/territory-level influenza statistics from the CDC #' Retrieves state/territory-level influenza statistics from the CDC
#' #'
#' Uses the data source from the CDC' State-levelFluView #' Uses the data source from the CDC' State-levelFluView
#' \url{http://gis.cdc.gov/grasp/fluview/main.html} and provides state flu #' \url{https://gis.cdc.gov/grasp/fluview/main.html} and provides state flu
#' reporting data as a single data frame.\cr #' reporting data as a single data frame.\cr
#' \cr #' \cr
#' This function provides similar data to \code{\link{get_weekly_flu_report}} but #' This function provides similar data to \code{\link{get_weekly_flu_report}} but
@ -39,7 +39,7 @@ get_state_data <- function(years=as.numeric(format(Sys.Date(), "%Y"))) {
DataMode="STATE", DataMode="STATE",
SeasonsList=paste0(years, collapse=",")) SeasonsList=paste0(years, collapse=","))
tmp <- httr::POST("http://gis.cdc.gov/grasp/fluview/FluViewPhase1CustomDownload.ashx", tmp <- httr::POST("https://gis.cdc.gov/grasp/fluview/FluViewPhase1CustomDownload.ashx",
body=params, body=params,
write_disk(out_file)) write_disk(out_file))

6
R/get_weekly_flu_report.r

@ -1,6 +1,6 @@
#' Retrieves (high-level) weekly influenza surveillance report from the CDC #' Retrieves (high-level) weekly influenza surveillance report from the CDC
#' #'
#' The CDC publishes a \href{http://www.cdc.gov/flu/weekly/usmap.htm}{weekly #' The CDC publishes a \href{https://www.cdc.gov/flu/weekly/usmap.htm}{weekly
#' influenza report} detailing high-level flu activity per-state. They also #' influenza report} detailing high-level flu activity per-state. They also
#' publish a data file (see \code{References}) of historical report readings. #' publish a data file (see \code{References}) of historical report readings.
#' This function reads that XML file and produces a long \code{data_frame} #' This function reads that XML file and produces a long \code{data_frame}
@ -9,7 +9,7 @@
#' This function provides similar data to \code{\link{get_state_data}} but without #' This function provides similar data to \code{\link{get_state_data}} but without
#' the reporting source metadata and a limit on the historical flu information. #' the reporting source metadata and a limit on the historical flu information.
#' #'
#' @references \url{http://www.cdc.gov/flu/weekly/flureport.xml} #' @references \url{https://www.cdc.gov/flu/weekly/flureport.xml}
#' @return \code{tbl_df} (also classed with \code{cdcweeklyreport}) with six #' @return \code{tbl_df} (also classed with \code{cdcweeklyreport}) with six
#' columns: \code{year}, \code{week_number}, \code{state}, \code{color}, #' columns: \code{year}, \code{week_number}, \code{state}, \code{color},
#' \code{label}, \code{subtitle} #' \code{label}, \code{subtitle}
@ -20,7 +20,7 @@
get_weekly_flu_report <- function() { get_weekly_flu_report <- function() {
# grab the report # grab the report
doc <- read_xml("http://www.cdc.gov/flu/weekly/flureport.xml") doc <- read_xml("https://www.cdc.gov/flu/weekly/flureport.xml")
# extract the time periods # extract the time periods
periods <- xml_attrs(xml_find_all(doc, "timeperiod")) periods <- xml_attrs(xml_find_all(doc, "timeperiod"))

6
R/mortalty.r

@ -20,7 +20,7 @@
#' counts will be released only after 20% of the expected number of deaths are reported #' counts will be released only after 20% of the expected number of deaths are reported
#' through the system. #' through the system.
#' #'
#' @references \url{http://www.cdc.gov/flu/weekly/nchs.htm} #' @references \url{https://www.cdc.gov/flu/weekly/nchs.htm}
#' @return a list of \code{tbl_df}s #' @return a list of \code{tbl_df}s
#' @export #' @export
#' @examples \dontrun{ #' @examples \dontrun{
@ -28,9 +28,9 @@
#' } #' }
get_mortality_surveillance_data <- function() { get_mortality_surveillance_data <- function() {
pg <- read_html("http://www.cdc.gov/flu/weekly/nchs.htm") pg <- read_html("https://www.cdc.gov/flu/weekly/nchs.htm")
PREFIX <- "http://www.cdc.gov" PREFIX <- "https://www.cdc.gov"
xml_find_all(pg, ".//select[@id='State']/option[contains(@value, 'csv') and xml_find_all(pg, ".//select[@id='State']/option[contains(@value, 'csv') and
contains(@value, 'State_')]") %>% contains(@value, 'State_')]") %>%

4
man/cdcfluview.Rd

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cdcfluview-package.r % Please edit documentation in R/cdcfluview-package.R
\docType{package} \docType{package}
\name{cdcfluview} \name{cdcfluview}
\alias{cdcfluview} \alias{cdcfluview}
@ -7,7 +7,7 @@
\title{Retrieve Flu Season Data from the CDC FluView Portal} \title{Retrieve Flu Season Data from the 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
\code{http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html} for \code{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 Flash interface makes it difficult Mortality Surveillance Data. The Flash interface makes it difficult
and time-consuming to select and retrieve influenza data. This package and time-consuming to select and retrieve influenza data. This package

2
man/census_regions.Rd

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

2
man/get_flu_data.Rd

@ -29,7 +29,7 @@ If only a single \code{data_source} is specified, then a single
} }
\description{ \description{
Uses the data source from the Uses the data source from the
\href{http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html}{CDC FluView} \href{https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html}{CDC FluView}
and provides flu reporting data as either a single data frame or a list of and provides flu reporting data as either a single data frame or a list of
data frames (depending on whether either \code{WHO NREVSS} or \code{ILINet} data frames (depending on whether either \code{WHO NREVSS} or \code{ILINet}
(or both) is chosen. (or both) is chosen.

2
man/get_mortality_surveillance_data.Rd

@ -37,6 +37,6 @@ get_mortality_surveillance_data()
} }
} }
\references{ \references{
\url{http://www.cdc.gov/flu/weekly/nchs.htm} \url{https://www.cdc.gov/flu/weekly/nchs.htm}
} }

2
man/get_state_data.Rd

@ -17,7 +17,7 @@ A \code{data.frame} of state-level data for the specified seasons
} }
\description{ \description{
Uses the data source from the CDC' State-levelFluView Uses the data source from the CDC' State-levelFluView
\url{http://gis.cdc.gov/grasp/fluview/main.html} and provides state flu \url{https://gis.cdc.gov/grasp/fluview/main.html} and provides state flu
reporting data as a single data frame.\cr reporting data as a single data frame.\cr
\cr \cr
This function provides similar data to \code{\link{get_weekly_flu_report}} but This function provides similar data to \code{\link{get_weekly_flu_report}} but

4
man/get_weekly_flu_report.Rd

@ -12,7 +12,7 @@ get_weekly_flu_report()
\code{label}, \code{subtitle} \code{label}, \code{subtitle}
} }
\description{ \description{
The CDC publishes a \href{http://www.cdc.gov/flu/weekly/usmap.htm}{weekly The CDC publishes a \href{https://www.cdc.gov/flu/weekly/usmap.htm}{weekly
influenza report} detailing high-level flu activity per-state. They also influenza report} detailing high-level flu activity per-state. They also
publish a data file (see \code{References}) of historical report readings. publish a data file (see \code{References}) of historical report readings.
This function reads that XML file and produces a long \code{data_frame} This function reads that XML file and produces a long \code{data_frame}
@ -27,6 +27,6 @@ get_weekly_flu_report()
} }
} }
\references{ \references{
\url{http://www.cdc.gov/flu/weekly/flureport.xml} \url{https://www.cdc.gov/flu/weekly/flureport.xml}
} }

2
man/hhs_regions.Rd

@ -25,7 +25,7 @@ This dataset contains the names, numbers, regional offices for-,
Last updated 2015-08-09. Last updated 2015-08-09.
} }
\references{ \references{
\url{http://www.hhs.gov/iea/regional/} \url{https://www.hhs.gov/iea/regional/}
} }
\keyword{datasets} \keyword{datasets}

Loading…
Cancel
Save