diff --git a/app/records/schemas/details.py b/app/records/schemas/details.py index 73327c0..6807762 100644 --- a/app/records/schemas/details.py +++ b/app/records/schemas/details.py @@ -24,6 +24,7 @@ class Record(Details): held_by: dict | None = None legal_status: str | None = None closure_status: str | None = None + access_condition: str | None = None languages: list[str] | None = None def __init__(self, id: str): diff --git a/app/sources/rosetta/api.py b/app/sources/rosetta/api.py index 80f483f..97f4361 100644 --- a/app/sources/rosetta/api.py +++ b/app/sources/rosetta/api.py @@ -95,6 +95,7 @@ def parse_results(self, raw_results): record.legal_status = parsed_data.legal_status() record.closure_status = parsed_data.closure_status() record.languages = parsed_data.languages() + record.access_condition = parsed_data.access_condition() return record.toJSON() if ( parsed_data.type() == "archive" diff --git a/app/sources/rosetta/lib/response_parser.py b/app/sources/rosetta/lib/response_parser.py index bf9a257..182cc25 100644 --- a/app/sources/rosetta/lib/response_parser.py +++ b/app/sources/rosetta/lib/response_parser.py @@ -505,6 +505,16 @@ def closure_status(self) -> str: else "" ) + def access_condition(self) -> str: + return ( + self.source["availability"]["access"]["condition"]["value"] + if "availability" in self.source + and "access" in self.source["availability"] + and "condition" in self.source["availability"]["access"] + and "value" in self.source["availability"]["access"]["condition"] + else "" + ) + def languages(self) -> list[str]: if "language" in self.source: return [