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
14512643
Commit
14512643
authored
Jan 08, 2021
by
LE GAC Renaud
Browse files
Update RecordHep to standardize oai_url with Record
parent
4693ac92
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
23 deletions
+20
-23
modules/store_tools/recordhep.py
modules/store_tools/recordhep.py
+16
-19
tests/basis/test_03_Record.py
tests/basis/test_03_Record.py
+4
-4
No files found.
modules/store_tools/recordhep.py
View file @
14512643
...
...
@@ -70,9 +70,9 @@ class RecordHep(dict):
Returns:
str:
the p
rimary and secondary OAI identifier are separated
by a comma. The pattern of the identifier is ``oai:host:id`` or
an empty string when it is not defined.
*
the p
attern of the identifier is ``oai:host:id``
* primary and secondary OAI identifier are separated by a comma
*
an empty string when it is not defined.
"""
lst
=
[
self
.
primary_oai
(),
self
.
secondary_oai
()]
...
...
@@ -83,10 +83,9 @@ class RecordHep(dict):
Returns:
str:
the primary and secondary URLs are separated by a comma.
The pattern of the URL is ``https://host/api/literature/id``
or an empty string when it is not defined or when the OAI is
not well formed.
* the pattern of the URL is ``http://host/record/id``
* primary and secondary URLs are separated by a comma.
* an empty string when it is not defined
"""
lst
=
[
self
.
primary_oai_url
(),
self
.
secondary_oai_url
()]
...
...
@@ -99,8 +98,8 @@ class RecordHep(dict):
Returns:
str:
the pattern
of the string
is ``oai:host:id``.
It is an
empty string when not defined
*
the pattern is ``oai:host:id``.
*
empty string when
it is
not defined
"""
return
f
"oai:inspirehep.net:
{
self
[
'control_number'
]
}
"
...
...
@@ -110,13 +109,12 @@ class RecordHep(dict):
Returns:
str:
the pattern of the string is ``https://host/api/literature/id``.
The string is empty when it is not defined or when the OAI
is not well formed.
* the pattern is ``http://inspirehep.net/record/id``
* empty string when it is not defined
"""
recid
=
self
[
"control_number"
]
return
f
"http
s
://inspirehep.net/
api/literature
/
{
recid
}
"
return
f
"http://inspirehep.net/
record
/
{
recid
}
"
def
secondary_oai
(
self
):
"""The secondary OAI identifier.
...
...
@@ -126,8 +124,8 @@ class RecordHep(dict):
Returns:
str:
the pattern
of the string
is ``oai:host:id``.
It is an
empty string when not defined
*
the pattern is ``oai:host:id``.
*
empty string when
it is
not defined
"""
if
"external_system_identifiers"
not
in
self
:
...
...
@@ -147,9 +145,8 @@ class RecordHep(dict):
Returns:
str:
the pattern of the string is ``https://host/record/id``.
The string is empty when it is not defined or when the OAI
is not well formed.
* the pattern is ``http://cds.cern.ch/record/id``
* empty string when it is not defined
"""
if
"external_system_identifiers"
not
in
self
:
...
...
@@ -157,6 +154,6 @@ class RecordHep(dict):
for
elt
in
self
[
"external_system_identifiers"
]:
if
elt
[
"schema"
]
==
"CDS"
:
return
f
"http
s
://cds.cern.ch/record/
{
elt
[
'value'
]
}
"
return
f
"http://cds.cern.ch/record/
{
elt
[
'value'
]
}
"
return
""
tests/basis/test_03_Record.py
View file @
14512643
...
...
@@ -114,14 +114,14 @@ def test_oai_ins_03027(recins):
def
test_primary_oai_url_ins_03028
(
recins
):
assert
recins
.
primary_oai_url
()
==
\
"http
s
://inspirehep.net/
api/literature
/1319638"
"http://inspirehep.net/
record
/1319638"
def
test_secondary_oai_url_ins_03029
(
recins
):
assert
recins
.
secondary_oai_url
()
==
"http
s
://cds.cern.ch/record/1951625"
assert
recins
.
secondary_oai_url
()
==
"http://cds.cern.ch/record/1951625"
def
test_oai_url_ins_03030
(
recins
):
assert
recins
.
oai_url
()
==
\
"http
s
://inspirehep.net/
api/literature
/1319638, "
\
"http
s
://cds.cern.ch/record/1951625"
"http://inspirehep.net/
record
/1319638, "
\
"http://cds.cern.ch/record/1951625"
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