Commit 29066b3d authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update store_tools/factory.py to remove obsolete add_affiliation_keys

parent 5742c84e
""" store_tools.factory """ store_tools.factory
""" """
import re
from .base import (CDS, from .base import (CDS,
INS, INS,
is_conference, is_conference,
...@@ -27,40 +25,6 @@ REX_T = "\$\$t([\w, ]+)" ...@@ -27,40 +25,6 @@ REX_T = "\$\$t([\w, ]+)"
REX_U = "\$\$u([\w, ]+)" REX_U = "\$\$u([\w, ]+)"
def add_affiliation_keys(recjson):
"""A the affiliation keys to the record describing an institute:
* The XML record contains the affiliation keys used by inspirehep.net.
They are located in the field 110__u and 110__t (future).
* The JSON record does not contains this information.
* This tool add the affiliation keys to the JSON record.
They are located:
+----------------+------------------------------------+
| field (limbra) | subfield |
+----------------+------------------------------------+
| corporate_note | identifier, futur_identifier, name |
+----------------+------------------------------------+
Args:
recjson (dict):
record data (MarcJSON)
"""
store = InvenioStore("inspirehep", shelf="institutions")
url = f"https://old.inspirehep.net/record/{recjson['recid']}"
rep = store.interrogate(url, ot="110", of="txt")
txt = rep.text
recjson["corporate_note"] = {
"identifier": re.search(REX_U, txt).group(1),
"future_identifier": re.search(REX_T, txt).group(1)}
def add_conference_data(recjson): def add_conference_data(recjson):
"""Add the conference data to the recjson. """Add the conference data to the recjson.
...@@ -212,7 +176,6 @@ def build_record(recjson): ...@@ -212,7 +176,6 @@ def build_record(recjson):
upcast_record = RecordConf(recjson) upcast_record = RecordConf(recjson)
elif is_institute(recjson): elif is_institute(recjson):
add_affiliation_keys(recjson)
upcast_record = RecordInst(recjson) upcast_record = RecordInst(recjson)
elif is_thesis(recjson): elif is_thesis(recjson):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment