Filtering

We allow users to filter on the following things:

For Restaurants:

  • Only show restaurants with at least a certain rating (on a scale form 1-5)
  • Only show restaurants that have one of the provided categories
  • Only show restaurants that are currently open
  • Only show restaurants that are in one of provided zip codes

For Attractions:

  • Only show attractions with at least a certain rating (on a scale form 1-5)
  • Only show attractions that have one of the provided categories
  • Only show restaurants that are in one of provided zip codes

For Hotels:

  • Only show hotels with at least a certain rating (on a scale form 1-5)
  • Only show hotels that have one of the provided categories
  • Only show hotels that are in one of provided zip codes

Technical details

We implemented all the filtering on the back-end side.

We filtered data using the sqlalchemy query.filter and query.filter_by methods. For the restaurant open_now filter we compare the current time with our stored open_hour string for each restaurant using a function called isOpen(hours: string, time: iterable) and form a list of open restaurants. Then we filter our current query by restaurants that are in that list.

The front-end is merely responsibility for making API requests and displaying the data it gets back.

To apply filter(s), simply append parameters to the API request. For example, to filter on restaurants with a zipcode of 78704 that have a rating of at least 4/5, use the following API request.

api.tacoboutaustin.me/restaurants?zipcode=78704&rating=4

See our API documentation for more information.

results matching ""

    No results matching ""