# aparajith-2105/canteen-sales-predictor architecture

> Architecture diagram of the GitHub repository aparajith-2105/canteen-sales-predictor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aparajith-2105/canteen-sales-predictor
- Repository: https://github.com/aparajith-2105/canteen-sales-predictor

## Overview

A small terminal application: the user enters daily canteen data, trains and reviews a sales model, then supplies tomorrow’s conditions to receive an expected-sales forecast and cook amount. The single source file implements the menu, CSV persistence, demo-data generation, cross-validation, range warnings, and prediction. README documents the capabilities; edges below reflect calls visible in the excerpt.

Main entry points: [`canteen_predictor_linear.py`](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py) (Menu workflow), [`canteen.csv`](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen.csv) (Daily CSV)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Terminal app"]
  node_menu["Menu workflow"]
  node_input["Validated input"]
end

subgraph group_data["Daily data"]
  node_add["Add daily record"]
  node_demo["Demo data"]
  node_csv[("Daily CSV<br/>[canteen.csv]")]
  node_view["View saved data"]
end

subgraph group_model["Sales modeling"]
  node_training["Train model"]
  node_validation["Cross-validation"]
  node_effects["Factor effects"]
  node_forecast["Tomorrow forecast"]
  node_range["Range warnings"]
  node_cook["Cook recommendation"]
end

node_user(("Canteen operator"))

node_user -->|"chooses option"| node_menu
node_menu -->|"dispatches to"| node_add
node_menu -->|"dispatches to"| node_demo
node_menu -->|"dispatches to"| node_training
node_menu -->|"dispatches to"| node_forecast
node_menu -->|"dispatches to"| node_view
node_add -->|"asks for"| node_input
node_add -->|"reads and writes"| node_csv
node_demo -->|"overwrites"| node_csv
node_view -->|"reads"| node_csv
node_training -->|"loads records"| node_csv
node_training -->|"evaluates with"| node_validation
node_training -->|"reports coefficients"| node_effects
node_forecast -->|"trains if needed"| node_training
node_forecast -->|"asks for"| node_input
node_forecast -->|"checks inputs"| node_range
node_forecast -->|"computes recommendation"| node_cook
node_forecast -->|"shows forecast"| node_user

click node_menu "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_input "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_add "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_demo "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_csv "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen.csv"
click node_view "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_training "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_validation "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_effects "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_forecast "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_range "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"
click node_cook "https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py"

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_menu,node_input toneBlue
class node_add,node_demo,node_csv,node_view toneAmber
class node_training,node_validation,node_effects,node_forecast,node_range,node_cook toneMint
class node_user toneIndigo
```

## Components

### Terminal app

- [Menu workflow](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`
- [Validated input](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`

### Daily data

- [Add daily record](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`
- [Demo data](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`
- [Daily CSV](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen.csv): `canteen.csv`
- [View saved data](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`

### Sales modeling

- [Train model](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`
- [Cross-validation](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`
- [Factor effects](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`
- [Tomorrow forecast](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`
- [Range warnings](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`
- [Cook recommendation](https://github.com/aparajith-2105/canteen-sales-predictor/blob/main/canteen_predictor_linear.py): `canteen_predictor_linear.py`

### Other components

- **Canteen operator**

## Connections

- Canteen operator → Menu workflow: chooses option (evidence: `canteen_predictor_linear.py`)
- Menu workflow → Add daily record: dispatches to (evidence: `canteen_predictor_linear.py`)
- Menu workflow → Demo data: dispatches to (evidence: `canteen_predictor_linear.py`)
- Menu workflow → Train model: dispatches to (evidence: `canteen_predictor_linear.py`)
- Menu workflow → Tomorrow forecast: dispatches to (evidence: `canteen_predictor_linear.py`)
- Menu workflow → View saved data: dispatches to (evidence: `canteen_predictor_linear.py`)
- Add daily record → Validated input: asks for (evidence: `canteen_predictor_linear.py`)
- Add daily record → Daily CSV: reads and writes (evidence: `canteen_predictor_linear.py`)
- Demo data → Daily CSV: overwrites (evidence: `canteen_predictor_linear.py`)
- View saved data → Daily CSV: reads (evidence: `canteen_predictor_linear.py`)
- Train model → Daily CSV: loads records (evidence: `canteen_predictor_linear.py`)
- Train model → Cross-validation: evaluates with (evidence: `canteen_predictor_linear.py`)
- Train model → Factor effects: reports coefficients (evidence: `canteen_predictor_linear.py`)
- Tomorrow forecast → Train model: trains if needed (evidence: `canteen_predictor_linear.py`)
- Tomorrow forecast → Validated input: asks for (evidence: `canteen_predictor_linear.py`)
- Tomorrow forecast → Range warnings: checks inputs (evidence: `canteen_predictor_linear.py`)
- Tomorrow forecast → Cook recommendation: computes recommendation (evidence: `canteen_predictor_linear.py`)
- Tomorrow forecast → Canteen operator: shows forecast (evidence: `canteen_predictor_linear.py`)
