Get COVID-19 resource metadata

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)

Value

Examples

library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
# 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))
#> # A tibble: 11 × 2
#>    `@type`                         n
#>    <chr>                       <int>
#>  1 Publication                  3108
#>  2 ClinicalTrial                 460
#>  3 Dataset                        62
#>  4 ImageObject                    14
#>  5 Protocol                       14
#>  6 ScholarlyArticle               13
#>  7 Report                          3
#>  8 MediaObject                     2
#>  9 Book                            1
#> 10 Chapter                         1
#> 11 PresentationDigitalDocument     1

# 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))
#> # A tibble: 2 × 2
#>   `@type`           n
#>   <chr>         <int>
#> 1 ClinicalTrial   460
#> 2 Dataset          62