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.19.tar.gz (20.0 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.19-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oarepo_doi-1.0.19.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for oarepo_doi-1.0.19.tar.gz
Algorithm Hash digest
SHA256 4616145104c50e15af1f9cf8f4da8556e4bd44f9d849e82909e9f2e371482baf
MD5 b8f96be54ff16e65cc8157f0058d9307
BLAKE2b-256 c3d957ed83d37a0ea7bb08fd2812c04207d66c724a5ef00d4cbf8b47843484d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oarepo_doi-1.0.19-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for oarepo_doi-1.0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 15cc8852d60eff3bcc5db3b6f8da8801d13ca18a6372acd70f06915696e5fea7
MD5 90840e47d5097f5e2a8ce2402611bbd1
BLAKE2b-256 6d84e386ac8e4940565baae6b57d2a203a31225927f53fa80f1d95da28ff41c9

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