Skip to content

rdmorganiser/rdmo-plugins-rocrate

Repository files navigation

ROcrate Export Plugin

This is an export plugin for RDMO, that was created during the RDMO Hackathon 2023

It aims to export RDMO projects in the RO-Crate format. The user can select which datasets of the RDMO project are included in the RO-Crate export.

The RDMO attributes are mapped to the RO-Crate metadata properties in the rdmo-rocrate.toml config file. The RO-Crate files are constructed with the help of the ro-crate-py library. The export function creates a zip file containing the ro-crate-metadata.json, a JSON-LD file, filled the with metadata values that were extracted from the RDMO project. Individual datasets can be selected to be included in the export, when the project contains datasets. The metadata of each dataset is added to the ro-crate-metadata.json file and empty folders are created for each dataset (for the directory tree).

Setup

Install the plugin in your RDMO virtual environment using pip (directly from GitHub):

pip install git+https://github.com/rdmorganiser/rdmo-plugins-rocrate.git

The dependencies ro-crate-py and tomli will be installed automatically. Add the rdmo_plugins_rocrate app to your INSTALLED_APPS in `config/settings/local.py``:

from . import INSTALLED_APPS
INSTALLED_APPS = ['rdmo_plugins_rocrate'] + INSTALLED_APPS

Add the export plugins to the PROJECT_EXPORTS in config/settings/local.py:

from django.utils.translation import gettext_lazy as _
from . import PROJECT_EXPORTS

PROJECT_EXPORTS += [
    ('rocrate', _('as ROCrate JSON'), 'rdmo_plugins_rocrate.exports.rocrate.rocrate.ROCrateExport')
]

As default the export will be as a zip file download. For development purposes there is a web preview setting available. This feature can be configured by a boolean setting in the rdmo-app with the name ROCRATE_EXPORT_WEB_PREVIEW, it can be omitted and will default to False.

'''
A boolean setting to enable the web preview feature of the rocrate export plugin.
Default: False
Purpose: Local development
'''
ROCRATE_EXPORT_WEB_PREVIEW = True # default is False and this setting can be omitted

Please visit the RDMO documentation for detailed information.