Crossref API for funding data

Author
Affiliation

Luis Montilla

Crossref

Published

January 12, 2024

How to use this workbook

This document is based on the R coding language. You can click on any of the “Code” buttons to display specific code chunks. If you click the Code icon in the top right corner, next to the title, you will be taken to our code repository where you will be able to download this the source document. We’ll make use of the rcrossref Chamberlain et al. (2022) package once again. You can also check a previous document covering how to perform basic queries.

Code
# These are the libraries that we'll need to run this workbook
library(rcrossref)
library(dplyr)
library(purrr)
library(htmltools)
library(reactable)

Setup polite requests

It’s always convenient to remember this section. As per our documentation Polischuk (2021):

There are three ways to access the REST API. In increasing levels of reliability and predictability. They are:

  • Anonymously (aka Public)
  • With self identification (aka Polite)
  • With authentication (aka Plus)

…you can also self-identify by including contact information in your requests. The service is still open and free, but this way we can quickly get in touch with you if your scripts are causing problems. And in turn for providing this contact information, we redirect these requests to a specific “Polite” pool of servers. These servers are generally more reliable because we are more easily able to protect them from misbehaving scripts.

In R, you can add your email as a system variable using the command Sys.setenv(crossref_email = "your.name@yourorganization.org")

Code
Sys.setenv(crossref_email = "lmontilla@crossref.org")

Types of works

For this exercise we want to understand how works are related to grants through their unique ids. We can take advantage of the works endpoint of the Crossref REST API to specifically retrieve grants. As a reminder, you can always check the types endopoint to know the list of types

Code
cr_types() |> 
  pluck("data") |> 
  select(label)
                 label
1         Book Section
2            Monograph
3     Report Component
4               Report
5          Peer Review
6           Book Track
7      Journal Article
8                 Part
9                Other
10                Book
11      Journal Volume
12            Book Set
13     Reference Entry
14 Proceedings Article
15             Journal
16           Component
17        Book Chapter
18  Proceedings Series
19       Report Series
20         Proceedings
21            Database
22            Standard
23      Reference Book
24      Posted Content
25       Journal Issue
26        Dissertation
27               Grant
28             Dataset
29         Book Series
30         Edited Book

So for this, we will use the works endpoint and the grant filter. “One of the main motivators for funders registering grants with Crossref is to simplify the process of research reporting with more automatic matching of research outputs to specific awards”.

Grants by funder

We can have an overview of the currently registered funders and the number of registered grants using the following code. It will apply a filter to retrieve only grants from the works endpoint. Then it will group together the number of grants according the respective funder name:

Code
grants <- cr_works(
           works = TRUE,
           filter = c(type="grant"),
           facet = "funder-name:*"
           )

The exact number might require a more in-depth analysis, as some grants might come from pooled resources from multiple Funders. Also notice that small variations in the registered names might lead to different levels of aggregation. E.g. The HORIZON2020 initiative have sub-units like the Marie Sklodowska-Curie Actions or the Innovation In SMEs

Code
htmltools::browsable(
  tagList(
    reactable(
      grants$facets$`funder-name`,
      columns = list(
        `.id` = colDef(name = "Funder name"),
        V1 = colDef(name = "Number of grants")
      ),
      highlight = TRUE,
      filterable = TRUE,
      searchable = TRUE,
      defaultPageSize = 5,
      elementId = "grant-table"
    ),
    
    tags$button("Download as CSV",
                onclick = "Reactable.downloadDataCSV('grant-table', 'grant-by-funder.csv')"
                )
  )
)

Other resources

References

Chamberlain, Scott, Hao Zhu, Najko Jahn, Carl Boettiger, and Karthik Ram. 2022. Rcrossref: Client for Various ’CrossRef’ ’APIs’. https://CRAN.R-project.org/package=rcrossref.
Polischuk, Patrick. 2021. Tips for Using the Crossref REST API. https://www.crossref.org/documentation/retrieve-metadata/rest-api/tips-for-using-the-crossref-rest-api/.

Licence

Crossref API for funding data by Luis Montilla is licensed under CC BY 4.0