From 994bdf34f8cf849b206839879c5686f4658de0b8 Mon Sep 17 00:00:00 2001 From: Graham Hukill Date: Wed, 7 Feb 2024 10:14:58 -0500 Subject: [PATCH] Set single URL for part of dct_references_s Why these changes are being introduced: It was discovered that the Aardvark format expects only a single URL for the dct_references_s key 'http://schema.org/url', where previously we had set this as a list of URLs like 'http://schemal.org/downloadUrl'. This also updates the hostname for where this URL points back to 'geodata.libraries.mit.edu' which is the anticipated TIMDEX UI for geo resources. How this addresses that need: * Sets single URL for 'http://schema.org/url' * Updates domain name Side effects of this change: * Requires an associated PR in Transmogirifer to expect a single value and not an array; forthcoming Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/GDT-68 --- harvester/records/record.py | 15 +++++---------- tests/test_records/test_record.py | 10 +++------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/harvester/records/record.py b/harvester/records/record.py index ad87aae..f222210 100644 --- a/harvester/records/record.py +++ b/harvester/records/record.py @@ -424,18 +424,13 @@ def _dct_references_s_mit(self) -> dict: "url": f"{cdn_root}/{cdn_folder}/{self.identifier}.zip", }, ] - website_urls = [ - { - "label": "Website", - "url": ( - "https://search.libraries.mit.edu/record/" - f"gismit:{self.identifier.removeprefix('mit:')}" - ), - } - ] + website_url = ( + "https://geodata.libraries.mit.edu/record/" + f"gismit:{self.identifier.removeprefix('mit:')}" + ) return { "http://schema.org/downloadUrl": download_urls, - "http://schema.org/url": website_urls, + "http://schema.org/url": website_url, } def _dct_references_s_ogm(self) -> dict: diff --git a/tests/test_records/test_record.py b/tests/test_records/test_record.py index ce7f19f..c8c1679 100644 --- a/tests/test_records/test_record.py +++ b/tests/test_records/test_record.py @@ -175,13 +175,9 @@ def test_record_shared_field_method_dct_references_s_success( "/SDE_DATA_AE_A8GNS_2003.zip", }, ], - "http://schema.org/url": [ - { - "label": "Website", - "url": "https://search.libraries.mit.edu/record/" - "gismit:SDE_DATA_AE_A8GNS_2003", - }, - ], + "http://schema.org/url": ( + "https://geodata.libraries.mit.edu/record/gismit:SDE_DATA_AE_A8GNS_2003" + ), } assert fgdc_source_record_from_zip._dct_references_s() == json.dumps(references)