Skip to content

TafadzwaMangena/my-finance-tracker

Repository files navigation

My Finance Tracker

Responsive Markdown

The link to My Finance Tracker

My Finance Tracker is a Python terminal project whose primary purpose is to keep record of one's income and expenses.

This is a personal finance tracker that allows users to add income and expenses, manage a budget, and store the data in a Google Spreadsheet for persistence across sessions. It includes input validation for date format, income and expense amounts, and description fields to ensure data accuracy.

By storing financial records in the cloud, users can access and track their budget from anywhere. The program offers a user-friendly interface with options to add income, record expenses, view the current budget, and exit.

This tool is beneficial for organizing finances, promoting better money management, and simplifying expense tracking with real-time budget updates.


User Stories

First Time Visitor Goals:

  • As a new user, I want to add my income with a specific date, so I can keep track of when I received money.
  • As a new user, I want to record my daily expenses with descriptions and amounts, so I can see how I’m spending my money.
  • As a new user, I want to view my total income and expenses, so I can quickly understand how much I’m saving or overspending.

Frequent Visitor Goals:

  • As a returning user, I want to view my previous income and expenses saved in Google Sheets, so I can continue tracking my budget from where I left off.

  • As a returning user, I want to add multiple expenses efficiently without needing to restart the program, so I can easily update my spending.

  • As a returning user, I want to check my current budget regularly to compare my income with my total expenses and stay financially organized.


Instructions and Program Features

  • When the program is loaded:

  • Welcome Message: When the program is loaded, it greets the user with a welcome message.

  • Menu Display: The user is presented with a menu offering four options: Add Income, Add Expenses, Show Current Budget, and Exit.

When the program is loaded

  • When User Chooses "Add Income":

  • The program prompts the user to enter their income amount.

  • The user is then asked to enter the date of the income (with validation to ensure the format is YYYY-MM-DD).

  • The program confirms the income has been added and saves the entry to Google Sheets.

When User Chooses Add Income

The user can manipulate the terminal menu with the arrow keys to choose an option and the enter key to confirm the choice.

  • When User Chooses "Add Expenses":

  • The program enters a loop, prompting the user to input multiple expenses.

  • For each expense, the user enters a description, amount, and date (with validations).

  • The program asks for confirmation of the expense details before adding it.

  • This process repeats until the user types "exit" to stop adding expenses.

When User Chooses Add Expense

  • When User Chooses "Show Current Budget":

  • The program calculates and displays the total income, total expenses, and the remaining savings (income minus expenses).

  • It shows a table of all recorded expenses, including their descriptions, amounts, and dates.

When User Chooses Show Current Budget

  • When User Chooses "Exit":

  • The program saves the current income and expenses to the Google Spreadsheet.

  • It displays a goodbye message and exits the program gracefully.

When User Chooses Exit

  • Future Features:

  • User Login and Authentication.

  • Monthly Budget Goals.

  • Expense Categories and Reporting.

  • Recurring Income and Expenses.

  • Have ability to choose currency from multiple options.


Flowchart

The flowchart represents the logic of the application:

Flow Chat


Technologies Used

Languages:

  • Python 3.8.5: used to anchor the project and direct all application behavior
  • JavaScript: used to provide the start script needed to run the Code Institute mock terminal in the browser
  • HTML used to construct the elements involved in building the mock terminal in the browser

Frameworks/Libraries, Programmes and Tools:

Python modules/packages:

Standard library imports:
  • DateTime - Part of the Python standard library for manipulating dates and times.
Third-party imports:
  • colorama A third-party library that provides cross-platform colored terminal text.
  • tabulate A third-party library for printing tabular data in a readable format.
  • simple_term_menu A third-party library for creating interactive terminal menus.

Other tools:

  • Git was used for the version control of the website.
  • GitHub was used to host the code of the website.
  • GIMP was used to make and resize images for the README file.
  • gitpod was used as the main tool to write and edit code.
  • miro was used to make a flowchart for the README file.
  • formatter.org was used to align code indentation.

Bugs

