Commit 8e4dbfc0 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Improve debug message in RecordCds, RecordHepPubli and friends

parent 378867e0
......@@ -15,7 +15,7 @@ from .base import (ARXIV,
search_synonym,
REG_DOI,
REG_OAI,
T6)
T4, T6)
from .exception import CheckException
from filters import CLEAN_COLLABORATION
from pandas import concat, DataFrame
......@@ -238,6 +238,8 @@ class RecordCdsPubli(dict, AuthorsMixin, PublicationInfoMixin):
field does not exist.
"""
self.logger.debug(f"{T4}process authors")
if "authors" not in self:
cols = ["affiliation",
"first_name",
......@@ -313,6 +315,8 @@ class RecordCdsPubli(dict, AuthorsMixin, PublicationInfoMixin):
and volume.
"""
self.logger.debug(f"{T4}process publication info")
if "publication_info" not in self:
cols = ["title",
"volume",
......
......@@ -3,6 +3,7 @@
"""
import requests
from .base import T4, T6
from datetime import datetime
from plugin_dbui import CLEAN_SPACES
from .recordheppubli import RecordHepPubli
......@@ -20,6 +21,15 @@ class RecordHepConfPaper(RecordHepPubli):
Schema for conference metadata is document here:
https://inspire-schemas.readthedocs.io/en/latest/schemas/
Main information are:
* addresses: [{cities: [], country: str, ...}, ...]
* cnum: str
* control_number: int
* closing_date: str
* opening_date: str
* titles: [{value: str}, ...]
* urls: [{value: str}, ...]
"""
def __init__(self, recjson):
......@@ -30,12 +40,16 @@ class RecordHepConfPaper(RecordHepPubli):
self._process_conference_data()
def _process_conference_data(self):
"""Append the conference record.
"""Append the conference data to the record.
"""
logger = self.logger
logger.debug(f"{T4}process conference data")
# get the URL of the conference record in inspirehep.net
publication_info = self.get("publication_info", None)
if publication_info is None:
logger.debug(f"{T6}no 'publication_info' field")
return
urlins = None
......@@ -44,6 +58,7 @@ class RecordHepConfPaper(RecordHepPubli):
urlins = elt.get("conference_record", {}).get("$ref", None)
if urlins is None:
logger.debug(f"{T6}no 'conference_record.$ref' information")
return
# get conference metadata
......@@ -53,6 +68,7 @@ class RecordHepConfPaper(RecordHepPubli):
obj = r.json()
except(requests.RequestException, ValueError):
logger.debug(f"{T6}failed to retrieve conference data")
return
self.conference = obj.get("metadata", None)
......
......@@ -9,7 +9,7 @@ from .base import (search_synonym,
MSG_UNKNOWN_COLLABORATION,
MSG_WELL_FORMED_DATE,
REG_DATE_YYYYMM,
T6)
T4, T6)
from .exception import CheckException
from filters import CLEAN_COLLABORATION
from pandas import DataFrame
......@@ -98,7 +98,7 @@ class RecordHepPubli(dict, AuthorsMixin, PublicationInfoMixin):
is not defined.
"""
self.logger.debug(" process authors")
self.logger.debug(f"{T4}process authors")
authors = self.get("authors", None)
......@@ -176,7 +176,7 @@ class RecordHepPubli(dict, AuthorsMixin, PublicationInfoMixin):
and volume.
"""
self.logger.debug(" process publication info")
self.logger.debug(f"{T4}process publication info")
cols = ["title",
"volume",
......
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