Skip to content

Pull data from zenodo #15

Description

@dfalster

Once the dataset is public, we'll want a function that can pull the data directly from the Austraits page on Zenodo: https://doi.org/10.5281/zenodo.3568417

On Zenodo each release has a doi. There's also an overall "concept doi", which is pointer to the entire project (and by default redirects to the latest release).

image

For any given version, we can access a json of the metadata via a link like https://zenodo.org/api/records/4316550, where the number 4316550 comes form the doi: 10.5281/zenodo.4316550

Using this we can load the metadata straight into R

x <- 
  jsonlite::fromJSON("https://zenodo.org/api/records/4316550")
# or  
# httr::GET("https://zenodo.org/api/records/4316550") |> httr::content(as = "text") |> fromJSON()

This information includes links to the files, which we can use to download the file

url <- x$files$links$download[1]
filename <- basename( x$files$filename[1] )
download.file(url, filename)

So that will work for retrieving

  • the latest version, whatever it is
  • any version when you know the DOI

A remaining challenge is to discover all the versions associated with the conceptdoi. So far I can't see how to do that from zenodo. But it is possible via doi resolution service.

Metadata

Metadata

Assignees

Labels

taskA discrete task needed for a feature

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions