SnapTrip

所属分类:数据库系统
开发工具:C++
文件大小:0KB
下载次数:0
上传日期:2020-07-10 14:43:34
上 传 者sh-1993
说明:  SnapTrip,德黑兰大学高级编程课程的最后一个项目
(SnapTrip, the final project of the Advanced Programming course at the University of Tehran)

文件列表:
API/ (0, 2020-07-10)
API/API.cpp (1106, 2020-07-10)
API/API.hpp (645, 2020-07-10)
API/Result/ (0, 2020-07-10)
API/Result/Result.cpp (9431, 2020-07-10)
API/Result/Result.hpp (1857, 2020-07-10)
Business-Logic/ (0, 2020-07-10)
Business-Logic/AI/ (0, 2020-07-10)
Business-Logic/AI/AI.cpp (3442, 2020-07-10)
Business-Logic/AI/AI.hpp (951, 2020-07-10)
Business-Logic/Backend.cpp (29733, 2020-07-10)
Business-Logic/Backend.hpp (5000, 2020-07-10)
ConstNames.hpp (6601, 2020-07-10)
Exception/ (0, 2020-07-10)
Exception/Exception.cpp (201, 2020-07-10)
Exception/Exception.hpp (276, 2020-07-10)
Makefile (7245, 2020-07-10)
Models/ (0, 2020-07-10)
Models/Comment.cpp (377, 2020-07-10)
Models/Comment.hpp (356, 2020-07-10)
Models/Database.cpp (5496, 2020-07-10)
Models/Database.hpp (2896, 2020-07-10)
Models/Filters/ (0, 2020-07-10)
Models/Filters/AdvancedFilter.cpp (836, 2020-07-10)
Models/Filters/AdvancedFilter.hpp (445, 2020-07-10)
Models/Filters/AvgPriceFilter.cpp (767, 2020-07-10)
Models/Filters/AvgPriceFilter.hpp (390, 2020-07-10)
Models/Filters/CityFilter.cpp (567, 2020-07-10)
Models/Filters/CityFilter.hpp (322, 2020-07-10)
Models/Filters/DefaultAvgPriceFilter.cpp (1928, 2020-07-10)
Models/Filters/DefaultAvgPriceFilter.hpp (615, 2020-07-10)
Models/Filters/Filter.cpp (583, 2020-07-10)
Models/Filters/Filter.hpp (501, 2020-07-10)
Models/Filters/StarRangeFilter.cpp (760, 2020-07-10)
Models/Filters/StarRangeFilter.hpp (378, 2020-07-10)
Models/Hotel.cpp (11603, 2020-07-10)
Models/Hotel.hpp (3087, 2020-07-10)
Models/Rating.cpp (827, 2020-07-10)
Models/Rating.hpp (530, 2020-07-10)
Models/Rooms/ (0, 2020-07-10)
... ...

# SnapTrip SnapTrip is the final project of an Advanced Programming course at the University of Tehran. In the first two steps, my focus is on the proper implementation of the Database, creating the right APIs, and setting up Artificial Intelligence to increase the efficiency and performance of the program to achieve the best results. ## Layers > User-Interface > API >> Result > Business-Logic >> Artificial Intelligence > Persistence-Layer(ORM) > Models >> Database >>> User >>>> Filters, >>>> ReservationCase >>> Comment >>> Hotel >>>> Room ## User-Interface It is the part that you can see what SnapTrip does and you don't have to worry about what happens in the backend, but in this phase of SnapTrip (phase 1), the User-Interface doesn't have a big role in the game and as I mentioned before, in this phase we want to implement a good API and make sure the Backend part does everything right. You can use the orders in the [Commands](https://github.com/mahdibohloul/SnapTrip/blob/master/#commands) part in the terminal to see the application of SnapTrip. ## API **API** is the connection between the **User-Interface**, **ORM** and **Backend**. The **API** receives the entered commands and transfers them to the **Business-Logic** layer. After all the steps, it takes the results and stores them in the [Result](https://github.com/mahdibohloul/SnapTrip/blob/master/#result-class) class, which I'll talk about later. Why did I consider the **API** layer for my project? The answer is that on **SnapTrip**, we may have a lot of clients or want to run **SnapTrip** in different environments. We can't plan for all different environments, so the **API** takes the raw output information and the [Result](https://github.com/mahdibohloul/SnapTrip/blob/master/#result-class) class gets the result to provide the information depending on our environment. ### Result-Class The **Result** class is in the **API** layer, and after all the steps in the **Business-Logic** layer and the **ORM** layer, the **API** calls the class to take the result and prepare them for the interface. ## Business-Logic This **SnapTrip** engine and all the logic and program steps and all the functions work in this section. Each command is sent to this layer via the **API**, and here, the command is analyzed, and if there is an error in it, *Exceptions* are returned, otherwise, the commands are transferred to the next layer, **ORM**. To make SnapTrip smarter, we added [AI](https://github.com/mahdibohloul/SnapTrip/blob/master/#artificial-intelligence) to the Business-Logic layer. ### Artificial-Intelligence If you want to see hotels by your rating but don't weigh them manually, SnapTrip estimates your weight! On what basis does SnapTrip do this? First of all, you need to rate at least 5 hotels so that SnapTrip can estimate the right weight. Suppose you give as points to a hotel and as your total points to that hotel. For example: , , We now estimate the level of overall satisfaction as a function of the category scores: And we define the error function as follows: Now our goal is to find all the in such a way that the **error function** becomes zero for all the values of *j*. ## ORM **ORM** stands for **Object Relational Mapping** and is responsible for creating *relational models* and *tables* using input information. **ORM** is in direct contact with *database*, which means that if any part of the program wants to do something with the data, it must transfer the data via **ORM**. ## Commands ###### *the order of the commands-order doesn't matter* - Make executable file ```bash make ``` - Run the SnapTrip with init data ```bash ./utrip assets/hotels.csv assets/ratings.csv ``` - Signup ```bash POST signup ? username email password ``` - Login ```bash POST login ? email password ``` - Logout ```bash POST logout ``` - Increase your credit ```bash POST wallet ? amount ``` - See your _count_ account turnover ```bash GET wallet ? count ``` - See all of the hotels. if you add some filters, first applies the filters and then shows you the filtered hotels ```bash GET hotels ``` - Enter a hotel id and see the hotel's informations ```bash GET hotels ? id ``` - Add Filter - This filter only shows hotels in the city specified in the command ```bash POST filters ? city ``` - This filter only approved hotels whose stars are specified in the range (in the interval [min, max]) - at least: 1 and at most: 5 ```bash POST filters ? min_star max_star ``` - This filter only approved hotels whose average price are specified in the range - in the interval [min, max] ```bash POST filters ? min_price max_price ``` - This filter only approved hotels whose have specific rooms in the specified range - room type are: standard, deluxe, luxury, premium - in the interval [min, max] - check_in at least: 1 night, check_out at most: 30 night ```bash POST filters ? type qunatity check_in check_out ``` - Delete all Filters ```bash DELETE filters ``` - Book up rooms in the specified hotel ```bash POST reserves ? hotel type quantity check_in check_out ``` - View the information on your bookings ```bash GET reserves ``` - Cancel a reservation, Just enter the reservation id ```bash DELETE reserves ? id ``` - Enter a hotel's id and post a comment for that hotel ```bash POST comments ? hotel comment ``` - Hotels can be graded in 6 ways - location, cleanliness, staff, facilities, value_for_money, overall_rating - Points must be a number from 1 to 5 - If a user points to a hotel twice, new points will be replaced ```bash POST ratings ? hotel location cleanliness staff facilities value_for_money overall_rating ``` - View the comments on a hotel, just enter hotel id - The first comment is the newest comment ```bash GET comments ? hotel ``` - View the average score of a hotel ```bash GET ratings ? hotel ``` - We now have a default price filter for filtering hotels under certain conditions. - If the user has not set any average price filter - If the user has 10 or more reservations. - If this filter is not disabled by the user. ```bash POST default_price_filter ? active ``` - With the following command, you can arrange hotels ascending or descending based on the following features. - property: id, name, star_rating, city, standard_room_price, deluxe_room_price, luxury_room_price, premium_room_price, average_room_price, rating_personal. ```bash POST sort ? property order ``` - With the following commands, you can set manual weights to sort hotels ```bash POST manual_weights ? active true location cleanliness staff facilities value_for_money ``` ```bash POST manual_weights ? active false ``` - With the following command, you can see manual weights ```bash GET manual_weights ``` - With the following command, you can see estimated weights ```bash GET estimated_weights ```

近期下载者

相关文件


收藏者