Commit 116dbd3c authored by Danielvdh03's avatar Danielvdh03
Browse files

Updated help menu

parent 9bef9a1b
......@@ -44,23 +44,30 @@ def cleanup_type(text):
return text
# Hardcoded descriptions for when user runs help command
def generate_commands():
commands = ("state_votes", "find_user", "county_results", "group_county_by", "get_tweet_candidate",
"count_tweet_region", "update_poll_count", "update_state_count", "insert_tweet", "annotate_poll", "view_annotations",
"help", "quit")
return commands
def generate_descriptions():
descriptions = (" A filtering query that returns the average from a specific column ",
" A query that removes all data from the database but keeps schema intact",
" A filtering query that count the number of results returned",
" Creates a Table from scratch (if the name is unique)",
" Deletes all records and schema of a Table (if the Table exists)",
" Prints list of all supported commands",
" Inserts a row into an existing Table",
" Prints a list of all Tables in the Database",
" A filtering query that only returns the maximum from the search",
" A filtering query that only returns the minimum from the search",
" Exits the CLI",
" Removes rows from a Table based on criteria",
" Returns all results from an SQL Table",
" Returns the sum of all entries of a specific column",
" Returns all columns and their associated datatypes for a specific Table")
descriptions = ("Enter in a state to view the total number of votes in the 2020 election. Option \"All\" to view votes in descneding order by state",
"Used to find users with high follower counts by county",
"Prints out the final voting standings by party in a specific county",
"Ranks counties in a given state or across the nation in a specific category (ex. Covid Cases, Income)",
"Displays all tweets about a particular candidate above a certain like threshold",
"Displays the total amount of tweets about the election by region within a specific date range about a candidate",
"Updates the final vote count for a party. Used to update vote counts for parties as votes are being processed",
"Updates the total number of votes by state. Used to update voting data as votes are being processed",
"Inserts new tweet to the database by a specific user",
"Used to create/edit annotations about a specific party in a specific county's election result",
"View created annotations about a specific party in a county",
"Prints out list of available commands and their optoins",
"Closes the CLI"
)
return descriptions
......@@ -71,7 +78,7 @@ class Database:
def __init__(self):
self.command_list = ("average", "clear", "count", "create", "delete", "help", "insert", "list", "max", "min", "quit", "remove", "search_all", "sum", "view_column") # List of available user commands
self.command_list = generate_commands()
self.command_description = generate_descriptions() # List of user command descriptions
self.state_id = self.setup_stateid_table()
......@@ -414,8 +421,7 @@ class Database:
print("{0}. County : {1}, State : {2}, {3} : {4}".format(counter, result[0], state_name, old_choice, result[1]))
counter += 1
#TODO Match Candidate_name to hashtag
#TODO : Add Date filtering
def get_tweet_candidate(self):
candidate_name = input("Enter the candidate name (Joe Biden/ Donald Trump) : ")
......@@ -524,7 +530,7 @@ class Database:
date = input("Enter the date that this tweet was created as YYYY-MM-DD : ")
date = date.strip()
id = 1 + self.get_count(tweet)
id = self.get_id(username)
user_id = self.get_user_id()
......@@ -539,6 +545,12 @@ class Database:
return self.execute_query(query)
def annotate_poll(self):
pass
def view_annotations(self):
pass
if __name__ == "__main__":
......@@ -617,6 +629,14 @@ if __name__ == "__main__":
elif command == "insert_tweet":
client.insert_tweet()
elif command == "annotate_poll":
client.annotate_poll()
elif command == "view_annotation_poll":
client.view_annotations()
else:
print("Invalid command, please enter a valid command!")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment