Skip to content

Commit c6c0a6b

Browse files
committed
Move 'oai_base' to 'api_endpoint'
1 parent 3cfb33f commit c6c0a6b

File tree

7 files changed

+32
-34
lines changed

7 files changed

+32
-34
lines changed

api/evaluator.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class EvaluatorBase(ABC):
7575
Digital Object identifier, which can be a generic one (DOI, PID), or an internal (e.g. an
7676
identifier from the repo)
7777
78-
oai_base : str
78+
api_endpoint : str
7979
Open Archives initiative , This is the place in which the API will ask for the metadata
8080
8181
lang : str
@@ -89,10 +89,10 @@ class EvaluatorBase(ABC):
8989
"""
9090

9191
def __init__(
92-
self, item_id, oai_base=None, lang="en", config=None, name=None, **kwargs
92+
self, item_id, api_endpoint=None, lang="en", config=None, name=None, **kwargs
9393
):
9494
self.item_id = item_id
95-
self.oai_base = oai_base
95+
self.api_endpoint = api_endpoint
9696
self.lang = lang
9797
self.config = config
9898
self.name = name
@@ -674,7 +674,7 @@ def rda_a1_02m(self):
674674
)
675675
except Exception as e:
676676
logger.error(e)
677-
item_id_http = self.oai_base
677+
item_id_http = self.api_endpoint
678678
points, msg = ut.metadata_human_accessibility(self.metadata, item_id_http)
679679
return (points, [{"message": msg, "points": points}])
680680

@@ -788,7 +788,7 @@ def rda_a1_03d(self):
788788
msg_list = []
789789
points = 0
790790
try:
791-
landing_url = urllib.parse.urlparse(self.oai_base).netloc
791+
landing_url = urllib.parse.urlparse(self.api_endpoint).netloc
792792
item_id_http = idutils.to_url(
793793
self.item_id,
794794
idutils.detect_identifier_schemes(self.item_id)[0],
@@ -853,7 +853,7 @@ def rda_a1_04m(self, return_protocol=False):
853853
"""
854854
points = 0
855855

856-
protocol = ut.get_protocol_scheme(self.oai_base)
856+
protocol = ut.get_protocol_scheme(self.api_endpoint)
857857
if protocol in self.terms_access_protocols:
858858
points = 100
859859
msg = "Found a standarised protocol to access the metadata record: " + str(
@@ -1205,11 +1205,11 @@ def rda_i1_02m(self):
12051205
points = 0
12061206
msg_list = []
12071207
try:
1208-
if self.oai_base is not None:
1209-
metadata_formats = ut.get_rdf_metadata_format(self.oai_base)
1208+
if self.api_endpoint is not None:
1209+
metadata_formats = ut.get_rdf_metadata_format(self.api_endpoint)
12101210
rdf_metadata = None
12111211
for e in metadata_formats:
1212-
url = ut.oai_check_record_url(self.oai_base, e, self.item_id)
1212+
url = ut.oai_check_record_url(self.api_endpoint, e, self.item_id)
12131213
rdf_metadata = ut.oai_get_metadata(url)
12141214
if rdf_metadata is not None:
12151215
points = 100

api/rda.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def load_evaluator(wrapped_func):
2323
def wrapper(body, **kwargs):
2424
repo = body.get("repo")
2525
item_id = body.get("id", "")
26-
oai_base = body.get("oai_base")
26+
api_endpoint = body.get("api_endpoint")
2727
lang = body.get("lang", "en")
2828
pattern_to_query = body.get("q", "")
2929

@@ -47,7 +47,7 @@ def wrapper(body, **kwargs):
4747
if pattern_to_query:
4848
try:
4949
ids = plugin.Plugin.get_ids(
50-
oai_base=oai_base, pattern_to_query=pattern_to_query
50+
api_endpoint=api_endpoint, pattern_to_query=pattern_to_query
5151
)
5252
except Exception as e:
5353
logger.error(str(e))
@@ -64,7 +64,9 @@ def wrapper(body, **kwargs):
6464
result = {}
6565
exit_code = 200
6666
for item_id in ids:
67-
eva = plugin.Plugin(item_id, oai_base, lang, name=repo, config=config_data)
67+
eva = plugin.Plugin(
68+
item_id, api_endpoint, lang, name=repo, config=config_data
69+
)
6870
_result, _exit_code = wrapped_func(body, eva=eva)
6971
logger.debug(
7072
"Raw result returned for indicator ID '%s': %s" % (item_id, _result)

plugins/digital_csic/plugin.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Plugin(EvaluatorBase):
3333
Digital Object identifier, which can be a generic one (DOI, PID), or an internal (e.g. an
3434
identifier from the repo)
3535
36-
oai_base : str
36+
api_endpoint : str
3737
Open Archives Initiative , This is the place in which the API will ask for the metadata. If you are working with Digital CSIC http://digital.csic.es/dspace-oai/request
3838
3939
lang : Language
@@ -42,18 +42,16 @@ class Plugin(EvaluatorBase):
4242
def __init__(
4343
self,
4444
item_id,
45-
oai_base="http://digital.csic.es/dspace-oai/request",
45+
api_endpoint="http://digital.csic.es/dspace-oai/request",
4646
lang="en",
4747
config=None,
4848
name="digital_csic",
4949
):
5050
self.config = config
5151
self.name = name
5252
self.lang = lang
53-
self.oai_base = oai_base
53+
self.oai_base = api_endpoint
5454

55-
if oai_base == "":
56-
self.oai_base = None
5755
if ut.get_doi_str(item_id) != "":
5856
self.item_id = ut.get_doi_str(item_id)
5957
self.id_type = "doi"
@@ -64,7 +62,7 @@ def __init__(
6462
self.item_id = item_id
6563
self.id_type = "internal"
6664

67-
super().__init__(self.item_id, oai_base, self.lang, self.config, self.name)
65+
super().__init__(self.item_id, self.oai_base, self.lang, self.config, self.name)
6866

6967
self.file_list = None
7068
self.metadata = self.get_metadata()

plugins/dspace7/plugin.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@ class DSpace_7(Evaluator):
2727
----------
2828
item_id : str
2929
Digital Object identifier, which can be a generic one (DOI, PID), or an internal (e.g. an identifier from the repo)
30-
oai_base : str
30+
api_endpoint : str
3131
Open Archives initiative , This is the place in which the API will ask for the metadata
3232
lang : Language
3333
"""
3434

35-
def __init__(self, item_id, oai_base=None, lang="en", config=None):
36-
if oai_base == "":
37-
oai_base = None
35+
def __init__(self, item_id, api_endpoint=None, lang="en", config=None):
3836
logger.debug("Call parent")
3937
plugin = "dspace7"
40-
super().__init__(item_id, oai_base, lang, plugin)
38+
super().__init__(item_id, api_endpoint, lang, plugin)
4139
logger.debug("Parent called")
4240
if ut.get_doi_str(item_id) != "":
4341
self.item_id = ut.get_doi_str(item_id)
@@ -51,7 +49,7 @@ def __init__(self, item_id, oai_base=None, lang="en", config=None):
5149
self.internal_id = self.get_internal_id(item_id)
5250
self.metadata = self.get_item_metadata(self.internal_id)
5351
self.access_protocol = []
54-
self.oai_base = oai_base
52+
self.oai_base = api_endpoint
5553
logging.debug("INTERNAL ID: %s ITEM ID: %s" % (self.internal_id, self.item_id))
5654
if len(self.metadata) > 0:
5755
self.access_protocols = ["http", "REST-API"]

plugins/epos/plugin.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ def __init__(self, *args, **kwargs):
3535
**kwargs,
3636
)
3737

38-
self.api_endpoint = self.oai_base
39-
4038
logger.debug("Using FAIR-EVA's plugin: %s" % self.name)
4139

4240
# Metadata gathering

plugins/gbif/plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ class Plugin(EvaluatorBase):
3030
item_id : str
3131
Digital Object identifier, which can be a generic one (DOI, PID), or an internal (e.g. andentifier from the repo)
3232
33-
oai_base : str
33+
api_endpoint : str
3434
Open Archives Initiative , This is the place in which the API will ask for the metadata. If you are working with Digital CSIC http://digital.csic.es/dspace-oai/request
3535
3636
lang : Language
3737
"""
3838

39-
def __init__(self, item_id, oai_base=None, lang="en", config=None, name="gbif"):
39+
def __init__(self, item_id, api_endpoint=None, lang="en", config=None, name="gbif"):
4040

4141
self.config = config
4242
self.name = name
4343
self.lang = lang
44-
self.oai_base = oai_base
45-
super().__init__(item_id, oai_base, self.lang, self.config, self.name)
44+
self.oai_base = api_endpoint
45+
super().__init__(item_id, self.oai_base, self.lang, self.config, self.name)
4646
logger.debug("Using FAIR-EVA's plugin: %s" % self.name)
4747
global _
4848
_ = super().translation()

plugins/oai-pmh/plugin.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ class Plugin(EvaluatorBase):
2626
----------
2727
item_id : str
2828
Digital Object identifier, which can be a generic one (DOI, PID), or an internal (e.g. an identifier from the repo)
29-
oai_base : str
29+
api_endpoint : str
3030
Open Archives initiative , This is the place in which the API will ask for the metadata
3131
lang : Language
3232
"""
3333

34-
def __init__(self, item_id, oai_base=None, lang="en", config=None, name="oai-pmh"):
34+
def __init__(
35+
self, item_id, api_endpoint=None, lang="en", config=None, name="oai-pmh"
36+
):
3537
self.config = config
3638
self.name = name
3739
self.lang = lang
38-
self.oai_base = oai_base
39-
super().__init__(item_id, oai_base, self.lang, self.config, self.name)
40+
self.oai_base = api_endpoint
41+
super().__init__(item_id, self.oai_base, self.lang, self.config, self.name)
4042
logger.debug("Using FAIR-EVA's plugin: %s" % self.name)
4143
global _
4244
_ = super().translation()

0 commit comments

Comments
 (0)