# lakhia13/cmpsc430-project architecture

> Architecture diagram of the GitHub repository lakhia13/cmpsc430-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lakhia13/cmpsc430-project
- Repository: https://github.com/lakhia13/cmpsc430-project

## Overview

##### Project Type and Purpose
- This is a Python‐based desktop loan management system with a Tkinter GUI.
- It provides administrative and customer views for managing customers and multiple loan types.
- It persists data in an Oracle XE database running in Docker.

##### File‐Structure Analysis
- Top‐level scripts:
- main.py – application entry point and GUI launcher
- db.py – data‐access layer, connection management, schema initialization
- views/ directory – UI components (customer login, customer admin, loan management)
- requirements.txt – declares Python dependencies (e.g., cx_Oracle, python‐dotenv, Tkinter)
- .gitignore, .idea – IDE and VCS metadata

##### README Insights
- Python 3.x + Tkinter for GUI
- Oracle XE in Docker, environment variables for credentials/DSN
- Automatic table creation/sample data on first run
- Two user roles: Admin and Customer

##### Main Components
a. Desktop Application
- Presentation Layer: Tkinter windows (login, admin, customer, loan forms)
- Application Logic: validation, view controllers (embedded in view modules)
- Data‐Access Layer: db.py, uses cx_Oracle and environment variables (.env)
b. External Service
- Oracle XE Database (Docker container gvenzl/oracle-xe)
c. Dev/Ops & Runtime
- Docker host (ports 1521, 5500)
- Python runtime & venv
- Environment config (.env)

##### Relationships & Interactions
- User → Tkinter UI (views/*.py)
- UI invokes application logic (in same view modules or via helper classes)
- Logic calls Data‐Access Layer (db.py)
- db.py uses connection parameters from .env to connect over TCP to Oracle XE
- Oracle responds with query results/ACKs → db.py → UI update

##### Architectural Patterns & Principles
- Layered architecture:
- UI Layer (Views)
- Business Logic Layer (Controllers in views)
- Data Layer (db.py)
- Separation of concerns: each module has a clear responsibility
- Externalize configuration (env vars)

## Diagram (Mermaid)

```mermaid
flowchart TB
    User["User"]:::external

    subgraph "Tkinter GUI (views/*.py)"
        CLV["CustomerLoginView"]:::ui
        CV["CustomerView"]:::ui
        LV["LoanView"]:::ui
    end

    subgraph "Application Logic / Controllers"
        Logic["Business Logic Controllers"]:::logic
    end

    subgraph "Data Access Layer (db.py + .env)"
        DAL["Data Access Layer (db.py)"]:::data
    end

    Oracle["Oracle XE Database\n(Docker Container)"]:::external

    Main["main.py\n(Application Entry Point)"]:::config
    ConfigEnv["Environment Config\n(.env)"]:::config
    DockerHost["Docker Host\nPorts 1521/5500"]:::external
    Req["requirements.txt"]:::config
    Doc["README.md"]:::config
    VIEWS["views/"]:::config

    Main -->|"launches UI"| CLV
    Main -->|"launches UI"| CV
    Main -->|"launches UI"| LV

    User -->|"interacts"| CLV

    CLV -->|"calls"| Logic
    CV -->|"calls"| Logic
    LV -->|"calls"| Logic

    Logic -->|"executes queries"| DAL
    DAL -->|"connects TCP (cx_Oracle)"| Oracle
    Oracle -->|"returns results"| DAL
    DAL -->|"provides data"| Logic
    Logic -->|"updates UI"| CLV

    ConfigEnv -->|"provides credentials"| DAL
    DockerHost -->|"hosts"| Oracle

    Req -.-> Main
    Doc -.-> Main

    classDef ui fill:#C6F6D5,stroke:#2F855A;
    classDef logic fill:#BEE3F8,stroke:#2B6CB0;
    classDef data fill:#FEFCBF,stroke:#D69E2E;
    classDef external fill:#E9D8FD,stroke:#6B46C1;
    classDef config fill:#E2E8F0,stroke:#4A5568;

    click Main "https://github.com/lakhia13/cmpsc430-project/blob/main/main.py"
    click DAL "https://github.com/lakhia13/cmpsc430-project/blob/main/db.py"
    click CLV "https://github.com/lakhia13/cmpsc430-project/blob/main/views/customer_login_view.py"
    click CV "https://github.com/lakhia13/cmpsc430-project/blob/main/views/customer_view.py"
    click LV "https://github.com/lakhia13/cmpsc430-project/blob/main/views/loan_view.py"
    click Req "https://github.com/lakhia13/cmpsc430-project/blob/main/requirements.txt"
    click Doc "https://github.com/lakhia13/cmpsc430-project/blob/main/README.md"
    click VIEWS "https://github.com/lakhia13/cmpsc430-project/tree/main/views/"
```
