This Helper document allows the automatic creation of a research object crate with metadata and especially the link to the author(agent). https://github.com/ResearchObject/ro-crate-py

library(reticulate)
library(renv)
renv::restore()
knitr::knit_engines$set(python = reticulate::eng_python)
use_virtualenv("../renv/python/virtualenvs/renv-python-3.9.5/", required=T)
use_python("../renv/python/virtualenvs/renv-python-3.9.5/bin/python")
py_config()
py_install("rocrate", envname = "../renv/python/virtualenvs/renv-python-3.9.5/")
from rocrate.rocrate import ROCrate
crate = ROCrate() 

Data entities

## adding a File entity:
raw_file = '../data-raw/raw_data.xlsx'
file_entity = crate.add_file(raw_file)

# Adding a File entity with a reference to an external (absolute) URI
#remote_file = crate.add_file('https://github.com/ResearchObject/ro-crate-py/blob/master/test/test-data/test_galaxy_wf.ga', fetch_remote = False)

# adding a Dataset
#sample_dir = '/path/to/dir'
#dataset_entity = crate.add_directory(sample_dir, 'relative/rocrate/path')

Contextual Entities

from rocrate.model.person import Person

# Add authors info
#crate.add(Person(crate, '#lukas', {'name': 'Lukas Huber'}))
creator = Person(crate, '001', {'name': 'Lukas Huber', "@id": 'https://orcid.org/0000-0001-5443-0290'})

crate.publisher = creator
crate.creator = [ creator ]

Other Metadata

crate.license = 'GPL-3'
crate.isBasedOn = "https://github.com/g4challenge/repro-fair-neuro-ds-template"
crate.name = 'Reproducible Neuro-Intensive-Care Data Science Project Template'
crate.keywords = ['Neurology', 'Data Science', 'Reproducibility', 'Provenance', 'Traceability']
crate.image = "drake_workflow.svg"
crate.description = "The template for this workflow can be found on GitHub, DockerHub and binder"
crate.CreativeWorkStatus = "Maturing"

write File

# write crate to disk
out_path = '../man/figures/'
crate.write_crate(out_path)