diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..39659d2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Python runtime as a parent image +FROM python:3.10-slim + +# Set the working directory in the container +WORKDIR /app + +# Copy the current directory contents into the container at /app +COPY . /app + +# Install any needed packages specified in requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Expose port 5000 for the Flask app +EXPOSE 5000 + +# Set the FLASK_APP environment variable to point to financial.py +ENV FLASK_APP=financial.py + +# Run the application, binding to all interfaces +CMD ["flask", "run", "--host=0.0.0.0"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6b955c6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Tshenolo Mos + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..097c7d7 --- /dev/null +++ b/README.md @@ -0,0 +1,101 @@ +# Financial Dashboard in Python + +A Flask-based financial dashboard that enables users to upload CSV files containing transaction data and view insightful summaries and visualizations of their income, expenses, and savings. The dashboard provides monthly breakdowns, income and expense charts, and savings metrics. + +![Screenshot](screenshot.png) + +## Features + +- **Upload CSV Files:** Easily upload a CSV file with your transaction data. +- **Monthly Income and Expense Tracking:** View your monthly income and expenses in grouped bar charts. +- **Category-wise Expense Breakdown:** Analyze expenses by category, excluding "Savings" from the breakdown. +- **Total Income, Expenses, and Savings Summary:** Get a snapshot of total income, total expenses, and total savings with an intuitive indicator display. +- **Savings Percentage Calculation:** Understand the percentage of income saved. + +## Installation + +1. Clone this repository: + ```bash + git clone https://github.com/Incipiens/FinancialDashboardPython.git + ``` + +2. Navigate to the project directory: + ```bash + cd FinancialDashboardPython + ``` + +3. Create a Python 3.10 virtual environment: + ```bash + python3.10 -m venv env310 + ``` + + +4. Activate the virtual environment: + - On Windows: + ```bash + env310\Scripts\activate + ``` + + - On macOS/Linux: + ```bash + source env310/bin/activate + ``` + +5. Install required packages within the activated environment: + ```bash + pip install -r requirements.txt + ``` + +6. Run the app: + ```bash + python financial.py + ``` + The app will be available at http://localhost:5000/. + +## Docker Deployment +To run the Financial Dashboard application using Docker: +1. Build the Docker image: + ```bash + docker build -t financial-dashboard . + ``` + +2. Run the Docker container: + ```bash + docker run -p 5000:5000 financial-dashboard + ``` + +3. Access the application: Open your browser and navigate to http://localhost:5000/. +This will start the application in a Docker container, making it accessible on port 5000 of your local machine. + +## Usage +1. Navigate to the homepage of the application. +2. Upload a CSV file with columns Date, Category, and Amount: + - Date: The date of the transaction (format: YYYY-MM-DD). + - Category: The category for each transaction (e.g., Groceries, Rent). + - Amount: The transaction amount, where positive values indicate income and negative values indicate expenses. +3. View the financial summaries and insights, including: + - Income vs. Expenses Chart: A grouped bar chart of income and expenses by month. + - Expenses by Category: A pie chart of expenses by category, excluding savings. + - Savings Summary: Displays total income, total expenses, and savings with the savings percentage. + +## Files +- financial.py: Main application file with routes and logic for processing the CSV file and generating graphs. +- templates/index.html: Template for displaying the dashboard with charts. +- requirements.txt: Dependencies for the project. + +## Example CSV Format +```csv +Date,Category,Amount +2024-01-01,Salary,2000 +2024-01-10,Rent,-800 +2024-01-15,Groceries,-150 +2024-02-01,Salary,2000 +2024-02-10,Rent,-800 +2024-02-15,Entertainment,-120 +``` + +## Contributing +Feel free to open issues or submit pull requests for improvements and new features! + +## License +This project is open-source and available under the MIT License. diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..49b2b45 Binary files /dev/null and b/favicon.ico differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0cd4307 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +Flask==2.1.3 +Werkzeug==2.0.3 +pandas==1.5.3 +numpy==1.23.5 +plotly==5.6.0 diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..ad2eaa6 Binary files /dev/null and b/screenshot.png differ