This project simulates a basic Twitter-like functionality using Python and MongoDB. It is divided into two phases:
-
Building the Document Store:
- Takes a JSON file as input and constructs a MongoDB collection.
- Creates a database named
291dbwith a collection of tweets. - Requires the input of a JSON file name and the port number where the MongoDB server is running.
-
Operating the Document Store:
- Connects to the
291dbdatabase. - Provides a menu-driven interface for users to interact with the database.
- Features include:
- Searching for tweets or users.
- Listing top tweets and users based on specific metrics.
- Composing new tweets.
- Exiting the program.
- Connects to the
-
Search for Tweets:
- Input a keyword or multiple keywords to display a list of tweets containing the keywords.
- Select a tweet by user ID to view its detailed information.
- Quit the search by entering
q.
-
Search for Users:
- Input a keyword or multiple keywords to display users whose name contains the keywords.
- Displayed information includes username, display name, and location.
- Select a user by username to view detailed user data.
- Quit the search by entering
q.
-
List Top Tweets:
- Select a field to rank tweets:
1:retweetCount2:likeCount3:quoteCount
- Specify the number of top tweets to display.
- View details such as tweet ID, date, content, username, and the chosen metric.
- Select a field to rank tweets:
-
List Top Users:
- Enter a number
nto display the topnusers based onfollowersCount. - View details of a selected user by username.
- Quit by entering
q.
- Enter a number
-
Compose a Tweet:
- Enter the content of the new tweet.
- Metadata (username:
291user, current date, other fields: zero or null) is automatically added. - Quit by entering
q.
-
Logout:
- Exit the program and return to the command line.
load-json.pycreates the291dbdatabase with atweetscollection.- Drops existing documents and populates the collection with data from the input JSON file.
- Provides a menu for six functionalities:
- Search for tweets.
- Search for users.
- List top tweets.
- List top users.
- Compose a tweet.
- Logout.
- Returns to the main menu after each functionality.
-
Input Bugs:
- Tested various edge cases with capitalized letters, numbers, and special characters.
- Used
tryandexceptclauses for invalid inputs.
-
Formatting Bugs:
- Adjusted output formatting to ensure proper display of information.
-
Function Call Errors:
- Verified function calls return to the correct sub-functions.
-
Variable Bugs:
- Ensured consistent variable usage when integrating different parts of the code.
-
Manipulating Field Values:
- Tested edge cases with extreme values for fields like
followersCount.
- Tested edge cases with extreme values for fields like
-
Khym Nad:
- Responsibilities: Search for users,
load-json.py, documentation, testing. - Time Allocated: 10 hours.
- Responsibilities: Search for users,
-
Akila Edirisinghe:
- Responsibilities: Search for tweets,
load-json.py, testing, documentation. - Time Allocated: 10 hours.
- Responsibilities: Search for tweets,
-
Samuel Chan:
- Responsibilities: List top tweets,
load-json.py, documentation, testing. - Time Allocated: 10 hours.
- Responsibilities: List top tweets,
-
Andrew Zhang:
- Responsibilities: List top users, compose tweet,
load-json.py, documentation, testing. - Time Allocated: 10 hours.
- Responsibilities: List top users, compose tweet,
- Conducted on-campus meetings for collaborative debugging and integration.
- Used a Discord group chat for updates and discussions.
- Python 3.x
- MongoDB server