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

Commit

Permalink
Add accumulation_dates
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Jan 17, 2024
1 parent 6c0110c commit 17ad813
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
24 changes: 12 additions & 12 deletions app/records/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ async def external(
return results


@router.get("/external/filters/")
async def external_filters() -> list[Filter]:
filters = []
return filters
# @router.get("/external/filters/")
# async def external_filters() -> list[Filter]:
# filters = []
# return filters


@router.get("/creators/")
Expand All @@ -91,10 +91,10 @@ async def creators(
return results


@router.get("/creators/filters/")
async def creators_filters() -> list[Filter]:
filters = []
return filters
# @router.get("/creators/filters/")
# async def creators_filters() -> list[Filter]:
# filters = []
# return filters


@router.get("/archives/")
Expand All @@ -110,10 +110,10 @@ async def archives(
return results


@router.get("/archives/filters/")
async def archives_filters() -> list[Filter]:
filters = []
return filters
# @router.get("/archives/filters/")
# async def archives_filters() -> list[Filter]:
# filters = []
# return filters


@router.get("/{id}/")
Expand Down
1 change: 1 addition & 0 deletions app/records/schemas/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class RecordArchive(Details):
appointment: str = ""
contact_info: dict = {}
places: list[str] = []
accumulation_dates: list[str] = []
agents: dict = {}
manifestations: list[dict] = []

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 @@ -116,6 +116,7 @@ def parse_results(self, raw_results, source_url):
record.contact_info = parsed_data.contact_info()
record.agents = parsed_data.agents()
record.manifestations = parsed_data.manifestations()
record.accumulation_dates = parsed_data.accumulation_dates()
record.source_url = source_url
return record.toJSON()
if parsed_data.type() == "agent":
Expand Down
13 changes: 13 additions & 0 deletions app/sources/rosetta/lib/response_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,19 @@ def languages(self) -> list[str]:
]
return []

def accumulation_dates(self) -> list[str]:
if "accruals" in self.source:
if (
"date" in self.source["accruals"]
and "value" in self.source["accruals"]["date"]
):
document = PyQuery(self.source["accruals"]["date"]["value"])
spans = document("span.accessionyears").find(
"span.accessionyear"
)
return [span.text for span in spans if span.text is not None]
return []

def manifestations(self) -> list[dict]:
if "manifestations" in self.source:
return sorted(
Expand Down

0 comments on commit 17ad813

Please sign in to comment.