# harishchaudhary-dev/smart-food-recommender architecture

> Architecture diagram of the GitHub repository harishchaudhary-dev/smart-food-recommender, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harishchaudhary-dev/smart-food-recommender
- Repository: https://github.com/harishchaudhary-dev/smart-food-recommender

## Overview

This is a food recommender with parallel Streamlit and CLI entry points. Each loads the food dataset, builds a content-based k-NN model, profiles a user request using category, goal, diet and text preferences, then presents nearest-food results. The README documents the shared text, categorical and nutrient feature strategy; the sampled code shows both implementations inline rather than as shared modules.

Main entry points: [`app.py`](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py) (Streamlit dashboard), [`main.py`](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py) (CLI runner), [`food.csv`](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/food.csv) (Food dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_web["Streamlit dashboard<br/>[app.py]"]
  node_cli["CLI runner<br/>[main.py]"]
  node_web_results["Recommendation cards<br/>[app.py]"]
  node_cli_results["Printed recommendations<br/>[main.py]"]
end

subgraph group_recommendation["Recommendation engine"]
  node_web_profile["Web query profiling<br/>[app.py]"]
  node_cli_profile["CLI query profiling<br/>[main.py]"]
  node_web_features["Web feature preprocessing<br/>[app.py]"]
  node_cli_features["CLI feature preprocessing<br/>[main.py]"]
  node_web_knn["Web k-NN search<br/>[app.py]"]
  node_cli_knn["CLI k-NN search<br/>[main.py]"]
end

subgraph group_data["Food data"]
  node_food_data["Food dataset<br/>[food.csv]"]
end

node_web_user(("Web user"))
node_cli_user(("CLI user"))

node_web_user -->|"sets preferences"| node_web
node_cli_user -->|"answers prompts"| node_cli
node_web -->|"loads"| node_food_data
node_cli -->|"loads"| node_food_data
node_web -->|"fits features"| node_web_features
node_cli -->|"fits features"| node_cli_features
node_web -->|"profiles query"| node_web_profile
node_cli -->|"profiles query"| node_cli_profile
node_web_profile -->|"transforms query"| node_web_features
node_cli_profile -->|"transforms query"| node_cli_features
node_web -->|"fits model"| node_web_knn
node_cli -->|"fits model"| node_cli_knn
node_web -->|"searches neighbors"| node_web_knn
node_cli -->|"searches neighbors"| node_cli_knn
node_web_knn -->|"returns indices"| node_web_results
node_cli_knn -->|"returns indices"| node_cli_results
node_food_data -->|"provides food rows"| node_web_results
node_food_data -->|"provides food rows"| node_cli_results

click node_web "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py"
click node_cli "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py"
click node_web_profile "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py"
click node_cli_profile "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py"
click node_web_features "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py"
click node_cli_features "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py"
click node_web_knn "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py"
click node_cli_knn "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py"
click node_web_results "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py"
click node_cli_results "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py"
click node_food_data "https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/food.csv"

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_web,node_cli,node_web_results,node_cli_results,node_web_user,node_cli_user toneBlue
class node_web_profile,node_cli_profile,node_web_features,node_cli_features,node_web_knn,node_cli_knn toneAmber
class node_food_data toneMint
```

## Components

### User interfaces

- [Streamlit dashboard](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py): `app.py`
- [CLI runner](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py): `main.py`
- [Recommendation cards](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py): `app.py`
- [Printed recommendations](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py): `main.py`

### Recommendation engine

- [Web query profiling](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py): `app.py`
- [CLI query profiling](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py): `main.py`
- [Web feature preprocessing](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py): `app.py`
- [CLI feature preprocessing](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py): `main.py`
- [Web k-NN search](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/app.py): `app.py`
- [CLI k-NN search](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/main.py): `main.py`

### Food data

- [Food dataset](https://github.com/harishchaudhary-dev/smart-food-recommender/blob/master/food.csv): `food.csv`

### Other components

- **Web user**
- **CLI user**

## Connections

- Web user → Streamlit dashboard: sets preferences
- CLI user → CLI runner: answers prompts
- Streamlit dashboard → Food dataset: loads
- CLI runner → Food dataset: loads
- Streamlit dashboard → Web feature preprocessing: fits features
- CLI runner → CLI feature preprocessing: fits features
- Streamlit dashboard → Web query profiling: profiles query
- CLI runner → CLI query profiling: profiles query
- Web query profiling → Web feature preprocessing: transforms query
- CLI query profiling → CLI feature preprocessing: transforms query
- Streamlit dashboard → Web k-NN search: fits model
- CLI runner → CLI k-NN search: fits model
- Streamlit dashboard → Web k-NN search: searches neighbors
- CLI runner → CLI k-NN search: searches neighbors
- Web k-NN search → Recommendation cards: returns indices
- CLI k-NN search → Printed recommendations: returns indices
- Food dataset → Recommendation cards: provides food rows
- Food dataset → Printed recommendations: provides food rows
