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 creadetAUTOMATIC
- dois will be assigned automatically after publishON_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
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.9.tar.gz
(11.1 kB
view details)
Built Distribution
File details
Details for the file oarepo_doi-1.0.9.tar.gz
.
File metadata
- Download URL: oarepo_doi-1.0.9.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc69b35641db483f41392127a40475de36b87fbeed67f302228e91d10b5c727e |
|
MD5 | c9d1412e36ced33c27790651598ed44b |
|
BLAKE2b-256 | 34859aabd891a611f0adad813214602d0068a04b6f8080e5e4815ae26a511e67 |
File details
Details for the file oarepo_doi-1.0.9-py3-none-any.whl
.
File metadata
- Download URL: oarepo_doi-1.0.9-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83549c6bbcc019d2335e19515c6eb0f4a04c10e61bd28522f9ed0e58cb4afcde |
|
MD5 | c49746d23ff6188bb9c98849c83f887b |
|
BLAKE2b-256 | 5174f3939e07b1c821e600320654a36765553d79037362365f3a1421b94f0745 |