# medmatix/accounting-system architecture

> Architecture diagram of the GitHub repository medmatix/accounting-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/medmatix/accounting-system
- Repository: https://github.com/medmatix/accounting-system

## Overview

##### Project type and purpose
- This is a desktop, open-source accounting system written in Python 3.7 with a Tkinter GUI and an SQLite3 backend.
- Its purpose is to let users enter general-journal transactions, post them to a general ledger, maintain a chart of accounts, annotate entries, and produce standard GAAP reports (balance sheet, trial balance, etc.).

##### File structure
Top-level modules and directories:
- OpenAccounting.py – the main entry point that launches the splash screen and main UI
- splash.py – splash screen logic
- AccountDB.py – database connection and CRUD operations (Model)
- FormDialogs.py – dialog-based forms for Journal, Chart, Memo entry (Controller)
- ReportPreps.py – report-generation routines (Controller)
- Tooltips.py – UI helper for tooltips
- README.md, LICENSE, OpenAccounting.db (the SQLite file), OpenAccounting.sql
- .sln, .pyproj, .vs folders – Visual Studio solution/project files (for packaging or Windows deployment)
- testcode.py – exploratory/test scripts

Key patterns visible:
– MVC modular separation (Model=AccountDB, View=Tkinter widgets in OpenAccounting.py and FormDialogs.py, Controller=FormDialogs + ReportPreps)
– SQLite schema defined in .sql and created by AccountDB at runtime

##### README for additional insights
- Emphasizes bottom-up, data-driven design centered on four core tables: chart, journal, ledger, accountmemos
- Lists all Python and 3rd-party imports (tkinter submodules, sqlite3, pytz, numpy, etc.)
- Describes the user flows: enter transactions in Journal → post to Ledger → generate reports; manage Chart of Accounts; annotate entries; perform maintenance

##### Final advice
- Be very detailed: break the UI layer into splash, main window, tabs, and dialogs
- Every module and its relationship to the database
- Don’t overthink: enumerate each .py file as a component in the View or Controller

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        direction TB
        Splash["Splash Screen"]:::ui
        MainUI["Main Window & Tabs"]:::ui
        Dialogs["Dialog Forms (Journal/Chart/Memo)"]:::ui
    end

    %% Controller Layer
    subgraph "Controller Layer"
        direction TB
        Reports["Report Generation Routines"]:::controller
        Tooltips["UI Helper for Tooltips"]:::controller
    end

    %% Model Layer
    subgraph "Model Layer"
        direction TB
        AccountDB["AccountDB (Model)"]:::model
    end

    %% Persistence
    subgraph "Persistence"
        direction TB
        DBFile[(OpenAccounting.db)]
        Schema[(OpenAccounting.sql)]
    end

    %% Project Packaging & Docs
    subgraph "Project Packaging & Documentation"
        direction TB
        SLN["Accounting-System.sln"]:::packaging
        PROJ["Accounting-System.pyproj"]:::packaging
        README["README.md"]:::docs
        LICENSE["LICENSE"]:::docs
        TEST["testcode.py"]:::docs
        VS[".vs/"]:::packaging
        SETTINGS[".settings/"]:::packaging
    end

    %% External Libraries & Environment
    subgraph "External Libraries & Environment"
        direction TB
        Python["Python 3.7"]:::external
        TK["Tkinter"]:::external
        SQLiteLib["SQLite3"]:::external
        Pytz["pytz / numpy"]:::external
    end

    %% Connections
    Splash -->|"handoff"| MainUI
    MainUI -->|"opens"| Dialogs
    Dialogs -->|"invokes CRUD"| AccountDB
    MainUI -->|"direct calls"| AccountDB
    Reports -->|"queries"| AccountDB
    Reports -->|"outputs data to"| MainUI
    Tooltips -->|"provides UI helpers to"| MainUI
    AccountDB -->|"reads/writes"| DBFile
    AccountDB -->|"schema init from"| Schema

    Python --> Splash
    TK --> MainUI
    SQLiteLib --> AccountDB
    Pytz --> Reports

    %% Click Events
    click Splash "https://github.com/medmatix/accounting-system/blob/master/splash.py"
    click MainUI "https://github.com/medmatix/accounting-system/blob/master/OpenAccounting.py"
    click Dialogs "https://github.com/medmatix/accounting-system/blob/master/FormDialogs.py"
    click Reports "https://github.com/medmatix/accounting-system/blob/master/ReportPreps.py"
    click Tooltips "https://github.com/medmatix/accounting-system/blob/master/Tooltips.py"
    click AccountDB "https://github.com/medmatix/accounting-system/blob/master/AccountDB.py"
    click DBFile "https://github.com/medmatix/accounting-system/blob/master/OpenAccounting.db"
    click Schema "https://github.com/medmatix/accounting-system/blob/master/OpenAccounting.sql"
    click SLN "https://github.com/medmatix/accounting-system/blob/master/Accounting-System.sln"
    click PROJ "https://github.com/medmatix/accounting-system/blob/master/Accounting-System.pyproj"
    click README "https://github.com/medmatix/accounting-system/blob/master/README.md"
    click LICENSE "https://github.com/medmatix/accounting-system/tree/master/LICENSE"
    click TEST "https://github.com/medmatix/accounting-system/blob/master/testcode.py"
    click VS "https://github.com/medmatix/accounting-system/tree/master/.vs/"
    click SETTINGS "https://github.com/medmatix/accounting-system/tree/master/.settings/"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef controller fill:#90EE90,stroke:#333,stroke-width:1px
    classDef model fill:#FFA500,stroke:#333,stroke-width:1px
    classDef packaging fill:#D8BFD8,stroke:#333,stroke-width:1px
    classDef docs fill:#FFFFE0,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
