Skip to content

Commit

Permalink
Switch subject to lowercase to match datacite json
Browse files Browse the repository at this point in the history
  • Loading branch information
claravox committed Dec 16, 2024
1 parent 69cee11 commit dc9e198
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
6 changes: 0 additions & 6 deletions json_datacite.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,10 @@ def get_subjects(combi):

# Assume that there is only one keyword field,
# either called HierarchicalKeyword or Keyword
# TODO combine with the json_landing_page one?
if "HierarchicalKeyword" in combi:
subjects.extend(combi["HierarchicalKeyword"])
# for keyword in combi["HierarchicalKeyword"]:
# keyword['subject'] = keyword['Subject']
# del keyword['Subject']
# subjects.append(keyword)
else:
for keyword in combi.get('Keyword', []):
# TODO why is this not uppercase here?
subjects.append({'subject': keyword, 'subjectScheme': 'Keyword'})

# for backward compatibility. Tag will become obsolete
Expand Down
2 changes: 1 addition & 1 deletion json_landing_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def json_landing_page_create_json_landing_page(ctx, zone, template_name, combi_j
keywords.extend(json_data.get("HierarchicalKeyword"))
else:
for keyword in json_data.get('Keyword', []):
keywords.append({'Subject': keyword, 'subjectScheme': 'Keyword'})
keywords.append({'subject': keyword, 'subjectScheme': 'Keyword'})

try:
disciplines = []
Expand Down
8 changes: 4 additions & 4 deletions schemas/epos-msl-0/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1005,24 +1005,24 @@
"type": "object",
"additionalProperties": false,
"properties": {
"Subject": {
"subject": {
"$ref": "#/definitions/stringNormal",
"title": "Keyword name"
},
"subjectScheme": {
"$ref": "#/definitions/stringNormal",
"title": "Name of the subject scheme"
},
"schemeURI": {
"schemeUri": {
"$ref": "#/definitions/stringNormal",
"title": "URI of the subject identifier scheme"
},
"valueURI": {
"valueUri": {
"$ref": "#/definitions/stringNormal",
"title": "URI of the subject term"
}
},
"required": ["Subject"]
"required": ["subject"]
}
},
"Related_Resource": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/epos-msl-0/uischema.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"ui:field": "hierarchical_keyword_selector",
"ui:data": "https://raw.githubusercontent.com/UtrechtUniversity/msl_vocabularies/refs/heads/main/vocabularies/combined/editor/1.3/editor_1-3.json",
"ui:subjectScheme": "EPOS MSL",
"ui:schemeURI": "https://github.com/UtrechtUniversity/msl_vocabularies"
"ui:schemeUri": "https://github.com/UtrechtUniversity/msl_vocabularies"
},
"Related_Resource": {
"items": {
Expand Down
6 changes: 3 additions & 3 deletions templates/landingpage.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@
<div class="keywords">
<label>Keywords</label>
{% for keyword in keywords %}
{% if "valueURI" in keyword %}
{% if "valueUri" in keyword %}
<span class="keyword" property="dc:subject">
<a href="{{keyword.valueURI}}">{{ keyword.Subject }}</a>
<a href="{{keyword.valueUri}}">{{ keyword.subject }}</a>
</span>
{% else %}
<span class="keyword" property="dc:subject">{{ keyword.Subject }}</span>
<span class="keyword" property="dc:subject">{{ keyword.subject }}</span>
{% endif %}
{% endfor %}
</div>
Expand Down

0 comments on commit dc9e198

Please sign in to comment.