Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YDA-5401: Fix fail publish on incomplete contributor #330

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions json_datacite.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,14 @@ def get_contributors(combi):
for person in combi.get('Contributor', []):
affiliations = []
for aff in person.get('Affiliation', []):
if isinstance(aff, dict):
if isinstance(aff, dict) and len(aff):
if "Affiliation_Identifier" in aff and len(aff["Affiliation_Identifier"]):
affiliations.append({"name": aff['Affiliation_Name'],
"affiliationIdentifier": '{}'.format(aff['Affiliation_Identifier']),
"affiliationIdentifierScheme": "ROR"})
else:
affiliations.append({'name': aff['Affiliation_Name']})
else:
elif len(aff):
affiliations.append({'name': aff})

name_ids = []
Expand All @@ -293,14 +293,14 @@ def get_contributors(combi):
for person in combi.get('ContactPerson', []):
affiliations = []
for aff in person.get('Affiliation', []):
if isinstance(aff, dict):
if isinstance(aff, dict) and len(aff):
if "Affiliation_Identifier" in aff and len(aff["Affiliation_Identifier"]):
affiliations.append({"name": aff['Affiliation_Name'],
"affiliationIdentifier": '{}'.format(aff['Affiliation_Identifier']),
"affiliationIdentifierScheme": "ROR"})
else:
affiliations.append({'name': aff['Affiliation_Name']})
else:
elif len(aff):
affiliations.append({'name': aff})

name_ids = []
Expand Down Expand Up @@ -445,7 +445,7 @@ def get_geo_locations(combi):

There are two versions of this:
1) Default schema - only textual representation of
2) Geo schema including map (=bounding box or marker/point information) Inclunding temporal and spatial descriptions
2) Geo schema including map (=bounding box or marker/point information) Including temporal and spatial descriptions
Both are mutually exclusive.
I.e. first test presence of 'geoLocation'. Then test presence of 'Covered_Geolocation_Place'

Expand Down
11 changes: 6 additions & 5 deletions meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,12 @@ def update_index_metadata(ctx, path, metadata, creation_time, data_package):

if 'Contributor' in metadata:
for contributor in metadata['Contributor']:
name = contributor['Name']
if 'Given_Name' in name and 'Family_Name' in name:
ctx.msi_add_avu('-C', path, 'Contributor',
name['Given_Name'] + ' ' + name['Family_Name'],
constants.UUFLATINDEX)
if 'Name' in contributor:
name = contributor['Name']
if 'Given_Name' in name and 'Family_Name' in name:
ctx.msi_add_avu('-C', path, 'Contributor',
name['Given_Name'] + ' ' + name['Family_Name'],
constants.UUFLATINDEX)

if 'Tag' in metadata:
for tag in metadata['Tag']:
Expand Down
2 changes: 1 addition & 1 deletion publication.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def generate_base_DOI(ctx, publication_config, publication_state):


def generate_datacite_json(ctx, publication_state):
"""Generate a DataCite compliant JSON based up yoda-metadata.json.
"""Generate a DataCite compliant JSON based on yoda-metadata.json.

:param ctx: Combined type of a callback and rei struct
:param publication_state: Dict with state of the publication process
Expand Down
4 changes: 2 additions & 2 deletions templates/landingpage.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@
<span>{{ contributor.Name.Family_Name }}, {{ contributor.Name.Given_Name }}</span>
</div>
</div>
{% endif %}

<div class="row">
<div class="col-sm-2">
Expand Down Expand Up @@ -471,6 +470,7 @@
</span>
</div>
</div>
{% endif %}
{% endfor %}

{% for contact in contacts %}
Expand All @@ -483,7 +483,6 @@
<span>{{ contact.Name.Family_Name }}, {{ contact.Name.Given_Name }}</span>
</div>
</div>
{% endif %}

{% if contact.Position %}
<div class="row">
Expand Down Expand Up @@ -543,6 +542,7 @@
</span>
</div>
</div>
{% endif %}
{% endfor %}

<div class="row">
Expand Down