Skip to content

Commit

Permalink
Merge pull request #537 from OP-TED/feature/TED4-161
Browse files Browse the repository at this point in the history
updated work_title display in package exported mets_dmd file
  • Loading branch information
Dragos0000 authored Apr 29, 2024
2 parents 1647398 + af6ddf1 commit 0115684
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<cdm:work_created_by_agent rdf:resource="&cellar-authority;corporate-body/{{ work.created_by_agent }}"/>
<cdm:procurement_public_number_document_in_official-journal rdf:datatype="http://www.w3.org/2001/XMLSchema#string">{{ notice.public_number_document }}</cdm:procurement_public_number_document_in_official-journal>
<cdm:procurement_public_number_edition rdf:datatype="http://www.w3.org/2001/XMLSchema#positiveInteger">{{ notice.public_number_edition }}</cdm:procurement_public_number_edition>
{% for lang in mets.languages %}
{% for lang in work.title %}
<cdm:work_title xml:lang="{{ lang }}">{{ work.title[lang] }}</cdm:work_title>
{% endfor %}
<cdm:datetime_transmission rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">{{ work.datetime_transmission }}</cdm:datetime_transmission>
Expand All @@ -43,7 +43,7 @@
{# <rdf:type rdf:resource="http://publications.europa.eu/ontology/cdm#expression"/> #}
<rdf:type rdf:resource="http://publications.europa.eu/ontology/cdm#expression_procurement_public"/>
<cdm:expression_belongs_to_work rdf:resource="&resource;ted/{{ work.identifier }}"/>
{% for lang in mets.languages %}
{% for lang in expression.title %}
<cdm:expression_title xml:lang="{{ lang }}">{{ expression.title[lang] }}</cdm:expression_title>
{% endfor %}
<cdm:expression_uses_language rdf:resource="&cellar-authority;language/{{ expression.uses_language }}"/>
Expand Down
7 changes: 3 additions & 4 deletions ted_sws/notice_packager/services/metadata_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ def from_notice_metadata(cls, notice_metadata: NormalisedMetadata) -> PackagerMe
metadata.work.resource_type = PROCUREMENT_NOTICE
metadata.work.date_document = publication_date
metadata.work.uri = publication_notice_uri(metadata.notice.id, notice_metadata)
# TODO: If no title found in english get a random one
title_search = [title.text for title in notice_metadata.title if title.language == LANGUAGE.upper()]
if len(title_search) > 0:
metadata.work.title = {LANGUAGE: title_search[0]}
metadata.work.title = {}
if notice_metadata.title:
metadata.work.title = {title[1]: title[0] for title in notice_metadata.title}
metadata.work.dataset_version = _date.strftime('%Y%m%d') + '-' + _revision
metadata.work.procurement_public_issued_by_country = notice_metadata.country_of_buyer
# metadata.work.procurement_public_url_etendering = notice_metadata.uri_list
Expand Down
3 changes: 2 additions & 1 deletion tests/test_data/notice_packager/template_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"dataset_published_by_agent": "EURUN",
"datetime_transmission": "2023-03-09T18:28:54.806241",
"title": {
"en": "Construction work"
"en": "Construction work",
"ro": "Lucrari de constructie"
},
"date_creation": "2023-03-09",
"concept_type_dataset": "TEST_DATA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<cdm:procurement_public_number_edition rdf:datatype="http://www.w3.org/2001/XMLSchema#positiveInteger">2021004</cdm:procurement_public_number_edition>

<cdm:work_title xml:lang="en">Construction work</cdm:work_title>

<cdm:work_title xml:lang="ro">Lucrari de constructie</cdm:work_title>

<cdm:datetime_transmission rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2023-03-09T18:28:54.806241</cdm:datetime_transmission>

Expand Down
1 change: 0 additions & 1 deletion tests/unit/notice_packager/test_template_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Email: kalean.bl@gmail.com

""" """
import difflib
import re

import pytest
Expand Down

0 comments on commit 0115684

Please sign in to comment.