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"}
mode types:
AUTOMATIC_DRAFT
- dois will be assigned automatically when draft is creadetAUTOMATIC
- dois will be assigned automatically after publishON_EVENT
- dois are assigned after request
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
Release history Release notifications | RSS feed
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.3.tar.gz
(9.5 kB
view details)
Built Distribution
File details
Details for the file oarepo_doi-1.0.3.tar.gz
.
File metadata
- Download URL: oarepo_doi-1.0.3.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b9979c6a3f19caefc12d9b521b73da51990ae309b3c2d3d9a0db0faa710ca7b |
|
MD5 | 1b226dbd6502fd3d5662554bea287ca1 |
|
BLAKE2b-256 | bfba8d3e608c366ef7b8381ba0b04e56fb40fc49a9bda9c8f980aa510050f5e6 |
File details
Details for the file oarepo_doi-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: oarepo_doi-1.0.3-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa3adfef51e90a9c81a364384991ca6d5a073124b7204b7205ade895931c70dc |
|
MD5 | 4caa7cff7055824a63fb8c7e37ccb373 |
|
BLAKE2b-256 | 2d0213fac2a3998797a0170551923981e821ff386a10942db877c5fd8d6c1b71 |