Solved bugs

  1. The code would break (UnboundLocalError) everytime when the program is first run and "Show Budget" or "Exit" are selected without income being selected.

Solution: I ensured income always has a value even at the beggining of the program (0), If no income is added, income_date should keep its previous value (if it exists).

  1. The income variable was getting assigned as a tuple rather than a float when returning both income and income_date from the add_income function,displaying the error, TypeError: unsupported operand type(s) for -: 'tuple' and 'float'"

Solution: When calling the add_income function, I assigned income separately from income_date ensuring that only income (a floating number) is used for calculations.

if choice == 0:
  income, income_date = add_income()  # Returning both income and date

Unsolved bugs

  • All noticed bugs were fixed.
  • Please report any bugs you might see to TafadzwaMangena

Testing

  • The code was tested using CI Python Linter provided by Code Institute
  • I also manually tested the code confirming all functions work as intended and the google spreadsheet is updated accordingly.

CI Python Linter Results


Deployment

  • The program was deployed to Heroku.
  • The program can be reached by the link

To deploy the project as an application that can be run locally:

Note:

  1. This project requires you to have Python installed on your local PC:
  • sudo apt install python3
  1. You will also need pip installed to allow the installation of modules the application uses.
  • sudo apt install python3-pip Create a local copy of the GitHub repository by following one of the two processes below:
  • Download ZIP file:
  1. Go to the GitHub Repo page.
  2. Click the Code button and download the ZIP file containing the project.
  3. Extract the ZIP file to a location on your PC.
  • Clone the repository:
  1. Open a folder on your computer with the terminal.
  2. Run the following command
  • git clone https://github.com/TafadzwaMangena/my-finance-tracker.git
  • Alternatively, if using Gitpod, you can click below to create your own workspace using this repository.
  1. Install Python module dependencies:
  2. Navigate to the folder madlib_with_python by executing the command:
  • cd my_finance_tracker
  1. Run the command pip install -r requirements.txt
  • pip3 install -r requirements.txt

To deploy the project to Heroku so it can be run as a remote web application:

  • Clone the repository:
  1. Open a folder on your computer with the terminal.
  2. Run the following command
  • git clone https://github.com/TafadzwaMangena/my-finance-tracker.git
  1. Create your own GitHub repository to host the code.
  2. Run the command git remote set-url origin <Your GitHub Repo Path> to set the remote repository location to your repository.
  3. Push the files to your repository with the following command: git push
  4. Create a Heroku account if you don't already have one here Heroku.
  5. Create a new Heroku application on the following page here New HerokuApp:
  6. Go to the Deploy tab: Deploy
  7. Link your GitHub account and connect the application to the repository you created. Connect to Github
  8. Go to the Settings tab: Settings tab
  9. Click "Add buildpack": Add buildpack
  10. Add the Python and Node.js buildpacks in the following order: Add Python and Node.js
  11. Click "Reveal Config Vars." Reveal Configs
  12. Add 1 new Config Vars:
  • Key: CREDS
  • VALUE: Copy and Paste your creds.json file Value & Key
  1. Go back to the Deploy tab: Deploy
  2. Click "Deploy Branch": Deploy Branch
  3. Wait for the completion of the deployment. Deployment
  4. Click "Open app" to launch the application inside a web page. View

Credits

  • Color formatting: Colorama.

  • Terminal menu: Simple Terminal Menu.

  • Code Credits

  • The add_expense function was inspired by Tiff from Tiff In Tech youtube channel.

  • Internet Made Coder: I used one of the ideas from this youtube channel to make the flowchat and structure of my code.

  • Syntax errors and other errors where solved using some of the articles and responses from stackoverflow

  • Code Institue: tutorials were used to wire up APIs an connect to google spread sheets.

  • Code Institue: tutorials were used to format code to maintain 79 charatcers or less on one line.

  • This project was ceated using a full template provided by Code Institute.


Acknowledgements

  • My wife was supportive though out the building of the website and gave me ideas.
  • My Mentor has been a great help giving insightful feedback.
  • Tutor support at Code Institute.
  • Slack community at Code Institute.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published