Browse Source

Fixed #6

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

+ 2
- 2
DESCRIPTION View File

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


+ 4
- 0
NEWS.md View File

@ -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
* Fixed issue with WHO data format change


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

@ -1,7 +1,7 @@
#' Retrieve Flu Season Data from the CDC FluView 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
#' Mortality Surveillance Data. The Flash interface makes it difficult
#' and time-consuming to select and retrieve influenza data. This package


+ 2
- 2
R/datasets.r View File

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

+ 2
- 2
R/get_flu_data.r View File

@ -1,7 +1,7 @@
#' Retrieves state, regional or national influenza statistics from the CDC
#'
#' 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
#' data frames (depending on whether either \code{WHO NREVSS} or \code{ILINet}
#' (or both) is chosen.
@ -75,7 +75,7 @@ get_flu_data <- function(region="hhs", sub_region=1:10,
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,
write_disk(out_file))


+ 2
- 2
R/get_state_data.r View File

@ -1,7 +1,7 @@
#' Retrieves state/territory-level influenza statistics from the CDC
#'
#' 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
#' \cr
#' 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",
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,
write_disk(out_file))


+ 3
- 3
R/get_weekly_flu_report.r View File

@ -1,6 +1,6 @@
#' 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
#' publish a data file (see \code{References}) of historical report readings.
#' 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
#' 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
#' columns: \code{year}, \code{week_number}, \code{state}, \code{color},
#' \code{label}, \code{subtitle}
@ -20,7 +20,7 @@
get_weekly_flu_report <- function() {
# 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
periods <- xml_attrs(xml_find_all(doc, "timeperiod"))


+ 3
- 3
R/mortalty.r View File

@ -20,7 +20,7 @@
#' counts will be released only after 20% of the expected number of deaths are reported
#' 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
#' @export
#' @examples \dontrun{
@ -28,9 +28,9 @@
#' }
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
contains(@value, 'State_')]") %>%


+ 2
- 2
man/cdcfluview.Rd View File

@ -1,5 +1,5 @@
% 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}
\name{cdcfluview}
\alias{cdcfluview}
@ -7,7 +7,7 @@
\title{Retrieve Flu Season Data from the CDC FluView Portal}
\description{
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
Mortality Surveillance Data. The Flash interface makes it difficult
and time-consuming to select and retrieve influenza data. This package


+ 1
- 1
man/census_regions.Rd View File

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

+ 1
- 1
man/get_flu_data.Rd View File

@ -29,7 +29,7 @@ If only a single \code{data_source} is specified, then a single
}
\description{
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
data frames (depending on whether either \code{WHO NREVSS} or \code{ILINet}
(or both) is chosen.


+ 1
- 1
man/get_mortality_surveillance_data.Rd View File

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

+ 1
- 1
man/get_state_data.Rd View File

@ -17,7 +17,7 @@ A \code{data.frame} of state-level data for the specified seasons
}
\description{
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
\cr
This function provides similar data to \code{\link{get_weekly_flu_report}} but


+ 2
- 2
man/get_weekly_flu_report.Rd View File

@ -12,7 +12,7 @@ get_weekly_flu_report()
\code{label}, \code{subtitle}
}
\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
publish a data file (see \code{References}) of historical report readings.
This function reads that XML file and produces a long \code{data_frame}
@ -27,6 +27,6 @@ get_weekly_flu_report()
}
}
\references{
\url{http://www.cdc.gov/flu/weekly/flureport.xml}
\url{https://www.cdc.gov/flu/weekly/flureport.xml}
}

+ 1
- 1
man/hhs_regions.Rd View File

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

Loading…
Cancel
Save