# jarrel-sit/26inf1103-p4-7 architecture

> Architecture diagram of the GitHub repository jarrel-sit/26inf1103-p4-7, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jarrel-sit/26inf1103-p4-7
- Repository: https://github.com/jarrel-sit/26inf1103-p4-7

## Overview

This is a command-line AI recipe planner. Users add pantry ingredients, select ingredients for a recipe, and provide dietary and allergy preferences; the application requests a recipe from Gemini, validates the response, applies business rules, scores and routes the result, then displays and saves it. Separate menu flows support viewing ingredients and filtering saved recipes. The graph follows calls shown in main.py and the sampled managers; README capabilities not clearly implemented in those excerpts are not expanded into extra components.

Main entry points: [`main.py`](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/main.py) (Application workflows), [`io_manager.py`](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/io_manager.py) (Recipe and history views), [`ai_manager.py`](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/ai_manager.py) (AI response processing), [`logic_manager.py`](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/logic_manager.py) (Recipe rule evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI interaction"]
  node_menu["Application menu<br/>[io_manager.py]"]
  node_ingredient_input["Ingredient entry<br/>[io_manager.py]"]
  node_recipe_input["Recipe preferences<br/>[io_manager.py]"]
  node_recipe_display["Recipe and history views<br/>[io_manager.py]"]
end

subgraph group_generation["Recipe generation"]
  node_app["Application workflows<br/>[main.py]"]
  node_ai_pipeline["AI response processing<br/>[ai_manager.py]"]
end

subgraph group_evaluation["Safety and evaluation"]
  node_business_rules["Recipe rule evaluation<br/>[logic_manager.py]"]
  node_recipe_scoring["Recipe scoring and routing<br/>[logic_manager.py]"]
end

subgraph group_persistence["CSV persistence"]
  node_ingredient_store[("Ingredient CSV records<br/>[data_manager.py]")]
  node_recipe_store[("Recipe CSV records<br/>[data_manager.py]")]
  node_history_filters["Recipe history filters<br/>[data_manager.py]"]
end

node_user(("CLI user"))
node_gemini["Gemini API"]

node_user -->|"chooses options"| node_menu
node_menu -->|"dispatches choices"| node_app
node_app -->|"requests ingredients"| node_ingredient_input
node_ingredient_input -->|"returns entries"| node_app
node_app -->|"loads and saves"| node_ingredient_store
node_app -->|"collects preferences"| node_recipe_input
node_recipe_input -->|"returns recipe inputs"| node_app
node_app -->|"requests recipe"| node_ai_pipeline
node_ai_pipeline -->|"sends prompt"| node_gemini
node_gemini -->|"streams response"| node_ai_pipeline
node_app -->|"evaluates recipe"| node_business_rules
node_business_rules -->|"routes and scores"| node_recipe_scoring
node_app -->|"saves recipe"| node_recipe_store
node_app -->|"displays result"| node_recipe_display
node_user -->|"views history"| node_recipe_display
node_app -->|"filters history"| node_history_filters
node_history_filters -->|"provides filtered records"| node_recipe_display
node_app -->|"loads saved recipes"| node_recipe_store
node_app -->|"shows ingredients"| node_recipe_display

click node_menu "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/io_manager.py"
click node_ingredient_input "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/io_manager.py"
click node_recipe_input "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/io_manager.py"
click node_recipe_display "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/io_manager.py"
click node_app "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/main.py"
click node_ai_pipeline "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/ai_manager.py"
click node_business_rules "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/logic_manager.py"
click node_recipe_scoring "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/logic_manager.py"
click node_ingredient_store "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/data_manager.py"
click node_recipe_store "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/data_manager.py"
click node_history_filters "https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/data_manager.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_ingredient_input,node_recipe_input,node_recipe_display,node_user toneBlue
class node_app,node_ai_pipeline toneAmber
class node_business_rules,node_recipe_scoring,node_gemini toneMint
class node_ingredient_store,node_recipe_store,node_history_filters toneRose
```

## Components

### CLI interaction

- [Application menu](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/io_manager.py): `io_manager.py`
- [Ingredient entry](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/io_manager.py): `io_manager.py`
- [Recipe preferences](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/io_manager.py): `io_manager.py`
- [Recipe and history views](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/io_manager.py): `io_manager.py`

### Recipe generation

- [Application workflows](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/main.py): `main.py`
- [AI response processing](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/ai_manager.py): `ai_manager.py`

### Safety and evaluation

- [Recipe rule evaluation](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/logic_manager.py): `logic_manager.py`
- [Recipe scoring and routing](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/logic_manager.py): `logic_manager.py`

### CSV persistence

- [Ingredient CSV records](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/data_manager.py): `data_manager.py`
- [Recipe CSV records](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/data_manager.py): `data_manager.py`
- [Recipe history filters](https://github.com/jarrel-sit/26inf1103-p4-7/blob/main/data_manager.py): `data_manager.py`

### Other components

- **CLI user**
- **Gemini API**

## Connections

- CLI user → Application menu: chooses options (evidence: `io_manager.py`)
- Application menu → Application workflows: dispatches choices (evidence: `main.py`)
- Application workflows → Ingredient entry: requests ingredients (evidence: `main.py`)
- Ingredient entry → Application workflows: returns entries (evidence: `main.py`)
- Application workflows → Ingredient CSV records: loads and saves (evidence: `main.py`)
- Application workflows → Recipe preferences: collects preferences (evidence: `main.py`)
- Recipe preferences → Application workflows: returns recipe inputs (evidence: `main.py`)
- Application workflows → AI response processing: requests recipe (evidence: `main.py`)
- AI response processing → Gemini API: sends prompt (evidence: `ai_manager.py`)
- Gemini API → AI response processing: streams response (evidence: `ai_manager.py`)
- Application workflows → Recipe rule evaluation: evaluates recipe (evidence: `main.py`)
- Recipe rule evaluation → Recipe scoring and routing: routes and scores (evidence: `logic_manager.py`)
- Application workflows → Recipe CSV records: saves recipe (evidence: `main.py`)
- Application workflows → Recipe and history views: displays result (evidence: `main.py`)
- CLI user → Recipe and history views: views history
- Application workflows → Recipe history filters: filters history (evidence: `main.py`)
- Recipe history filters → Recipe and history views: provides filtered records (evidence: `main.py`)
- Application workflows → Recipe CSV records: loads saved recipes (evidence: `main.py`)
- Application workflows → Recipe and history views: shows ingredients (evidence: `main.py`)
