Skip to content

Cleanup #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/R-CMD-check-full.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
workflow_dispatch:

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- { os: macos-latest, r: "release" }

- { os: windows-latest, r: "release" }
# Use 3.6 to trigger usage of RTools35
- { os: windows-latest, r: "3.6" }
# use 4.1 to check with rtools40's older compiler
- { os: windows-latest, r: "4.1" }

- { os: ubuntu-latest, r: "devel", http-user-agent: "release" }
- { os: ubuntu-latest, r: "release" }
- { os: ubuntu-latest, r: "oldrel-1" }
- { os: ubuntu-latest, r: "oldrel-2" }
- { os: ubuntu-latest, r: "oldrel-3" }
- { os: ubuntu-latest, r: "oldrel-4" }
# The oldest version of R we claim to support
- { os: ubuntu-latest, r: "3.5" }

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
22 changes: 21 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,33 @@ name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ubuntu-latest
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- { os: macos-latest, r: "release" }
- { os: windows-latest, r: "release" }
- { os: ubuntu-latest, r: "devel", http-user-agent: "release" }
- { os: ubuntu-latest, r: "release" }
- { os: ubuntu-latest, r: "oldrel-1" }

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
Expand All @@ -27,3 +45,5 @@ jobs:
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ The release consists of multiple steps which can be all done via the GitHub webs
5. Release to CRAN

[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg
[mit-url]: https://opensource.org/licenses/MIT
[mit-url]: https://opensource.org/license/MIT
[github-actions-image]: https://github.com/cmu-delphi/epidatr/workflows/ci/badge.svg
[github-actions-url]: https://github.com/cmu-delphi/epidatr/actions
15 changes: 9 additions & 6 deletions R/cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,15 @@ cache_epidata_call <- function(epidata_call, fetch_args = fetch_args_list()) {
as_of_recent <- check_is_recent(epidata_call$params$as_of, 7)
issues_recent <- check_is_recent(epidata_call$params$issues, 7)
if (as_of_recent || issues_recent) {
cli::cli_warn("using cached results with `as_of` within the past week (or the future!). This will likely result ",
"in an invalid cache. Consider\n",
"1. disabling the cache for this session with `disable_cache` or permanently with environmental ",
"variable `EPIDATR_USE_CACHE=FALSE`\n",
"2. setting `EPIDATR_CACHE_MAX_AGE_DAYS={Sys.getenv('EPIDATR_CACHE_MAX_AGE_DAYS', unset = 1)}` to e.g. `3/24` ",
"(3 hours).",
cli::cli_warn(
c(
"using cached results with `as_of` within the past week (or the future!).",
"This will likely result in an invalid cache. Consider\n",
"1. disabling the cache for this session with `disable_cache` or permanently with environmental ",
"variable `EPIDATR_USE_CACHE=FALSE`\n",
"2. setting `EPIDATR_CACHE_MAX_AGE_DAYS={Sys.getenv('EPIDATR_CACHE_MAX_AGE_DAYS', unset = 1)}`",
" to e.g. `3/24` (3 hours)."
),
.frequency = "regularly",
.frequency_id = "cache timing issues",
class = "cache_recent_data"
Expand Down
7 changes: 0 additions & 7 deletions R/endpoints.R
Original file line number Diff line number Diff line change
Expand Up @@ -1715,13 +1715,6 @@ pvt_twitter <- function(auth, locations, ..., dates = NULL, epiweeks = NULL, fet
#' @description
#' API docs: <https://cmu-delphi.github.io/delphi-epidata/api/wiki.html>
#'
#' ```{r results="asis", echo = FALSE}
#' url <- "https://github.com/raw/cmu-delphi/delphi-epidata/dev/docs/api/covidcast_signals.md"
#' txt <- readLines(url)
#' txt <- txt[7:length(txt)]
#' cat(txt, sep = "\n")
#' ```
#'
#' @examples
#' \dontrun{
#' pub_wiki(articles = "avian_influenza", epiweeks = epirange(201501, 201601))
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Delphi Epidata R client

[![License: MIT][mit-image]][mit-url] [![Github Actions][github-actions-image]][github-actions-url]
[![codecov](https://codecov.io/gh/dsweber2/epidatr/branch/dev/graph/badge.svg?token=jVHL9eHZNZ)](https://codecov.io/gh/dsweber2/epidatr)
[![codecov](https://codecov.io/gh/dsweber2/epidatr/branch/dev/graph/badge.svg?token=jVHL9eHZNZ)](https://app.codecov.io/gh/dsweber2/epidatr)

The [Delphi Epidata API](https://cmu-delphi.github.io/delphi-epidata/) provides real-time access to epidemiological surveillance data for influenza, COVID-19, and other diseases from both official government sources such as the [Center for Disease Control (CDC)](https://www.cdc.gov/datastatistics/index.html) and [Google Trends](https://cmu-delphi.github.io/delphi-epidata/api/covidcast-signals/google-symptoms.html) and private partners such as [Facebook](https://delphi.cmu.edu/blog/2020/08/26/covid-19-symptom-surveys-through-facebook/) and [Change Healthcare](https://www.changehealthcare.com/). It is built and maintained by the Carnegie Mellon University [Delphi research group](https://delphi.cmu.edu/).

Expand Down Expand Up @@ -82,7 +82,7 @@ Note that for the time being, the private endpoints (i.e. those prefixed with
`pvt`) will require a separate key that needs to be passed as an argument.

[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg
[mit-url]: https://opensource.org/licenses/MIT
[mit-url]: https://opensource.org/license/mit
[github-actions-image]: https://github.com/cmu-delphi/epidatr/workflows/ci/badge.svg
[github-actions-url]: https://github.com/cmu-delphi/epidatr/actions

Expand Down
40 changes: 0 additions & 40 deletions man/pub_wiki.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 3 additions & 13 deletions tests/testthat/test-cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,7 @@ test_that("basic cache setup", {
expect_true(is.null(cache_environ$epidatr_cache))
})

tmp_base_dir <- Sys.getenv("TMPDIR")
new_temp_dir <- NULL
if (tmp_base_dir == "") {
new_temp_dir <- md5(paste(Sys.time(), "I am the very model of a modern major general"))
} else {
new_temp_dir <- file.path(
Sys.getenv("TMPDIR"),
md5(paste(Sys.time(), "I am the very model of a modern major general"))
)
}

new_temp_dir <- tempdir()
test_set_cache <- function(cache_dir = new_temp_dir,
days = 1,
max_size = 1,
Expand All @@ -31,11 +21,11 @@ test_that("cache set as expected", {
test_set_cache()
if (grepl("/", as.character(new_temp_dir))) {
# this is what check produces
expect_equal(cache_info()$dir, as.character(new_temp_dir))
expect_equal(cache_info()$dir, normalizePath(new_temp_dir))
} else {
# this is what test produces directly
tmp <- strsplit(cache_info()$dir, "/")[[1]]
expect_equal(tmp[length(tmp)], as.character(new_temp_dir))
expect_equal(tmp[length(tmp)], normalizePath(new_temp_dir))
}
expect_equal(cache_info()$max_size, 1024^2)
expect_equal(cache_info()$max_age, 24 * 60 * 60)
Expand Down