@@ -2036,6 +2036,155 @@ pvt_quidel <- function(
20362036 ) %> % fetch(fetch_args = fetch_args )
20372037}
20382038
2039+ # ' Canadian respiratory virus surveillance report
2040+ # '
2041+ # ' @description
2042+ # ' API docs: <https://cmu-delphi.github.io/delphi-epidata/api/rvdss.html>
2043+ # '
2044+ # ' Data is weekly.
2045+ # '
2046+ # ' @examples
2047+ # ' \dontrun{
2048+ # ' pub_rvdss(
2049+ # ' geo_type = "province",
2050+ # ' geo_values = c("yu", "on"),
2051+ # ' time_values = epirange(20200601, 20200801)
2052+ # ' )
2053+ # ' pub_rvdss(
2054+ # ' geo_type = "province",
2055+ # ' geo_values = "*",
2056+ # ' time_values = epirange(20200601, 20200801)
2057+ # ' )
2058+ # ' }
2059+ # '
2060+ # ' @param geo_type string. The geographic resolution of the data. Levels available:
2061+ # ' "nation", "region", "province", "lab".
2062+ # ' @param geo_values character. The geographies to return. Defaults to all
2063+ # ' ("*") geographies within requested geographic resolution. "nation" and "province"
2064+ # ' locations use standard 2-letter abbreviations (e.g. "on"). Available regions are
2065+ # ' "atlantic", "bc", "on", "prairies", "qc", and "territories." "lab"s are full
2066+ # ' facility names.
2067+ # ' @param time_values [`timeset`]. Dates to fetch. Defaults to all ("*") dates.
2068+ # ' @param ... not used for values, forces later arguments to bind by name
2069+ # ' @param as_of Date. Optionally, the as of date for the issues to fetch. If not
2070+ # ' specified, the most recent data is returned. Mutually exclusive with
2071+ # ' `issues` or `lag`.
2072+ # ' @param issues [`timeset`]. Optionally, the issue of the data to fetch. If not
2073+ # ' specified, the most recent issue is returned. Mutually exclusive with
2074+ # ' `as_of` or `lag`.
2075+ # ' @param fetch_args [`fetch_args`]. Additional arguments to pass to `fetch()`.
2076+ # ' @return [`tibble::tibble`]
2077+ # '
2078+ # ' @seealso [pub_covidcast_meta()], [covidcast_epidata()], [epirange()]
2079+ # ' @keywords endpoint
2080+ # ' @export
2081+ pub_rvdss <- function (
2082+ geo_type ,
2083+ geo_values = " *" ,
2084+ time_values = " *" ,
2085+ ... ,
2086+ as_of = NULL ,
2087+ issues = NULL ,
2088+ fetch_args = fetch_args_list()) {
2089+ rlang :: check_dots_empty()
2090+
2091+ # Check parameters
2092+ if (missing(geo_type )) {
2093+ cli :: cli_abort(
2094+ " `geo_type` is required" ,
2095+ class = " epidatr__pub_rvdss__missing_required_args"
2096+ )
2097+ }
2098+
2099+ if (sum(! is.null(issues ), ! is.null(as_of )) > 1 ) {
2100+ cli :: cli_abort(
2101+ " `issues` and `as_of` are mutually exclusive" ,
2102+ class = " epidatr__pub_rvdss__too_many_issue_params"
2103+ )
2104+ }
2105+
2106+ assert_character_param(" geo_type" , geo_type , len = 1 )
2107+ assert_timeset_param(" time_values" , time_values )
2108+ assert_character_param(" geo_values" , geo_values )
2109+ assert_date_param(" as_of" , as_of , len = 1 , required = FALSE )
2110+ assert_timeset_param(" issues" , issues , required = FALSE )
2111+ time_values <- parse_timeset_input(time_values )
2112+ as_of <- parse_timeset_input(as_of )
2113+ issues <- parse_timeset_input(issues )
2114+
2115+ create_epidata_call(
2116+ " covidcast/" ,
2117+ list (
2118+ geo_type = geo_type ,
2119+ geo_values = geo_values ,
2120+ time_values = time_values ,
2121+ as_of = as_of ,
2122+ issues = issues
2123+ ),
2124+ list (
2125+ # descriptive fields
2126+ create_epidata_field_info(
2127+ " geo_type" ,
2128+ " categorical" ,
2129+ categories = c(" nation" , " region" , " province" , " lab" )
2130+ ),
2131+ create_epidata_field_info(" geo_value" , " text" ),
2132+ create_epidata_field_info(" region" , " text" ),
2133+ create_epidata_field_info(
2134+ " time_type" ,
2135+ " categorical" ,
2136+ categories = c(" week" )
2137+ ),
2138+ create_epidata_field_info(" epiweek" , " epiweek" ), # Stored as an int in YYYYWW format
2139+ create_epidata_field_info(" time_value" , " epiweek" ), # Stored as a date
2140+ create_epidata_field_info(" issue" , " epiweek" ), # Stored as a date
2141+ create_epidata_field_info(" week" , " int" ),
2142+ create_epidata_field_info(" weekorder" , " int" ),
2143+ create_epidata_field_info(" year" , " int" ),
2144+
2145+ # value fields
2146+ create_epidata_field_info(" adv_pct_positive" , " float" ),
2147+ create_epidata_field_info(" adv_positive_tests" , " float" ),
2148+ create_epidata_field_info(" adv_tests" , " float" ),
2149+ create_epidata_field_info(" evrv_pct_positive" , " float" ),
2150+ create_epidata_field_info(" evrv_positive_tests" , " float" ),
2151+ create_epidata_field_info(" evrv_tests" , " float" ),
2152+ create_epidata_field_info(" flu_pct_positive" , " float" ),
2153+ create_epidata_field_info(" flu_positive_tests" , " float" ),
2154+ create_epidata_field_info(" flu_tests" , " float" ),
2155+ create_epidata_field_info(" flua_pct_positive" , " float" ),
2156+ create_epidata_field_info(" flua_positive_tests" , " float" ),
2157+ create_epidata_field_info(" flua_tests" , " float" ),
2158+ create_epidata_field_info(" fluah1n1pdm09_positive_tests" , " float" ),
2159+ create_epidata_field_info(" fluah3_positive_tests" , " float" ),
2160+ create_epidata_field_info(" fluauns_positive_tests" , " float" ),
2161+ create_epidata_field_info(" flub_pct_positive" , " float" ),
2162+ create_epidata_field_info(" flub_positive_tests" , " float" ),
2163+ create_epidata_field_info(" flub_tests" , " float" ),
2164+ create_epidata_field_info(" hcov_pct_positive" , " float" ),
2165+ create_epidata_field_info(" hcov_positive_tests" , " float" ),
2166+ create_epidata_field_info(" hcov_tests" , " float" ),
2167+ create_epidata_field_info(" hmpv_pct_positive" , " float" ),
2168+ create_epidata_field_info(" hmpv_positive_tests" , " float" ),
2169+ create_epidata_field_info(" hmpv_tests" , " float" ),
2170+ create_epidata_field_info(" hpiv1_positive_tests" , " float" ),
2171+ create_epidata_field_info(" hpiv2_positive_tests" , " float" ),
2172+ create_epidata_field_info(" hpiv3_positive_tests" , " float" ),
2173+ create_epidata_field_info(" hpiv4_positive_tests" , " float" ),
2174+ create_epidata_field_info(" hpiv_pct_positive" , " float" ),
2175+ create_epidata_field_info(" hpiv_positive_tests" , " float" ),
2176+ create_epidata_field_info(" hpiv_tests" , " float" ),
2177+ create_epidata_field_info(" hpivother_positive_tests" , " float" ),
2178+ create_epidata_field_info(" rsv_pct_positive" , " float" ),
2179+ create_epidata_field_info(" rsv_positive_tests" , " float" ),
2180+ create_epidata_field_info(" rsv_tests" , " float" ),
2181+ create_epidata_field_info(" sarscov2_pct_positive" , " float" ),
2182+ create_epidata_field_info(" sarscov2_positive_tests" , " float" ),
2183+ create_epidata_field_info(" sarscov2_tests" , " float" )
2184+ )
2185+ ) %> % fetch(fetch_args = fetch_args )
2186+ }
2187+
20392188# ' Influenza and dengue digital surveillance sensors
20402189# ' @description
20412190# ' API docs: <https://cmu-delphi.github.io/delphi-epidata/api/sensors.html>
0 commit comments