Skip to content

Commit

Permalink
Fix script to add MSNET ids to papers
Browse files Browse the repository at this point in the history
  • Loading branch information
michamos committed Sep 28, 2023
1 parent 83328ea commit 4aec570
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

from inspirehep.curation.search_check_do import SearchCheckDo

URL = "https://cernbox.cern...msnet_add_id.txt"
MSNET_IDS = requests.get(URL)
URL = (
"https://cernbox.cern.ch/remote.php/dav/public-files/"
"DgV3O0I8D8haXMZ/msnet_add_id.json"
)
MSNET_IDS = requests.get(URL).json()

ELEMENT = "external_system_identifiers"

Expand All @@ -15,12 +18,10 @@ class AddMsnetIds(SearchCheckDo):

@staticmethod
def check(record, logger, state):
if record.get_value("control_number") not in MSNET_IDS:
return True
for schema in record.get_value(f"{ELEMENT}.schema", []):
if schema == "MSNET":
return True
return False
return record["control_number"] in MSNET_IDS and not any(
id_["schema"] == "MSNET"
for id_ in record.get("external_system_identifiers", [])
)

@staticmethod
def do(record, logger, state):
Expand Down

0 comments on commit 4aec570

Please sign in to comment.