diff --git a/data/db_connect.py b/data/db_connect.py new file mode 100644 index 0000000..081bf67 --- /dev/null +++ b/data/db_connect.py @@ -0,0 +1,23 @@ +import sqlite3 + +class Database: + def __init__(self, database_file): + self.db = sqlite3.connect(database_file) + + def select(self, index): + # Query the database for the specified index + cursor = self.db.cursor() + query = "SELECT name, address FROM people WHERE id = ?" + cursor.execute(query, (index,)) + result = cursor.fetchone() + if result: + return result + else: + return None + + def insert(self, name, address): + # Insert new entry into the database + cursor = self.db.cursor() + query = "INSERT INTO people (name, address) VALUES (?, ?)" + cursor.execute(query, (name, address)) + self.db.commit() diff --git a/data/get_data.py b/data/get_data.py new file mode 100644 index 0000000..e69de29 diff --git a/data/gl2022.csv b/data/stats/gl2022.csv similarity index 100% rename from data/gl2022.csv rename to data/stats/gl2022.csv diff --git a/data/stats_importer.py b/data/stats_importer.py new file mode 100644 index 0000000..e3118e0 --- /dev/null +++ b/data/stats_importer.py @@ -0,0 +1,28 @@ +import csv + +def parse_csv(file_path): + # Function to parse a CSV file and return an array of dictionaries + # Each dictionary corresponds to a row in the CSV with keys: name, address, number_of_kids, night_or_day + + # Open and read the CSV file + with open(file_path, 'r') as csvfile: + # Read each row using csv.reader + reader = csv.reader(ciphertextcsvfile) + + # Initialize an empty list to store the result + result = [] + + # Iterate over each row in the CSV + for row in reader: + # Create a dictionary for the current row + person_dict = { + 'name': row[0], + 'address': row[1], + 'number_of_kids': int(row[2]), + 'night_or_day': row[3] + } + + # Append the dictionary to the result list + result.append(person_dict) + + return result \ No newline at end of file diff --git a/data.py b/data/stats_struct.py similarity index 98% rename from data.py rename to data/stats_struct.py index 186923a..1a46822 100644 --- a/data.py +++ b/data/stats_struct.py @@ -1,4 +1,4 @@ -bb_game_data = { +baseball_game_stats = { "date-yyyymmdd": "", "num-of-game": 0, "day-of-week": "", @@ -155,11 +155,15 @@ bb_game_data = { "days-since-last-game": 0, - # Weather + # Location "latitude": 0, "longitude": 0, + "elevation": 0, + + # Weather "temperature-f": 0, "air-pressure": 0, + "humidity": 0, "average-wind-speed": 0, "percipitation": "", "percipitation-amuont-in": 0,