Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
abd23540
Commit
abd23540
authored
Jan 07, 2021
by
LE GAC Renaud
Browse files
Update PluginPublicationInfo to store DataFrame in df_info instead of publication_info
parent
096b1277
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
14 deletions
+13
-14
modules/store_tools/pluginpublicationinfo.py
modules/store_tools/pluginpublicationinfo.py
+8
-8
modules/store_tools/recordpubli.py
modules/store_tools/recordpubli.py
+2
-3
tests/basis/test_04_RecordPubli.py
tests/basis/test_04_RecordPubli.py
+1
-1
tests/basis/test_05_RecordHepPubli.py
tests/basis/test_05_RecordHepPubli.py
+1
-1
tests/basis/test_13_CheckAndFix_article.py
tests/basis/test_13_CheckAndFix_article.py
+1
-1
No files found.
modules/store_tools/pluginpublicationinfo.py
View file @
abd23540
...
...
@@ -26,7 +26,7 @@ class PluginPublicationInfo(object):
+------------+--------------------------------+
The DataFrame has to be build in the parent
It is retrieved via self["
publication
_info"]
It is retrieved via self["
df
_info"]
"""
...
...
@@ -46,7 +46,7 @@ class PluginPublicationInfo(object):
# * the row contains empty string when the record is not published.
# * iloc[0] returns a serie where the index are the column's name
#
columns
=
(
self
[
"
publication
_info"
].
iloc
[
0
]
columns
=
(
self
[
"
df
_info"
].
iloc
[
0
]
.
replace
(
""
,
np
.
nan
)
.
dropna
()
.
index
)
...
...
@@ -60,7 +60,7 @@ class PluginPublicationInfo(object):
bool
"""
df
=
self
[
"
publication
_info"
]
df
=
self
[
"
df
_info"
]
return
len
(
df
)
>
1
def
paper_editor
(
self
):
...
...
@@ -71,7 +71,7 @@ class PluginPublicationInfo(object):
empty string when not defined.
"""
df
=
self
[
"
publication
_info"
]
df
=
self
[
"
df
_info"
]
editor
=
(
df
.
title
.
iloc
[
0
]
if
"title"
in
df
else
""
)
# add space after the dot Phys.Rev -> Phys. Rev
...
...
@@ -88,7 +88,7 @@ class PluginPublicationInfo(object):
* Empty string when not defined.
"""
df
=
self
[
"
publication
_info"
]
df
=
self
[
"
df
_info"
]
return
(
df
.
pagination
.
iloc
[
0
]
if
"pagination"
in
df
else
""
)
def
paper_reference
(
self
):
...
...
@@ -101,7 +101,7 @@ class PluginPublicationInfo(object):
published in a review.
"""
df
=
self
[
"
publication
_info"
]
df
=
self
[
"
df
_info"
]
its
=
df
.
columns
.
intersection
({
"title"
,
"volume"
,
...
...
@@ -128,7 +128,7 @@ class PluginPublicationInfo(object):
empty string when nothing is found.
"""
df
=
self
[
"
publication
_info"
]
df
=
self
[
"
df
_info"
]
return
(
df
.
volume
.
iloc
[
0
]
if
"volume"
in
df
else
""
)
def
paper_year
(
self
):
...
...
@@ -139,5 +139,5 @@ class PluginPublicationInfo(object):
- Empty string if the year is not defined.
"""
df
=
self
[
"
publication
_info"
]
df
=
self
[
"
df
_info"
]
return
(
df
.
year
.
iloc
[
0
]
if
"year"
in
df
else
""
)
modules/store_tools/recordpubli.py
View file @
abd23540
...
...
@@ -236,8 +236,7 @@ class RecordPubli(Record, PluginAuthors, PluginPublicationInfo):
"year"
,
"pagination"
]
self
[
"publication_info"
]
=
\
DataFrame
([[
""
]
*
len
(
cols
)],
columns
=
cols
)
self
[
"df_info"
]
=
DataFrame
([[
""
]
*
len
(
cols
)],
columns
=
cols
)
return
...
...
@@ -262,7 +261,7 @@ class RecordPubli(Record, PluginAuthors, PluginPublicationInfo):
df
=
df
.
sort_values
(
"year"
)
# replace
self
[
"
publication
_info"
]
=
df
self
[
"
df
_info"
]
=
df
def
collaboration
(
self
):
"""The collaboration(s) signing the publication.
...
...
tests/basis/test_04_RecordPubli.py
View file @
abd23540
...
...
@@ -52,7 +52,7 @@ def test_constructor_cds_04002(record):
assert
len
(
authors
)
==
record
[
"number_of_authors"
]
assert
authors
.
affiliation
.
iloc
[
12
]
==
"INFN, Rome|CERN"
papers
=
record
[
"
publication
_info"
]
papers
=
record
[
"
df
_info"
]
assert
isinstance
(
papers
,
pd
.
DataFrame
)
assert
len
(
papers
)
==
1
...
...
tests/basis/test_05_RecordHepPubli.py
View file @
abd23540
...
...
@@ -52,7 +52,7 @@ def test_constructor_ins_05002(record):
assert
len
(
authors
)
==
704
assert
authors
.
affiliation
.
iloc
[
12
]
==
"INFN, Rome|CERN"
papers
=
record
[
"
publication
_info"
]
papers
=
record
[
"
df
_info"
]
assert
isinstance
(
papers
,
pd
.
DataFrame
)
assert
len
(
papers
)
==
1
...
...
tests/basis/test_13_CheckAndFix_article.py
View file @
abd23540
...
...
@@ -66,7 +66,7 @@ def test_paper_reference_cds_13004(svc, reccds):
# remove the publisher and volume information
paper_ref
=
reccds
.
paper_reference
()
reccds
[
"
publication
_info"
].
loc
[
0
,
[
"title"
,
"volume"
]]
=
[
""
,
""
]
reccds
[
"
df
_info"
].
loc
[
0
,
[
"title"
,
"volume"
]]
=
[
""
,
""
]
svc
.
paper_reference
(
reccds
)
assert
reccds
.
paper_reference
()
==
paper_ref
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment