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

Commit

Permalink
Add languages
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Jan 12, 2024
1 parent cf5e937 commit 6b1f593
Show file tree
Hide file tree
Showing 3 changed files with 11 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
languages: list[str] | None = None

def __init__(self, id: str):
super().__init__(id)
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 @@ -94,6 +94,7 @@ def parse_results(self, raw_results):
record.held_by = parsed_data.held_by()
record.legal_status = parsed_data.legal_status()
record.closure_status = parsed_data.closure_status()
record.languages = parsed_data.languages()
return record.toJSON()
if (
parsed_data.type() == "archive"
Expand Down
9 changes: 9 additions & 0 deletions app/sources/rosetta/lib/response_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,3 +493,12 @@ def closure_status(self) -> str:
and "value" in self.source["availability"]["closure"]["label"]
else ""
)

def languages(self) -> list[str]:
if "language" in self.source:
return [
language["value"]
for language in self.source["language"]
if "value" in language
]
return []

0 comments on commit 6b1f593

Please sign in to comment.