EPM_retrieve_data: Submit a Query and Retrieve Results from PubMed.

View source: R/epm_all_fx.R

EPM_retrieve_dataR Documentation

Submit a Query and Retrieve Results from PubMed.

Description

Submit a Query to the NCBI ESearch Server, capture the response and retrieve the corresponding PubMed records from the NCBI EFetch Server. Up to the first n=10,000 records returned by the query will be retrieved (as per the NCBI policy). The operation must be completed within a user-defined timeout window otherwise it will be killed.

Usage

EPM_retrieve_data(
  query_string,
  api_key = NULL,
  format = "xml",
  encoding = "UTF-8",
  timeout = 600,
  batch_size = 500,
  max_restart_attempts = 10
)

Arguments

query_string

String (character vector of length 1), corresponding to the query string.

api_key

String (character vector of length 1), corresponding to the NCBI API key. Can be NULL.

format

String (character vector of length 1), desired format of the Pubmed records. This must be one of the values in c("xml", "medline", "uilist").

encoding

String (character vector of length 1), encoding of the resulting records (e.g., "UTF-8").

timeout

Integer, time allowed for completing the operation (in seconds).

batch_size

Integer, max number of records to be retrieved as a batch. This corresponds to the "retmax" NCBI parameter.

max_restart_attempts

Integer, max number of attempts in case of a failed iteration.

Value

Character vector including the response from the server.

Author(s)

Damiano Fantini, damiano.fantini@gmail.com

References

https://www.data-pulse.com/dev_site/easypubmed/

Examples

# Note: a time limit can be set in order to kill the operation when/if 
# the NCBI/Entrez server becomes unresponsive.
setTimeLimit(elapsed = 4.9)
try({
  qry <- 'Damiano Fantini[AU] AND "2018"[PDAT]'
  easyPubMed:::EPM_retrieve_data(qry, format = "uilist")
}, silent = TRUE)
setTimeLimit(elapsed = Inf)



dami82/easyPubMed documentation built on Jan. 4, 2024, 6:21 a.m.