diff --git a/app/records/routes.py b/app/records/routes.py index fa5525f..1936009 100644 --- a/app/records/routes.py +++ b/app/records/routes.py @@ -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/") @@ -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/") @@ -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}/") diff --git a/app/records/schemas/details.py b/app/records/schemas/details.py index 8cb17b5..ec59490 100644 --- a/app/records/schemas/details.py +++ b/app/records/schemas/details.py @@ -68,6 +68,7 @@ class RecordArchive(Details): appointment: str = "" contact_info: dict = {} places: list[str] = [] + accumulation_dates: list[str] = [] agents: dict = {} manifestations: list[dict] = [] diff --git a/app/sources/rosetta/api.py b/app/sources/rosetta/api.py index ec3d5d5..6c18948 100644 --- a/app/sources/rosetta/api.py +++ b/app/sources/rosetta/api.py @@ -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": diff --git a/app/sources/rosetta/lib/response_parser.py b/app/sources/rosetta/lib/response_parser.py index 357bd2a..bca95d6 100644 --- a/app/sources/rosetta/lib/response_parser.py +++ b/app/sources/rosetta/lib/response_parser.py @@ -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(