NekUpload.metadata package

class NekUpload.metadata.Identifier(id: str, id_type: IdentifierType)[source]

Bases: object

Metadata object describing a persistent identifier associated with a person or organisation

classmethod from_json(data: dict[str, Any]) Identifier[source]

Deserialise json object to reconstruct object

Parameters:
  • cls (Type[Identifier]) – Class

  • data (dict[str,Any]) – JSON serialised object

Raises:

ValueError – _description_

Returns:

Reconstructed object

Return type:

Identifier

get_id() str[source]

Get the ID

Returns:

ID

Return type:

str

get_id_type() IdentifierType[source]

Get the id type

Returns:

Identifier type

Return type:

IdentifierType

to_json_serialisable() dict[str, Any][source]

Method to serialise object as JSON

Returns:

JSON serialised object

Return type:

dict[str,Any]

class NekUpload.metadata.IdentifierType(*values)[source]

Bases: Enum

Enum denoting persistent identifier types

GND = 'gnd'
ISNI = 'isni'
ORCID = 'orcid'
ROR = 'ror'
class NekUpload.metadata.InvenioMetadata(title: str, publication_date: str, creators: list[InvenioUserInfo], resource_type: ResourceType = ResourceType.DATASET)[source]

Bases: object

Metadata model for handling metadata as prescribed in InvenioRDM. Uses a builder OOP style to allow clients to enhance the metadata description.

add_description(description: str) None[source]

Add a description of the record to be uploaded

Parameters:

description (str) – Description

add_geometry_domain(min_coord: tuple[int, int, int], max_coord: tuple[int, int, int])[source]

Add domian of goemetyr

Parameters:
  • min_coord (tuple[int,int,int]) – _description_

  • max_coord (tuple[int,int,int]) – _description_

add_kinvis(kinvis: float)[source]
add_publisher(publisher: str = 'InvenioRDM') None[source]

Add publisher

Parameters:

publisher (str, optional) – Add publisher name. Defaults to “InvenioRDM”.

Add related persistent identifiers

Parameters:

relation (Relations) – A related identifier

add_reynolds_number(reynolds: float) None[source]

Add reynolds number of flow

Parameters:

reynolds (float) – _description_

add_solver_type(solver_type: str)[source]
add_version(version: str) None[source]

Add the version number (of the software or dataset). Semantic versioning is recommended.

Parameters:

version (str) – Version number

classmethod from_json(data: dict[str, Any]) InvenioMetadata[source]

Reconstruct object from JSON serialisation

Parameters:

data (dict[str,Any]) – Serialised JSON data

Returns:

Reconstructed object

Return type:

InvenioMetadata

get_metadata_payload() dict[str, Any][source]

Get the metadata payload formatted in way InvenioRDM expects

Returns:

Metadata json payload

Return type:

dict[str,Any]

print_ae_metadata_to_file(target_directory: str) str[source]

Print AE Datastore specific metadata to file

Parameters:

target_directory (str) – directory to store file

Returns:

Path to created file

Return type:

str

to_json_serialisable() dict[str, Any][source]

Serialise the object as JSON

Returns:

Serialised json object

Return type:

dict[str,Any]

class NekUpload.metadata.InvenioOrgInfo(name: str)[source]

Bases: InvenioUserInfo

Holds information about an organisation in the format expected from InvenioRDM. Effectively a model for the InvenioRDM Author as an Organisation field.

classmethod from_json(data: dict[str, Any]) InvenioOrgInfo[source]

Deserialise json serialisable object to reconstruct an object of this class.

Parameters:

data (Dict[str,Any]) – JSON serialisable object

Returns:

Reconstructed object

Return type:

InvenioOrgInfo

get_info() dict[str, Any][source]

Return the json payload package, formatted in a way InvenioRDM API expects

Returns:

json payload package, formatted in a way InvenioRDM API expects

Return type:

Dict[str,Any]

to_json_serialisable()[source]

Return a json serialisable object representing this class

Returns:

JSON serialisable object

Return type:

Dict[str,Any]

class NekUpload.metadata.InvenioPersonInfo(given_name: str, family_name: str)[source]

Bases: InvenioUserInfo

Holds information about a person in the format expected from InvenioRDM. Effectively a model for the InvenioRDM Author as a Person field.

classmethod from_json(data: dict[str, Any]) InvenioPersonInfo[source]

Deserialise json serialisable object to reconstruct an object of this class.

Parameters:

data (Dict[str,Any]) – JSON serialisable object

Returns:

Reconstructed object

Return type:

InvenioPersonInfo

get_info() dict[str, Any][source]

Return the json payload package, formatted in a way InvenioRDM API expects

Returns:

json payload package, formatted in a way InvenioRDM API expects

Return type:

Dict[str,Any]

to_json_serialisable() dict[str, Any][source]

Return a json serialisable object representing this class

Returns:

JSON serialisable object

Return type:

Dict[str,Any]

class NekUpload.metadata.InvenioUserInfo[source]

Bases: ABC

Base abstract class describing information about a user

add_identifier(identifier: Identifier) None[source]

Add a persistent identifier related to the user

Parameters:

identifier (Identifier) – Object describing a unique identifier

Raises:

ValueError – _description_

abstractmethod classmethod from_json(data: dict[str, Any]) InvenioUserInfo[source]

Deserialise json serialisable object to reconstruct an object of this class. Factory method.

Parameters:

data (Dict[str,Any]) – JSON serialisable object

Returns:

Object

Return type:

InvenioUserInfo

abstractmethod get_info() dict[str, Any][source]

Return the json payload package

Returns:

JSON representation of the information, formatted for an API call

Return type:

Dict[str,Any]

abstractmethod to_json_serialisable() dict[str, Any][source]

Return a json serialisable object representing this class

Returns:

JSON serialisable object

Return type:

Dict[str,Any]

class NekUpload.metadata.InvenioUserInfoFactory[source]

Bases: object

classmethod create_from_json(json_data: dict[str, Any]) InvenioUserInfo[source]

Create suitable object from json. Note that to figure out which object to create, “type” is used as unique identifier

Parameters:

json_data (dict[str,Any]) – JSON serialised data

Raises:

ValueError – _description_

Returns:

An object of this class or subclass

Return type:

InvenioUserInfo

class NekUpload.metadata.RelationType(*values)[source]

Bases: Enum

CONTINUES = 'continues'
class NekUpload.metadata.Relations(id: str, scheme: RelationsSchemes, relation: RelationType, resource: ResourceType)[source]

Bases: object

Metadata model for handling the Relations field in InvenioRDM. Describes any links between records with each other and/or external resources

classmethod from_json(data: dict[str, Any]) Relations[source]
to_json()[source]
class NekUpload.metadata.RelationsSchemes(*values)[source]

Bases: Enum

DOI = 'doi'
URL = 'url'
class NekUpload.metadata.ResourceType(*values)[source]

Bases: Enum

DATASET = 'dataset'
MODEL = 'model'
PHYSICAL_OBJECT = 'physicalobject'

Submodules