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

add new block stars #269

Merged
merged 3 commits into from
Aug 20, 2021
Merged

add new block stars #269

merged 3 commits into from
Aug 20, 2021

Conversation

remi-dupre
Copy link
Contributor

Add a new stars block which indicates if the POI is a starred restaurant or hotel and eventually gives its rating.

The format looks like follows:

{
    "type": "stars",
    "ratings": [
        {"has_stars": "yes", "nb_stars": 4.0, "kind": "lodging"}
    ]
}
{
    "type": "stars",
    "ratings": [
        {"has_stars": "yes", "nb_stars": null, "kind": "restaurant"}
    ]
}

@@ -535,3 +535,21 @@ def has_takeaway(self):
for desc in self.data.business_descriptions
for label in desc.values
)

HOTEL_STARS_REGEX = re.compile(r"hôtel (?P<rating>\d) étoiles")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about hotels with just 1 star ?

Suggested change
HOTEL_STARS_REGEX = re.compile(r"hôtel (?P<rating>\d) étoiles")
HOTEL_STARS_REGEX = re.compile(r"hôtel (?P<rating>\d) étoiles?")

Comment on lines +46 to +49
for kind, stars in [
(StarsKind.LODGING, place.get_lodging_stars()),
(StarsKind.RESTAURANT, place.get_restaurant_stars()),
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help with the integration, perhaps we could keep only one of these ratings, depending on place.get_class_name() ?
Then the client could just append the number of stars with the title of the poi class/subclass, without any redundant implementation on both sides, or risk of confusion.

cc @xem @bbecquet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I had in mind is that erdapfel would blindly display all items of the list, but maybe we risk displaying irrelevant data?

Comment on lines 23 to 28
def check_class(self, subclass: Optional[str]) -> bool:
return (self, subclass) in [
(self.LODGING, "lodging"),
(self.RESTAURANT, "restaurant"),
(self.RESTAURANT, "fast_food"),
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subclass should rather be named class_name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just rewrote last commit as this is a very minor change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants