diff --git a/app/__init__.py b/app/__init__.py index 80c50da..e21c67b 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -4,7 +4,7 @@ def create_app(): config = Config() - app = FastAPI(log_level=config.LOG_LEVEL) + app = FastAPI(title="ETNA Search API", log_level=config.LOG_LEVEL) base_uri = "/api/v1" @app.get("/healthcheck/live/", include_in_schema=False) diff --git a/app/records/schemas/details.py b/app/records/schemas/details.py index f6d6e44..8cb17b5 100644 --- a/app/records/schemas/details.py +++ b/app/records/schemas/details.py @@ -61,9 +61,11 @@ class RecordArchive(Details): type: str = "archive" name: str = "" archon: str = "" - opening_hours: str = "" + opening_times: str = "" disabled_access: str = "" - place_information: str = "" + information: str = "" + fee: str = "" + appointment: str = "" contact_info: dict = {} places: list[str] = [] agents: dict = {} diff --git a/app/sources/rosetta/api.py b/app/sources/rosetta/api.py index ae5f7e0..ec3d5d5 100644 --- a/app/sources/rosetta/api.py +++ b/app/sources/rosetta/api.py @@ -107,9 +107,11 @@ def parse_results(self, raw_results, source_url): record = RecordArchive(parsed_data.id()) record.name = parsed_data.title() record.archon = parsed_data.reference_number() - record.opening_hours = parsed_data.opening_hours() - record.disabled_access = parsed_data.disabled_access() - record.place_information = parsed_data.place_comments() + record.opening_times = parsed_data.place_opening_times() + record.disabled_access = parsed_data.place_disabled_access() + record.information = parsed_data.place_comments() + record.fee = parsed_data.place_fee() + record.appointment = parsed_data.place_appointment() record.places = parsed_data.places() record.contact_info = parsed_data.contact_info() record.agents = parsed_data.agents() diff --git a/app/sources/rosetta/lib/response_parser.py b/app/sources/rosetta/lib/response_parser.py index f032e45..357bd2a 100644 --- a/app/sources/rosetta/lib/response_parser.py +++ b/app/sources/rosetta/lib/response_parser.py @@ -237,18 +237,18 @@ def place_descriptions(self) -> list[str]: and "label" in place["description"] and "value" in place["description"]["label"] ] - return [] + return "" - def opening_hours(self): + def place_opening_times(self) -> str: if "place" in self.source: for place in self.source["place"]: if "description" in place and "value" in place["description"]: document = PyQuery(place["description"]["value"]) - if opening_hours := document("span.openinghours").text(): - return opening_hours - return [] + if opening_times := document("span.openinghours").text(): + return opening_times + return "" - def disabled_access(self): + def place_disabled_access(self) -> str: if "place" in self.source: for place in self.source["place"]: if "description" in place and "value" in place["description"]: @@ -257,15 +257,33 @@ def disabled_access(self): "span.disabledaccess" ).text(): return disabled_access - return [] + return "" - def place_comments(self): + def place_comments(self) -> str: if "place" in self.source: for place in self.source["place"]: if "description" in place and "value" in place["description"]: document = PyQuery(place["description"]["value"]) if comments := document("span.comments").text(): return comments + return "" + + def place_fee(self) -> str: + if "place" in self.source: + for place in self.source["place"]: + if "description" in place and "value" in place["description"]: + document = PyQuery(place["description"]["value"]) + if fee := document("span.fee").text(): + return fee + return "" + + def place_appointment(self) -> str: + if "place" in self.source: + for place in self.source["place"]: + if "description" in place and "value" in place["description"]: + document = PyQuery(place["description"]["value"]) + if appointment := document("span.appointment").text(): + return appointment return [] def gender(self) -> str: