How djotaku/amortization works
Project type and purpose
• This is a standalone Python amortization-table generator.
• It supports two “front ends”: a command-line interface (amortization.py) and a Qt GUI (amortization-gui.py + gui.py + gui.ui).
• Core function: compute payment schedules and output as CSV or on-screen/Qt table.
File structure
• Top-level scripts:
– amortization.py → CLI entry point
– amortization-gui.py → GUI entry point
– gui.py → GUI controller (loads .ui, handles signals)
– gui.ui → Qt Designer UI definition
– test.py → simple tests or demo harness
• Core library:
– amortization.py (also contains core logic if imported)
• Config/dependencies:
– requirements.txt → lists Python packages (e.g., PyQt5 or PySide2)
• CI/CD:
– .github/workflows/*.yml → lint and build on Linux/Windows
Pull extra insights from the README
• Command-line flags (–csv, –screen, –P, –i, –n)
• Optional “extraprincipal” file for extra payments
• GUI uses Qt; on calculation writes amort.csv + populates a table widget
Main components & their interactions
a. Components:
1. User (CLI)
2. User (GUI)
3. CLI Front-end (amortization.py main)
4. GUI Front-end (amortization-gui.py & gui.py + gui.ui)
5. Core Engine / Business Logic (amortization module: calculation functions)
6. Optional Input (extraprincipal file)
7. Output writer (CSV generator)
8. Layer (terminal stdout or Qt TableView)
9. Tests (test.py)
10. CI/CD pipelines (.github/workflows)
b. Interactions:
– CLI front-end parses arguments → calls CoreEngine.calculate_schedule()
– GUI front-end loads UI → on “Calculate” → reads fields → calls CoreEngine.calculate_schedule()
– CoreEngine reads extraprincipal file (if present) → computes amortization schedule
– CoreEngine returns a data structure (list of rows)
– Output writer:
• If CLI+–csv → write CSV to disk
• If CLI+–screen → print to stdout
• If GUI → populate Qt TableView + write amort.csv
c. Architectural pattern
• Model-View-Controller–like separation:
– Model = CoreEngine (pure calculation)
– View+Controller = CLI parser or Qt widgets + gui.py
• Single process, modular Python packages
d. Key technologies
– Python 3.x
– argparse (CLI parsing)
– csv module
– PyQt5 or PySide2 for GUI
– Qt Designer (.ui file)
– GitHub Actions for CI