getResourcesData: Get COVID-19 resource metadata

View source: R/getResourcesData.R

getResourcesDataR Documentation

Get COVID-19 resource metadata

Description

Get COVID-19 resource metadata

Usage

getResourcesData(
  query = NULL,
  types = NULL,
  size = 10,
  fetchAll = FALSE,
  fields = NULL,
  sort = NULL,
  facets = NULL,
  facet_size = 10
)

Arguments

query

(optional) constructs a query over ALL fields, or a fielded query searching within specific fields. Fielded query terms should be separated by ' AND ' or ' OR '. See Elasticserach query strings for more info.

types

(optional) vector of resource type to return. The most frequent types include: "Publication", "ClinicalTrial", "Dataset", "Protocol", "SoftwareSourceCode", "Analysis".

size

(optional) number of records to return (default = 10)

fetchAll

(optional) Boolean whether to return all results for the query

fields

(optional) vector specifying which fields to return. Returns all by default. See the outbreak schema for possible fields.

sort

(optional) field to sort by. Add '-' to sort in descending order

facets

(optional) field by which to aggregate (count) their frequency

facet_size

(optional) how many facet groups to include in the facet total (default = 10, max = 1000)

Examples

library(dplyr)
# Get the date latest date for every resource (newest of dateModified, dateCreated, datePublished)
resources_by_date = getResourcesData(query = "date:[2020-01-01 TO *]", fields = "date")

# Get all metadata on remdesivir
remdesivir = getResourcesData(query = "remdesivir", fetchAll = TRUE, fields = c("@type", "name", "curatedBy"))
remdesivir %>% count(`@type`) %>% arrange(desc(n))

# Get all metadata for remdesivir Clinical Trials or Datasets
remdesivir_trials_data = getResourcesData(query = "remdesivir", types = c("ClinicalTrial", "Dataset"), fetchAll = TRUE, fields = c("@type", "name", "curatedBy"))
remdesivir_trials_data %>% count(`@type`) %>% arrange(desc(n))

outbreak-info/R-outbreak-info documentation built on March 2, 2023, 9:58 a.m.