From b990ab4e79806c91bc6f70e274f79ab6c3bffc28 Mon Sep 17 00:00:00 2001 From: Eric Hanson Date: Thu, 4 Jan 2024 17:04:37 -0500 Subject: [PATCH] Add get_source_link method to MITAardvark class --- transmogrifier/sources/json/aardvark.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/transmogrifier/sources/json/aardvark.py b/transmogrifier/sources/json/aardvark.py index e14a746..e6b8416 100644 --- a/transmogrifier/sources/json/aardvark.py +++ b/transmogrifier/sources/json/aardvark.py @@ -30,6 +30,28 @@ def get_main_titles(cls, source_record: dict) -> list[str]: """ return [source_record["dct_title_s"]] + @classmethod + def get_source_link( + cls, source_base_url: str, source_record_id: str, source_record: dict[str, JSON] + ) -> str: + """ + Class method to set the source link for the item. + + May be overridden by source subclasses if needed. + + Default behavior is to concatenate the source base URL + source record id. + + Args: + source_base_url: Source base URL. + source_record_id: Record identifier for the source record. + source_record: A BeautifulSoup Tag representing a single XML record. + - not used by default implementation, but could be useful for subclass + overrides + """ + return source_base_url + cls.get_timdex_record_id( + "gismit", source_record_id, source_record + ) + @classmethod def get_timdex_record_id( cls, source: str, source_record_id: str, source_record: dict[str, JSON]