Skip to main content

No project description provided

Project description

OARepo DOI

Configuration example

DATACITE_URL = 'https://api.test.datacite.org/dois'

DATACITE_MAPPING = {'local://documents-1.0.0.json':"common.mapping.DataCiteMappingNRDocs"}

DATACITE_MODE = "AUTOMATIC_DRAFT"

DATACITE_CREDENTIALS = {"generic": {"prefix": "10.23644" , "password": "yyyy", "username": "xxx"}}

DATACITE_CREDENTIALS_DEFAULT = {"prefix": "10.23644" , "password": "yyy", "username": "xxxx"}

DATACITE_SPECIFIED_ID = True

mode types:

  • AUTOMATIC_DRAFT - dois will be assigned automatically when draft is creadet
  • AUTOMATIC - dois will be assigned automatically after publish
  • ON_EVENT - dois are assigned after request

DATACITE_SPECIFIED_ID

  • Default value - False
  • If true, the doi suffix will be the same as record pid

Mapping example

class DataCiteMappingNRDocs:

    def metadata_check(self, data, errors=[]):
        
        data = data["metadata"]
        if "title" not in data:
            errors.append("Title is mandatory")
        
        return errors

    def create_datacite_payload(self, data):
        titles = {"title": "xy"}

        
        payload = {
            "data": {
                "type": "dois",
                "attributes": {
                }
            }
        }
        payload["data"]["attributes"]["titles"] = titles
   
        return payload
    
    def get_doi(self, record):
        object_identifiers = record["metadata"].get("objectIdentifiers", [])
        doi = None
        for id in object_identifiers:
            if id["scheme"] == "DOI":
                doi = id["identifier"]
        return doi

    def add_doi(self, record, data,  doi_value):
        doi = {"scheme": "DOI", "identifier": doi_value}

        if "objectIdentifiers" in data["metadata"]:
            data["metadata"]["objectIdentifiers"].append(doi)
        else:
            data["metadata"]["objectIdentifiers"] = [doi]
        
        record.update(data)
        record.commit()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oarepo_doi-1.0.16.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oarepo_doi-1.0.16-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file oarepo_doi-1.0.16.tar.gz.

File metadata

  • Download URL: oarepo_doi-1.0.16.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for oarepo_doi-1.0.16.tar.gz
Algorithm Hash digest
SHA256 397edf18df335d5323637b0a46f67f1b351b19fc9b2798ea0d1f3f85de179f16
MD5 f25c638579c3aaa9dcee83b7d4bb9979
BLAKE2b-256 f9729274ed93c093a9128fd137a529f674650e9e03ec1ebb0c53acdf66bc007d

See more details on using hashes here.

File details

Details for the file oarepo_doi-1.0.16-py3-none-any.whl.

File metadata

  • Download URL: oarepo_doi-1.0.16-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for oarepo_doi-1.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 c4494d06e2a8be77ad9aec86a2c8d23a77845db34c14d6c6db7a8475ca62e26b
MD5 25e6497f35addcdab5a3a5ee8e251c46
BLAKE2b-256 eda9bb2440f20c5991f68cedeb28be9ca597dfff319efd767be17a2897c4b4f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page