hermes.commands.deposit.base
Classes
Base class that implements the generic deposition workflow. |
|
Generic deposition settings. |
|
Deposit the curated metadata to repositories. |
Module Contents
- class hermes.commands.deposit.base.HermesDepositPlugin
Bases:
hermes.commands.base.HermesPluginBase class that implements the generic deposition workflow.
TODO: describe workflow… needs refactoring to be less stateful!
- __call__(command: HermesDepositCommand, prov_doc: hermes.model.provenance.ld_prov.ld_prov_list | None) None
Initiate the deposition process.
This calls a list of additional methods on the class, none of which need to be implemented.
- Parameters:
command (HermesDepositCommand) – The command running this plugin.
prov_doc (ld_prov_list | None) – The provenance document the provenance information is to be recorded in.
- Return type:
None
- Raises:
HermesValidationError – If the metadata from the curation step couldn’t be loaded.
- prepare() None
Prepare the deposition.
This method may be implemented to check whether config and context match some initial conditions.
If no exceptions are raised, execution continues.
- Return type:
None
- abstractmethod map_metadata() dict
Map the given metadata to the target schema of the deposition platform and return it.
When mapping metadata, make sure to add traces to the HERMES software, e.g. via DataCite’s
relatedIdentifierusing theisCompiledByrelation. Ideally, the value of the relation target should be of the respective type for DOIs in your metadata schema, with the value itself being the DOI for the version of the HERMES software you are using.- Returns:
The mapped metadata.
- Return type:
dict
- is_initial_publication() bool
Decide whether to do an initial publication or publish a new version.
Returning
Trueindicates that publication of an initial version will be executed, resulting in a call ofcreate_initial_version().Falseindicates a new version of an existing publication, leading to a call ofcreate_new_version().By default, this returns
True.- Returns:
Whether or not it is the initial publication.
- Return type:
bool
- create_initial_version() None
Create an initial version of the publication on the target platform.
- Return type:
None
- create_new_version() None
Create a new version of an existing publication on the target platform.
- Return type:
None
- abstractmethod update_metadata() dict
Update the metadata of the newly created version and return it even if it hasn’t changed.
- Returns:
The updated metadata.
- Return type:
dict
- class hermes.commands.deposit.base.DepositSettings(/, **data: Any)
Bases:
pydantic.BaseModelGeneric deposition settings.
- class hermes.commands.deposit.base.HermesDepositCommand(parser: argparse.ArgumentParser)
Bases:
hermes.commands.base.HermesCommandDeposit the curated metadata to repositories.
- args
The namespace that was returned by the command line parser when reading the arguments.
- Type:
Namespace
- init_command_parser(command_parser: argparse.ArgumentParser) None
Add arguments for deposit command.
- Parameters:
command_parser (ArgumentParser) – The used argument parser.
- Return type:
None
- __call__(args: argparse.Namespace) None
Execute the hermes command self.
- Parameters:
args (Namespace) – The namespace that was returned by the command line parser when reading the arguments.
- Return type:
None
- Raises:
MisconfigurationError – If the deposit plugin wasn’t found.
HermesPluginRunError – If something went wrong in the plugin run.
- load_prov_doc() hermes.model.provenance.ld_prov.ld_prov_list | None
Loads the provenance document of the curate step.
- Returns:
The loaded provenance document or None if the load failed.
- Return type:
ld_prov_list | None