Skip to content

Package docs document a delphi.epidata.key option that no code reads #395

Description

@docxology

Summary

While configuring the package, I found that ?epidatr-package ("Package options" section) documents options(delphi.epidata.key = ...) as the way to specify the API key — but get_api_key() reads only the DELPHI_EPIDATA_KEY environment variable; the option is never consulted. Users who set the option (the documented mechanism!) are silently unkeyed and hit rate limits with no error. I think the section should either be removed (and the man page regenerated) or get_api_key() should honor it — the latter matching the documented behavior.

Evidence (dev tip 87b10e1; identical on main)

R/epidatr-package.R:1-4:

#' @section Package options:
#'
#' The `delphi.epidata.key` option specifies the API key to be used when making
#' requests to the Epidata API.

R/auth.R:37-52 — the reader is env-var-only:

get_api_key <- function() {
  key <- Sys.getenv("DELPHI_EPIDATA_KEY", unset = "")
  ...
}

The string delphi.epidata.key appears in the code only as a warning-throttle id (R/auth.R:49), which is presumably where the documented option's name came from.

Maintainer-runnable repro

options(delphi.epidata.key = "abc")
epidatr::get_api_key()
# Warning: No API key found. ...  -> the option is ignored

Expected vs. actual

  • Expected: options(delphi.epidata.key = "abc") supplies the key, per man/epidatr-package.Rd.
  • Actual: the option is ignored; keyed users who set it are silently rate-limited.

Suggested fix

Either implement it first in get_api_key() (env var taking precedence, so behavior is unchanged for existing users):

key <- Sys.getenv("DELPHI_EPIDATA_KEY", unset = "")
if (key == "") key <- getOption("delphi.epidata.key", default = "")

or delete the stale "Package options" section and regenerate the man page.

I checked for prior reports (open and closed issues/PRs mentioning the option or package options generally — #119 references the string only in a message-wrapping context) and found none covering this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions