A command-line food review application built with Python and MongoDB that allows users to register, add foods, rate them, and view reviews.
- User Registration: Register with a username to start using the app
- Food Management: Add and delete food items with category and region information
- Rating System: Rate foods on a scale of 0-10 with written reviews
- Review Management: View and edit your own reviews
- Food Discovery: Browse all registered foods and their reviews
- Top Rankings: View the top 3 highest-rated foods based on average scores
- Python 3.x
- MongoDB database
- Required Python packages:
pymongobson
- Install the required packages:
pip install pymongo-
Set up MongoDB connection:
- Update the
urlvariable in the code with your MongoDB connection string - Example:
url = 'mongodb://localhost:27017/'
- Update the
-
Run the application:
python food_review_app.pyThe application uses three MongoDB collections:
-
users: Stores user information
_id: ObjectId (auto-generated)username: String
-
foods: Stores food information
_id: ObjectId (auto-generated)name: Stringcategory: String (e.g., Chinese, Korean, Street food)region: String (delivery area)
-
ratings: Stores user ratings and reviews
_id: ObjectId (auto-generated)user_id: ObjectId (reference to users collection)food_id: ObjectId (reference to foods collection)score: Float (0-10 scale)comment: String (review text)
Upon running the application, you'll be prompted to:
- Register with a username
- Choose from the menu options:
- View all registered foods
- Add new foods to the database
- Delete existing foods
- Rate and review foods
- Edit your existing reviews
- View reviews for specific foods
- See the top 3 highest-rated foods
- 음식 목록 보기 (View Food List) - Display all registered foods
- 음식 등록하기 (Register Food) - Add a new food item
- 음식 삭제하기 (Delete Food) - Remove a food item
- 음식 별점 남기기 (Rate Food) - Add a rating and review
- 내 리뷰 수정하기 (Edit My Review) - Modify your existing reviews
- 음식 리뷰 보기 (View Food Reviews) - See all reviews for a specific food
- 별점 높은 음식 TOP 3 보기 (View Top 3 Foods) - Display highest-rated foods
- 종료하기 (Exit) - Close the application
register_user(): User registration systemshow_foods(): Display all foods with their detailsadd_food(): Add new food itemsdelete_food(): Remove food items from databaserate_food(): Submit ratings and reviewsupdate_rating(): Edit existing reviewsshow_food_reviews(): Display reviews for specific foodsshow_best_foods(): Show top-rated foods using MongoDB aggregation
- Uses MongoDB aggregation pipeline for calculating average ratings
- ObjectId handling for proper database relationships
- Input validation and user-friendly error messages
- Korean language interface
Before running the application, make sure to:
- Set up your MongoDB connection string in the
urlvariable - Ensure MongoDB is running and accessible
- Install all required dependencies
This project is open source and available under the MIT License.