Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion scripts/metadata_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from invenio_communities.proxies import current_communities
from invenio_db import db
from werkzeug.local import LocalProxy
from flask import current_app

community_service = LocalProxy(lambda: current_communities.service)

Expand Down Expand Up @@ -50,10 +51,43 @@
}
],
},
{
"id": "cern:doi/prefix-community",
"title": "CERN DOI prefix required",
"message": "Records with publisher CERN must use the CERN DOI prefix.",
"description": "Ensures records published by CERN use the configured DataCite prefix when a DOI is provided.",
"level": "error",
"error_path": "pids.doi",
"condition": {
"type": "logical",
"operator": "and",
"expressions": [
{
"type": "comparison",
"left": {"type": "field", "path": "metadata.publisher"},
"operator": "==",
"right": "CERN",
},
{
"type": "comparison",
"left": {"type": "field", "path": "pids.doi.identifier"},
"operator": "!=",
"right": "",
},
],
},
"checks": [
{
"type": "comparison",
"left": {"type": "field", "path": "pids.doi.identifier"},
"operator": "^=",
"right": current_app.config["DATACITE_PREFIX"],
}
],
},
]
}

from flask import current_app

CDS_CERN_SCIENTIFIC_COMMUNITY_ID = current_app.config[
"CDS_CERN_SCIENTIFIC_COMMUNITY_ID"
Expand Down
Loading