Skip to contents

Look up DOIs in the corpus via the Unpaywall API and add open-access status and best OA URL to the works table.

This enricher is idempotent: re-running it updates existing OA data rather than duplicating it. Requires a mailto address for API access.

Usage

sm_enrich_unpaywall(
  corpus,
  mailto = Sys.getenv("SCIMAPR_MAILTO"),
  verbose = TRUE,
  call = rlang::caller_env()
)

Arguments

corpus

An sm_corpus object.

mailto

Email address for the Unpaywall API. Read from SCIMAPR_MAILTO env var by default.

verbose

Print progress messages?

call

Caller environment for error reporting.

Value

An sm_corpus object with updated oa_status and oa_url columns in the works table, plus new provenance rows.

Examples

if (FALSE) { # \dontrun{
# Not run: the Unpaywall API needs a contact e-mail address (`mailto`).
corpus <- sm_corpus(works = tibble::tibble(
  work_id = "W1",
  doi = "10.1371/journal.pbio.1002541"
))
corpus <- sm_enrich_unpaywall(corpus, mailto = "name@example.org")
} # }