Commit 5463629b authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update REcordHepPubli to fix an issue in process_publication_info

parent 896fd76d
""" store_tools.recordheppubli
"""
import logging
from filters import CLEAN_COLLABORATION
from pandas import DataFrame
from .recordhep import RecordHep
......@@ -51,6 +53,8 @@ class RecordHepPubli(RecordHep, PluginAuthors, PluginPublicationInfo):
super().__init__(recjson)
self.logger = logging.getLogger("web2py.app.limbra")
self._last_fmt_author = "Last, First"
self._process_authors()
self._process_publication_info()
......@@ -83,6 +87,8 @@ class RecordHepPubli(RecordHep, PluginAuthors, PluginPublicationInfo):
is not defined.
"""
self.logger.debug(" process authors")
authors = self.get("authors", None)
if authors is None:
......@@ -159,20 +165,26 @@ class RecordHepPubli(RecordHep, PluginAuthors, PluginPublicationInfo):
and volume.
"""
self.logger.debug(" process publication info")
cols = ["title",
"volume",
"year",
"pagination"]
data = self.get("publication_info", None)
if data is None:
cols = ["title",
"volume",
"year",
"pagination"]
self.df_info = DataFrame([[""] * len(cols)], columns=cols)
return
# filter data to keep only row with year information
data = [dct for dct in data if "year" in dct]
if len(data) == 0:
self.df_info = DataFrame([[""] * len(cols)], columns=cols)
return
# convert data to DataFrame with a well know structure
df = (DataFrame(data)
.astype({"year": str})
......
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