Commit 6b35d88c authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update add_conference_data to add protection defining conference url

parent 71afdaa3
...@@ -151,8 +151,10 @@ def add_conference_data(recjson): ...@@ -151,8 +151,10 @@ def add_conference_data(recjson):
# Add conference data to the recjson (inspirehep.net) # Add conference data to the recjson (inspirehep.net)
# #
elif host in INS: elif host in INS:
# location of the conference
address = [el for el in confjson["addresses"] if el.get("country")][0] address = [el for el in confjson["addresses"] if el.get("country")][0]
# date of the conference 6-12 Dec 2010
start, end = confjson["opening_date"], confjson["closing_date"] start, end = confjson["opening_date"], confjson["closing_date"]
ds = datetime.strptime(start, "%Y-%m-%d") ds = datetime.strptime(start, "%Y-%m-%d")
de = datetime.strptime(end, "%Y-%m-%d") de = datetime.strptime(end, "%Y-%m-%d")
...@@ -162,6 +164,16 @@ def add_conference_data(recjson): ...@@ -162,6 +164,16 @@ def add_conference_data(recjson):
else: else:
sdate = f"{ds.strftime('%-d %b')} - {de.strftime('%-d %b %Y')}" sdate = f"{ds.strftime('%-d %b')} - {de.strftime('%-d %b %Y')}"
# URL of the conference (take the first value)
urls = confjson.get("urls")
if urls is None:
url = ""
elif isinstance(urls, list) and len(urls) > 0:
url = urls[0]["value"]
else:
url = "???"
# add
recjson["meeting_name"] = [{ recjson["meeting_name"] = [{
"closing_date": end, "closing_date": end,
"coference_code": confjson["cnum"], "coference_code": confjson["cnum"],
...@@ -174,7 +186,7 @@ def add_conference_data(recjson): ...@@ -174,7 +186,7 @@ def add_conference_data(recjson):
recjson["meeting_note"] = { recjson["meeting_note"] = {
"recid": confjson["control_number"], "recid": confjson["control_number"],
"url": confjson["urls"][0]["value"]} "url": url}
def build_record(recjson): def build_record(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