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.18.tar.gz (17.8 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.18-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oarepo_doi-1.0.18.tar.gz
  • Upload date:
  • Size: 17.8 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.18.tar.gz
Algorithm Hash digest
SHA256 699b7f891e60affff6bb78523aa77dee6dcfdd36f84d3974dd1e892492dc6bc7
MD5 44eafa9443ca475e555ec6bb45efdf0b
BLAKE2b-256 3db2c8faacf8b57087eb9f963908d1f72e0cb5a2b8818bab3a8f72944b1bdfe4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oarepo_doi-1.0.18-py3-none-any.whl
  • Upload date:
  • Size: 16.3 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.18-py3-none-any.whl
Algorithm Hash digest
SHA256 32f286b5b62f072df1d513f3fef4c2396ba68c50a5b02ba133c4e2a94f9b15fa
MD5 91dde29c67108d4404e24ac29e7cb878
BLAKE2b-256 54a1b3fb99f1df70aae90540abce324785dd671a4ff9883faef9fa22da0af1dd

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