# vijayalakshmiburidi-cloud/nutri_mcdonald architecture

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

- Interactive diagram: https://gitdiagram.com/vijayalakshmiburidi-cloud/nutri_mcdonald
- Repository: https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald

## Overview

This is a McDonald’s India nutrition assistant: users ask about menu items, nutrition, and recommendations through a Gradio chat interface; the agent applies scope checks, resolves follow-ups using isolated session history, routes questions to SQL and/or semantic retrieval, and returns an answer. The data workflow cleans the menu dataset and loads it into relational and vector stores. The graph also shows the documented Ngrok access and session logging. Relationships follow the excerpts and README; unshown implementation details are omitted.

Main entry points: [`core/orchestrator.py`](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/orchestrator.py) (Agent Orchestrator), [`data_pipeline/load_databases.py`](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/data_pipeline/load_databases.py) (Database Loader), [`config/settings.py`](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/config/settings.py) (Clients and Settings), [`main_UI.py`](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/main_UI.py) (Gradio Chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_chat["Gradio Chat<br/>[main_UI.py]"]
  node_tunnel["HTTPS Tunnel<br/>[main_UI.py]"]
end

subgraph group_agent["Agent Workflow"]
  node_agent_entry["Agent Orchestrator<br/>[orchestrator.py]"]
  node_scope["Scope Guardrail<br/>[orchestrator.py]"]
  node_memory["Follow-up Memory<br/>[memory.py]"]
  node_router["Keyword Router<br/>[router.py]"]
end

subgraph group_knowledge["Menu Knowledge"]
  node_sql_tool["SQL Tool<br/>[sql_engine.py]"]
  node_rag_tool["RAG Tool<br/>[rag_engine.py]"]
  node_raw_menu["Raw Menu Dataset<br/>[India_Menu.csv]"]
  node_cleaner["Dataset Cleaner<br/>[clean_dataset.py]"]
  node_clean_menu["Clean Menu Dataset"]
  node_loader["Database Loader<br/>[load_databases.py]"]
  node_mysql[("MySQL Menu Table")]
  node_vectors[("Chroma Collection")]
end

subgraph group_platform["Shared Services"]
  node_settings["Clients and Settings<br/>[settings.py]"]
  node_groq["Groq API"]
  node_session_logs["Session Logs<br/>[orchestrator.py]"]
end

node_user(("Chat User"))

node_user -->|"asks"| node_chat
node_chat -->|"calls"| node_agent_entry
node_chat -->|"exposes through"| node_tunnel
node_agent_entry -->|"checks scope"| node_scope
node_agent_entry -->|"routes with"| node_router
node_agent_entry -->|"resolves follow-ups"| node_memory
node_agent_entry -->|"calls"| node_sql_tool
node_agent_entry -->|"calls"| node_rag_tool
node_agent_entry -->|"writes turns"| node_session_logs
node_sql_tool -->|"queries"| node_mysql
node_rag_tool -->|"retrieves context"| node_vectors
node_raw_menu -->|"input to"| node_cleaner
node_cleaner -->|"writes"| node_clean_menu
node_loader -->|"reads"| node_clean_menu
node_loader -->|"loads table"| node_mysql
node_loader -->|"builds index"| node_vectors
node_settings -->|"configures client"| node_mysql
node_settings -->|"opens collection"| node_vectors
node_settings -->|"creates client"| node_groq
node_sql_tool -->|"generates SQL with"| node_groq
node_rag_tool -->|"generates answer with"| node_groq
node_memory -->|"resolves with"| node_groq

click node_chat "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/main_UI.py"
click node_tunnel "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/main_UI.py"
click node_agent_entry "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/orchestrator.py"
click node_scope "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/orchestrator.py"
click node_memory "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/memory.py"
click node_router "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/router.py"
click node_sql_tool "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/tools/sql_engine.py"
click node_rag_tool "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/tools/rag_engine.py"
click node_raw_menu "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/data_pipeline/India_Menu.csv"
click node_cleaner "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/data_pipeline/clean_dataset.py"
click node_clean_menu "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/data_pipeline/India_Menu_Clean.csv"
click node_loader "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/data_pipeline/load_databases.py"
click node_settings "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/config/settings.py"
click node_session_logs "https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/orchestrator.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_chat,node_tunnel,node_user toneBlue
class node_agent_entry,node_scope,node_memory,node_router toneAmber
class node_sql_tool,node_rag_tool,node_raw_menu,node_cleaner,node_clean_menu,node_loader,node_mysql,node_vectors toneMint
class node_settings,node_groq,node_session_logs toneRose
```

## Components

### User Interface

- [Gradio Chat](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/main_UI.py): `main_UI.py`
- [HTTPS Tunnel](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/main_UI.py): `main_UI.py`

### Agent Workflow

- [Agent Orchestrator](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/orchestrator.py): `core/orchestrator.py`
- [Scope Guardrail](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/orchestrator.py): `core/orchestrator.py`
- [Follow-up Memory](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/memory.py): `core/memory.py`
- [Keyword Router](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/router.py): `core/router.py`

### Menu Knowledge

- [SQL Tool](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/tools/sql_engine.py): `tools/sql_engine.py`
- [RAG Tool](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/tools/rag_engine.py): `tools/rag_engine.py`
- [Raw Menu Dataset](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/data_pipeline/India_Menu.csv): `data_pipeline/India_Menu.csv`
- [Dataset Cleaner](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/data_pipeline/clean_dataset.py): `data_pipeline/clean_dataset.py`
- [Clean Menu Dataset](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/data_pipeline/India_Menu_Clean.csv): `data_pipeline/India_Menu_Clean.csv`
- [Database Loader](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/data_pipeline/load_databases.py): `data_pipeline/load_databases.py`
- **MySQL Menu Table**
- **Chroma Collection**

### Shared Services

- [Clients and Settings](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/config/settings.py): `config/settings.py`
- **Groq API**
- [Session Logs](https://github.com/vijayalakshmiburidi-cloud/nutri_mcdonald/blob/main/core/orchestrator.py): `core/orchestrator.py`

### Other components

- **Chat User**

## Connections

- Chat User → Gradio Chat: asks (evidence: `main_UI.py`)
- Gradio Chat → Agent Orchestrator: calls (evidence: `main_UI.py`)
- Gradio Chat → HTTPS Tunnel: exposes through (evidence: `main_UI.py`)
- Agent Orchestrator → Scope Guardrail: checks scope (evidence: `core/orchestrator.py`)
- Agent Orchestrator → Keyword Router: routes with (evidence: `core/orchestrator.py`)
- Agent Orchestrator → Follow-up Memory: resolves follow-ups (evidence: `core/orchestrator.py`)
- Agent Orchestrator → SQL Tool: calls (evidence: `core/orchestrator.py`)
- Agent Orchestrator → RAG Tool: calls (evidence: `core/orchestrator.py`)
- Agent Orchestrator → Session Logs: writes turns (evidence: `core/orchestrator.py`)
- SQL Tool → MySQL Menu Table: queries (evidence: `tools/sql_engine.py`)
- RAG Tool → Chroma Collection: retrieves context (evidence: `tools/rag_engine.py`)
- Raw Menu Dataset → Dataset Cleaner: input to (evidence: `data_pipeline/clean_dataset.py`)
- Dataset Cleaner → Clean Menu Dataset: writes (evidence: `data_pipeline/clean_dataset.py`)
- Database Loader → Clean Menu Dataset: reads (evidence: `data_pipeline/load_databases.py`)
- Database Loader → MySQL Menu Table: loads table (evidence: `data_pipeline/load_databases.py`)
- Database Loader → Chroma Collection: builds index (evidence: `data_pipeline/load_databases.py`)
- Clients and Settings → MySQL Menu Table: configures client (evidence: `config/settings.py`)
- Clients and Settings → Chroma Collection: opens collection (evidence: `config/settings.py`)
- Clients and Settings → Groq API: creates client (evidence: `config/settings.py`)
- SQL Tool → Groq API: generates SQL with (evidence: `tools/sql_engine.py`)
- RAG Tool → Groq API: generates answer with (evidence: `tools/rag_engine.py`)
- Follow-up Memory → Groq API: resolves with (evidence: `core/memory.py`)
