The purpose of this phase of the project is to add a series of features to make the program we wrote in the previous phase smarter. To implement these features, we will use the data generated by the program itself.
In the previous phase, we implemented filters for the utrip program. Like filtering the average cost of rooms. But there is a point in user behavior that allows us to use this filter to make the list of hotels that we show to users more useful and concise. The fact is that the income of a person and therefore the price of the rooms he reserves do not change much in a short period of time. As a result, we can eliminate hotels that their prices are very different from the user's booking history by adding a default filter to room prices.
But when will this default filter be active? When the following three conditions are met:
- When the user himself has no filter on prices
- The user must have at least 10 booking records
- This filter has not turned off by the user
User can activate/deactivate default filter using following command:
POST default_price_filter ? active true|false
Also, if this filter is enabled (all 3 conditions are met), the following statement should be written in the top line of the results whenever the user calls the GET hotels
command:
* Results have been filtered by the default price filter.
Another thing we need to do is to add the rating_personal
attribute to the list of attributes that the POST sort
command can take. When this attribute is used for sorting, hotels should be sorted according to a user's personal score to that hotel, which is calculated as follows:
- If the person has already rated the hotel, the personal rating is the same as the rating_overall that the user has given to the hotel.
- Else if manual weights are enabled, the personal rating is the weighted average of the hotel scores in the various categories using the manual weights.
- Otherwise, if the user has rated at least 5 hotels, we have to estimate the weights and then use them to calculate the weighted average. If the user has rated less than 5 hotels,
Insufficient Ratings
is printed.
- Sorting:
POST sort ? property <property> order ascending|descending
- Weighted Average of Ratings:
- Add weights:
POST manual_weights ? active true location <location> cleanliness <cleanliness> staff <staff> facilities <facilities> value_for_money <value_for_money>
- Delete weights:
POST manual_weights ? active false
- Get weights:
GET manual_weights
- Get estimated weights:
GET estimated_weights
- output:
location <location> cleanliness <cleanliness> staff <staff> facilities <facilities> value_for_money <value_for_money> | Permission Denied | Insufficient Ratings