Public Member Functions | |
initialize_csv (cls) | |
add_entry (cls, date, amount, category, description) | |
write_to_logs (cls, index_of_file, entry, update_type_index) | |
write_to_csv (cls, data_frame) | |
get_transactions (cls, start_date, end_date) | |
net_amount (cls, df) | |
verify_transaction_id (cls, transaction_id) | |
update_transactions (cls, transaction_id, update_field, new_value) | |
get_current_time (cls) | |
delete_transaction (cls, transaction_id) | |
updates_type (cls, index_of_modification) | |
update_new_entry_log (cls, timestamp, transaction_id, update_type, success, message) | |
update_delete_log (cls, timestamp, transaction_id, update_type, message, success, del_record_date, del_record_category, del_record_amount, del_record_description) | |
update_update_log (cls, timestamp, transaction_id, update_type, field_update, success, old_value, new_value) | |
view_records (cls, index) | |
expense_income_report (cls, report_type) | |
which_update_field (cls, field_index) | |
Static Public Attributes | |
list | CSV_FILES_DICT |
list | MODIFICATIONS = ["updated", "deleted", "new entry"] |
str | FORMAT = "%m-%d-%Y" |
list | UPDATE_FIELD_CHOICES = ["date", "category", "amount", "description"] |
Manages CSV files related to financial transactions and logs various updates. Attributes: CSV_FILES_DICT (list of dict): Configuration of CSV files with their names, paths, and columns. MODIFICATIONS (list of str): Types of modifications that can be logged. FORMAT (str): Date format used for date columns. UPDATE_FIELD_CHOICES (list of str): Fields that can be updated in transactions.
csv_manager.CSVManager.add_entry | ( | cls, | |
date, | |||
amount, | |||
category, | |||
description ) |
Adds a new transaction entry to the transaction records CSV file. Args: date (str): The date of the transaction. amount (float): The amount of the transaction. category (str): The category of the transaction. description (str): A description of the transaction. Returns: None
csv_manager.CSVManager.delete_transaction | ( | cls, | |
transaction_id ) |
Deletes a transaction record based on the provided transaction ID. Args: transaction_id (int): The transaction ID of the record to delete. Returns: None
csv_manager.CSVManager.expense_income_report | ( | cls, | |
report_type ) |
Generates a report of expenses or income, grouped by description and ordered by amount. Args: report_type (str): The type of report to generate ("Expense" or "Income"). Returns: None
csv_manager.CSVManager.get_current_time | ( | cls | ) |
Retrieves the current time formatted according to the class date format. Returns: str: The current time as a formatted string.
csv_manager.CSVManager.get_transactions | ( | cls, | |
start_date, | |||
end_date ) |
Retrieves transactions within a specified date range. Args: start_date (str): The start date of the range. end_date (str): The end date of the range. Returns: pd.DataFrame: DataFrame containing transactions within the date range.
csv_manager.CSVManager.initialize_csv | ( | cls | ) |
Initializes CSV files if they do not already exist by creating empty files with the appropriate columns. Returns: None
csv_manager.CSVManager.net_amount | ( | cls, | |
df ) |
Prints a summary of financial transactions, including the number of entries, average income and expense, total income, total expense, and net savings. Args: df (pd.DataFrame): DataFrame containing transaction data. Returns: None
csv_manager.CSVManager.update_delete_log | ( | cls, | |
timestamp, | |||
transaction_id, | |||
update_type, | |||
message, | |||
success, | |||
del_record_date, | |||
del_record_category, | |||
del_record_amount, | |||
del_record_description ) |
Logs the deletion of a transaction to the deleted log records CSV file. Args: timestamp (str): The timestamp of the log entry. transaction_id (int): The transaction ID associated with the log entry. update_type (str): The type of update (e.g., "Deleted"). message (str): A message regarding the log entry. success (bool): Indicates whether the operation was successful. del_record_date (str): The date of the deleted record. del_record_category (str): The category of the deleted record. del_record_amount (float): The amount of the deleted record. del_record_description (str): The description of the deleted record. Returns: None
csv_manager.CSVManager.update_new_entry_log | ( | cls, | |
timestamp, | |||
transaction_id, | |||
update_type, | |||
success, | |||
message ) |
Logs the addition of a new entry to the new entry log records CSV file. Args: timestamp (str): The timestamp of the log entry. transaction_id (int): The transaction ID associated with the log entry. update_type (str): The type of update (e.g., "New Entry"). success (bool): Indicates whether the operation was successful. message (str): A message regarding the log entry. Returns: None
csv_manager.CSVManager.update_transactions | ( | cls, | |
transaction_id, | |||
update_field, | |||
new_value ) |
Updates a specific field of a transaction record with a new value. Args: transaction_id (int): The transaction ID of the record to update. update_field (str): The field to be updated. new_value (str or float): The new value to set for the field. Returns: None
csv_manager.CSVManager.update_update_log | ( | cls, | |
timestamp, | |||
transaction_id, | |||
update_type, | |||
field_update, | |||
success, | |||
old_value, | |||
new_value ) |
Logs the update of a transaction field to the update log records CSV file. Args: timestamp (str): The timestamp of the log entry. transaction_id (int): The transaction ID associated with the log entry. update_type (str): The type of update (e.g., "Updated"). field_update (str): The field that was updated. success (bool): Indicates whether the operation was successful. old_value (str or float): The old value of the updated field. new_value (str or float): The new value of the updated field. Returns: None
csv_manager.CSVManager.updates_type | ( | cls, | |
index_of_modification ) |
Prints the update type and the current time. Args: index_of_modification (int): Index of the modification type in MODIFICATIONS. Returns: None
csv_manager.CSVManager.verify_transaction_id | ( | cls, | |
transaction_id ) |
Verifies if a given transaction ID exists in the transaction records. Args: transaction_id (int): The transaction ID to be verified. Returns: bool: True if the transaction ID is found, False otherwise.
csv_manager.CSVManager.view_records | ( | cls, | |
index ) |
Displays records from the specified CSV file. Args: index (int): The index of the CSV file configuration in CSV_FILES_DICT. Returns: None
csv_manager.CSVManager.which_update_field | ( | cls, | |
field_index ) |
Retrieves the field name based on the provided index. Args: field_index (int): The index of the field in UPDATE_FIELD_CHOICES. Returns: str: The name of the field corresponding to the index.
csv_manager.CSVManager.write_to_csv | ( | cls, | |
data_frame ) |
Writes a DataFrame to the transaction records CSV file. Args: data_frame (pd.DataFrame): The DataFrame to be written to CSV. Returns: None
csv_manager.CSVManager.write_to_logs | ( | cls, | |
index_of_file, | |||
entry, | |||
update_type_index ) |
Writes a log entry to the specified log file. Args: index_of_file (int): The index of the CSV_FILES_DICT for the target log file. entry (dict): The log entry to be written. update_type_index (int): Index of the update type in MODIFICATIONS. Returns: None
|
static |
|
static |
|
static |
|
static |