Conversation
|
Thanx @jli2025 i’ll have a look asap |
|
Hi @pvgenuchten I just added a commit to fix the identifier issue (when there is no pids) as we discussed. |
|
Code looks really nice @jli2025, some small comments:
|
06ba553 to
82cc422
Compare
|
@jli2025 Can you extend the plugin to make |
8514419 to
9c41c48
Compare
pvgenuchten
left a comment
There was a problem hiding this comment.
operational now, added a import test
tomkralidis
left a comment
There was a problem hiding this comment.
Great work! Some additional comments/change requests.
| # those files. Users are asked to read the 3rd Party Licenses | ||
| # referenced with those assets. | ||
| # | ||
| # Copyright (c) 2025 Tom Kralidis, Jiarong Li, Paul van Genuchten |
There was a problem hiding this comment.
Copyright should be one line per person (who touched the code).
| # | ||
| # ================================================================= | ||
|
|
||
| import logging |
| return contact_dict | ||
|
|
||
|
|
||
| def id2url(scheme: str, id: str) -> str: |
There was a problem hiding this comment.
id -> id_ (id is a Python keyword)
|
|
||
| def id2url(scheme: str, id: str) -> str: | ||
| """ | ||
| Convert orcid, wikidata, ror or grid value to url |
There was a problem hiding this comment.
Complete docstring (add :param id:, and :returns:)
|
|
||
| def id2url(scheme: str, id: str) -> str: | ||
| """ | ||
| Convert orcid, wikidata, ror or grid value to url |
There was a problem hiding this comment.
scheme2 = scheme.lower()
value = None
if scheme2 in ['ror', 'grid']:
value = id_
elif scheme2 == 'orcid':
return f'https://orcid.org/{id_}'
elif scheme2 == 'wikidata':
value = f'https://www.wikidata.org/wiki/{id_}'
elif scheme2 == 'isni':
value = f'https://isni.org/isni/{id_}'
return value| contactpoint_dict['organization'] = org_name | ||
| pids = contact.get('pids', []) | ||
| if pids is not None: | ||
| for p in pids: |
There was a problem hiding this comment.
for p in pids:
if p.get('scheme').lower() in ['ror', 'grid', 'wikidata', 'isni']:
contactpoint_dict['url'] = id2url(
p.get('scheme'), p.get('value'))
break| if pid is not None and pid.get('id') is not None: | ||
| pid_scheme = pid.get('id', {}).get('scheme') | ||
| pid_value = pid.get('id', {}).get('value') | ||
| if pid_scheme is not None and pid_value is not None: |
There was a problem hiding this comment.
if None not in [pid_scheme, pid_value]:|
|
||
| def process_keywords(subjects: list) -> dict: | ||
| """ | ||
| convert openaire keywords to mcf keywords |
There was a problem hiding this comment.
Complete docstring (add :param subjects:, :returns:)
|
|
||
|
|
||
| def process_id_and_instance( | ||
| pids: list, originIds: list, |
There was a problem hiding this comment.
Complete docstring (add :param:'s, :returns:)
| mcf['metadata']['hierarchylevel'] = instance_type_ | ||
|
|
||
| date_of_collection = metadata_.get('dateOfCollection') | ||
| if date_of_collection: |
There was a problem hiding this comment.
Can we test with if date_of_collection is not None:? Needs to be applied a few places in this function where a .get() was called.
|
actually, maybe we are too friendly here... we should also have a clear case indicating: "This json is not in OpenAire format", else it would parse any json and return an almost empty mcf... in case actually, the openaire is totally not considered yet when using autodetect, an update is needed elsewhere? |
- do not require results wrapper - add import test
This PR adds support for openaire metadata. It only supports import (openaire -> mcf).
It can use used for metadata record from the new openaire api: OpenAIRE Graph API
An example openaire metadata record: https://api.openaire.eu/graph/v2/researchProducts?pid=10.3390/proceedings2019030057