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.13.tar.gz
(14.6 kB
view details)
Built Distribution
File details
Details for the file oarepo_doi-1.0.13.tar.gz
.
File metadata
- Download URL: oarepo_doi-1.0.13.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36bda5ae9e459371cf44b6af77d5463ad06557812c65b0745186a19e555f5216 |
|
MD5 | 04fbed8e29b725fcbf1b99eb0cc831e8 |
|
BLAKE2b-256 | 9d3af3a095633b6fa7a8374a46f5dc77a0104e2d15377e2dc45cfa8c8539ed6f |
File details
Details for the file oarepo_doi-1.0.13-py3-none-any.whl
.
File metadata
- Download URL: oarepo_doi-1.0.13-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 463fcba3edc5574670ef94275aeac69088b9b29f3db64561379b44a0249f5c34 |
|
MD5 | 380d8cbda72fadf35facf147b9ad57ea |
|
BLAKE2b-256 | 94a51d470e98e2a6509c907c5ad82c8ebc3c2f27479abc3a2c871e8f18d5e78c |