# corvogithub/tandur architecture

> Architecture diagram of the GitHub repository corvogithub/tandur, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/corvogithub/tandur
- Repository: https://github.com/corvogithub/tandur

## Overview

Tandur is a terminal application for recording harvest transactions and transparently calculating the 70/30 farmer/group-fund split. The principal workflow starts with an operator entering a harvest, which the menu controller validates and passes to domain logic for record creation; the controller then saves it and presents results. The same menu routes listing, search, sorting, editing, deletion, summaries and receipt printing. The excerpts show the controller’s calls and the JSON/receipt persistence implementation; other menu behavior is supported by the README. No external services are shown.

Main entry points: [`main.py`](https://github.com/corvogithub/tandur/blob/main/main.py) (Menu controller), [`file_handler.py`](https://github.com/corvogithub/tandur/blob/main/file_handler.py) (JSON persistence), [`ui_formatter.py`](https://github.com/corvogithub/tandur/blob/main/ui_formatter.py) (Terminal presentation), [`algorithms.py`](https://github.com/corvogithub/tandur/blob/main/algorithms.py) (Harvest entry and split)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Terminal interface"]
  node_controller["Menu controller<br/>[main.py]"]
  node_terminal_ui["Terminal presentation<br/>[ui_formatter.py]"]
end

subgraph group_domain["Harvest domain"]
  node_harvest_entry["Harvest entry and split<br/>[algorithms.py]"]
  node_record_management["Record management<br/>[algorithms.py]"]
  node_search_sort["Search and sorting<br/>[algorithms.py]"]
  node_statistics["Harvest summaries<br/>[algorithms.py]"]
end

subgraph group_storage["Persistence and receipts"]
  node_json_store[("Harvest JSON store<br/>[db_panen.json]")]
  node_file_operations["JSON persistence<br/>[file_handler.py]"]
  node_receipt_files["Receipt text files"]
end

node_operator(("Farm group operator"))

node_operator -->|"chooses actions"| node_controller
node_controller -->|"renders and prompts"| node_terminal_ui
node_controller -->|"creates records"| node_harvest_entry
node_controller -->|"adds or edits"| node_record_management
node_controller -->|"searches and sorts"| node_search_sort
node_controller -->|"requests summary"| node_statistics
node_controller -->|"loads and saves"| node_file_operations
node_file_operations -->|"reads and writes"| node_json_store
node_controller -->|"creates receipt"| node_file_operations
node_file_operations -->|"writes receipt"| node_receipt_files
node_controller -->|"displays receipt"| node_terminal_ui

click node_controller "https://github.com/corvogithub/tandur/blob/main/main.py"
click node_terminal_ui "https://github.com/corvogithub/tandur/blob/main/ui_formatter.py"
click node_harvest_entry "https://github.com/corvogithub/tandur/blob/main/algorithms.py"
click node_record_management "https://github.com/corvogithub/tandur/blob/main/algorithms.py"
click node_search_sort "https://github.com/corvogithub/tandur/blob/main/algorithms.py"
click node_statistics "https://github.com/corvogithub/tandur/blob/main/algorithms.py"
click node_json_store "https://github.com/corvogithub/tandur/blob/main/data/db_panen.json"
click node_file_operations "https://github.com/corvogithub/tandur/blob/main/file_handler.py"
click node_receipt_files "https://github.com/corvogithub/tandur/tree/main/laporan"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_terminal_ui toneBlue
class node_harvest_entry,node_record_management,node_search_sort,node_statistics toneAmber
class node_json_store,node_file_operations,node_receipt_files toneMint
class node_operator toneIndigo
```

## Components

### Terminal interface

- [Menu controller](https://github.com/corvogithub/tandur/blob/main/main.py): `main.py`
- [Terminal presentation](https://github.com/corvogithub/tandur/blob/main/ui_formatter.py): `ui_formatter.py`

### Harvest domain

- [Harvest entry and split](https://github.com/corvogithub/tandur/blob/main/algorithms.py): `algorithms.py`
- [Record management](https://github.com/corvogithub/tandur/blob/main/algorithms.py): `algorithms.py`
- [Search and sorting](https://github.com/corvogithub/tandur/blob/main/algorithms.py): `algorithms.py`
- [Harvest summaries](https://github.com/corvogithub/tandur/blob/main/algorithms.py): `algorithms.py`

### Persistence and receipts

- [Harvest JSON store](https://github.com/corvogithub/tandur/blob/main/data/db_panen.json): `data/db_panen.json`
- [JSON persistence](https://github.com/corvogithub/tandur/blob/main/file_handler.py): `file_handler.py`
- [Receipt text files](https://github.com/corvogithub/tandur/tree/main/laporan): `laporan`

### Other components

- **Farm group operator**

## Connections

- Farm group operator → Menu controller: chooses actions (evidence: `README.md`)
- Menu controller → Terminal presentation: renders and prompts (evidence: `main.py`)
- Menu controller → Harvest entry and split: creates records (evidence: `main.py`)
- Menu controller → Record management: adds or edits (evidence: `main.py`)
- Menu controller → Search and sorting: searches and sorts (evidence: `main.py`)
- Menu controller → Harvest summaries: requests summary (evidence: `main.py`)
- Menu controller → JSON persistence: loads and saves (evidence: `main.py`)
- JSON persistence → Harvest JSON store: reads and writes (evidence: `file_handler.py`)
- Menu controller → JSON persistence: creates receipt (evidence: `main.py`)
- JSON persistence → Receipt text files: writes receipt (evidence: `file_handler.py`)
- Menu controller → Terminal presentation: displays receipt (evidence: `main.py`)
