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": {"mode": "AUTOMATIC_DRAFT", "prefix": "10.23644" , "password": "yyyy", "username": "xxx"}}

DATACITE_CREDENTIALS_DEFAULT = {"mode": "AUTOMATIC_DRAFT", "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.5.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

oarepo_doi-1.0.5-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for oarepo_doi-1.0.5.tar.gz
Algorithm Hash digest
SHA256 18d79105f727d4d9decf121f71e06ff33f5f8ce56e6ca6c7f15dc4714ec103c4
MD5 b1f1f4bd805518eb4f4c839cb0dec2b2
BLAKE2b-256 2d5abced49f59941f70be98c33e9d31593b4f952662f85315f870707a1419da9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for oarepo_doi-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 211b35355dea125938902b5a8d5cb253ae2de6f1ddb0d409aade0ce584af11b2
MD5 f101c482a4461cf75982c6e7071e817e
BLAKE2b-256 bdf3cb577865cec38ba07ce6ff0caa719ec1e7ee0a4e608837716d5954e9ea20

See more details on using hashes here.

Supported by

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