diff --git a/app/records/schemas/details.py b/app/records/schemas/details.py index d25f83e..9bef444 100644 --- a/app/records/schemas/details.py +++ b/app/records/schemas/details.py @@ -21,6 +21,7 @@ class Record(Details): iaid: str | None = None former_ref: str | None = None title: str | None = None + summary_title: str | None = None description: str | None = None date: str | None = None is_digitised: bool | None = None @@ -40,6 +41,7 @@ class Aggregation(Details): ref: str | None = None iaid: str | None = None title: str | None = None + summary_title: str | None = None description: str | None = None physical_description: str | None = None administrative_background: str | None = None diff --git a/app/sources/rosetta/api.py b/app/sources/rosetta/api.py index a1e9f50..bdac17b 100644 --- a/app/sources/rosetta/api.py +++ b/app/sources/rosetta/api.py @@ -92,6 +92,7 @@ def parse_results(self, raw_results, source_url): record.iaid = parsed_data.iaid() record.former_ref = parsed_data.former_identifier() record.title = parsed_data.title() + record.summary_title = parsed_data.summary_title() record.description = parsed_data.description() record.date = parsed_data.date_range() record.is_digitised = parsed_data.is_digitised() @@ -112,6 +113,7 @@ def parse_results(self, raw_results, source_url): record.ref = parsed_data.identifier() record.iaid = parsed_data.iaid() record.title = parsed_data.title() + record.summary_title = parsed_data.summary_title() record.description = parsed_data.description() record.physical_description = parsed_data.physical_description() record.administrative_background = ( diff --git a/app/sources/rosetta/lib/response_parser.py b/app/sources/rosetta/lib/response_parser.py index 6e65563..1bdf728 100644 --- a/app/sources/rosetta/lib/response_parser.py +++ b/app/sources/rosetta/lib/response_parser.py @@ -99,9 +99,19 @@ def is_tna(self) -> bool: return self.is_digitised() or False def title(self) -> str: - if summary_title := self.summary_title(): - return summary_title if "title" in self.source: + if display_title := next( + ( + item["label"]["value"] + for item in self.source["title"] + if "label" in item + and "value" in item["label"] + and "type" in item["label"] + and item["label"]["type"] == "display" + ), + None, + ): + return display_title if title := next( ( item["value"] @@ -113,6 +123,8 @@ def title(self) -> str: return title if name := self.name(): return name + if summary_title := self.summary_title(): + return summary_title if description := self.description(): return description return ""