Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Add access condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Jan 12, 2024
1 parent f442602 commit 6f5b38f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/records/schemas/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions app/sources/rosetta/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions app/sources/rosetta/lib/response_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down

0 comments on commit 6f5b38f

Please sign in to comment.