# adarshyadav9/enigma_noman architecture

> Architecture diagram of the GitHub repository adarshyadav9/enigma_noman, 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/adarshyadav9/enigma_noman
- Repository: https://github.com/adarshyadav9/enigma_noman

## Overview

Health Track is a personalized dietary-risk alert app. Users select health conditions, search for a dish or enter ingredients, and review a risk assessment with flagged and safe ingredients, sodium warnings, and hidden-additive alerts. The backend also exposes OCR-based ingredient analysis; the sampled frontend API provides an OCR request function, but no image-upload UI was present in the sampled source. Backend route handling and risk-analysis logic are sampled; some frontend component internals are not.

Main entry points: [`backend/main.py`](https://github.com/adarshyadav9/enigma_noman/blob/main/backend/main.py) (FastAPI routes), [`frontend/components/DishSearch.tsx`](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/components/DishSearch.tsx) (Dish and ingredient entry), [`frontend/services/api.ts`](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/services/api.ts) (API client), [`frontend/app/page.tsx`](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/app/page.tsx) (Home screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web app"]
  node_home["Home screen<br/>[page.tsx]"]
  node_conditions["Condition selector"]
  node_foodentry["Dish and ingredient entry<br/>[DishSearch.tsx]"]
  node_state["User state<br/>[userStore.ts]"]
  node_client["API client<br/>[api.ts]"]
  node_resultpage["Result screen<br/>[page.tsx]"]
  node_riskcard["Risk details<br/>[RiskCard.tsx]"]
end

subgraph group_backend["Analysis backend"]
  node_routes["FastAPI routes<br/>[main.py]"]
  node_riskengine["Risk analysis<br/>[risk_engine.py]"]
end

subgraph group_data["Risk data"]
  node_dishes[("Dish catalog<br/>[indian_dishes.json]")]
  node_conditiondata[("Condition risk rules")]
end

subgraph group_ocr["Image analysis"]
  node_ocrservice["Ingredient extraction<br/>[ocr_service.py]"]
end

node_user(("User"))
node_tesseract["Tesseract OCR"]

node_user -->|"uses"| node_home
node_home -->|"renders"| node_conditions
node_home -->|"renders"| node_foodentry
node_conditions -->|"updates"| node_state
node_foodentry -->|"reads and updates"| node_state
node_foodentry -->|"requests search and analysis"| node_client
node_client -->|"calls HTTP routes"| node_routes
node_routes -->|"reads catalog"| node_dishes
node_routes -->|"requests analysis"| node_riskengine
node_routes -->|"requests extraction"| node_ocrservice
node_riskengine -->|"reads rules"| node_conditiondata
node_ocrservice -->|"extracts image text"| node_tesseract
node_routes -->|"returns results"| node_client
node_client -->|"returns search and analysis data"| node_foodentry
node_resultpage -->|"reads result"| node_state
node_resultpage -->|"renders result"| node_riskcard

click node_home "https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/app/page.tsx"
click node_conditions "https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/components/ConditionSelector.tsx"
click node_foodentry "https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/components/DishSearch.tsx"
click node_state "https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/store/userStore.ts"
click node_client "https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/services/api.ts"
click node_resultpage "https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/app/result/page.tsx"
click node_riskcard "https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/components/RiskCard.tsx"
click node_routes "https://github.com/adarshyadav9/enigma_noman/blob/main/backend/main.py"
click node_riskengine "https://github.com/adarshyadav9/enigma_noman/blob/main/backend/risk_engine.py"
click node_dishes "https://github.com/adarshyadav9/enigma_noman/blob/main/backend/data/indian_dishes.json"
click node_conditiondata "https://github.com/adarshyadav9/enigma_noman/blob/main/backend/data/condition_risks.json"
click node_ocrservice "https://github.com/adarshyadav9/enigma_noman/blob/main/backend/ocr_service.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_home,node_conditions,node_foodentry,node_state,node_client,node_resultpage,node_riskcard,node_user toneBlue
class node_routes,node_riskengine toneAmber
class node_dishes,node_conditiondata toneMint
class node_ocrservice toneRose
class node_tesseract toneIndigo
```

## Components

### Web app

- [Home screen](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Condition selector](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/components/ConditionSelector.tsx): `frontend/components/ConditionSelector.tsx`
- [Dish and ingredient entry](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/components/DishSearch.tsx): `frontend/components/DishSearch.tsx`
- [User state](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/store/userStore.ts): `frontend/store/userStore.ts`
- [API client](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/services/api.ts): `frontend/services/api.ts`
- [Result screen](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/app/result/page.tsx): `frontend/app/result/page.tsx`
- [Risk details](https://github.com/adarshyadav9/enigma_noman/blob/main/frontend/components/RiskCard.tsx): `frontend/components/RiskCard.tsx`

### Analysis backend

- [FastAPI routes](https://github.com/adarshyadav9/enigma_noman/blob/main/backend/main.py): `backend/main.py`
- [Risk analysis](https://github.com/adarshyadav9/enigma_noman/blob/main/backend/risk_engine.py): `backend/risk_engine.py`

### Risk data

- [Dish catalog](https://github.com/adarshyadav9/enigma_noman/blob/main/backend/data/indian_dishes.json): `backend/data/indian_dishes.json`
- [Condition risk rules](https://github.com/adarshyadav9/enigma_noman/blob/main/backend/data/condition_risks.json): `backend/data/condition_risks.json`

### Image analysis

- [Ingredient extraction](https://github.com/adarshyadav9/enigma_noman/blob/main/backend/ocr_service.py): `backend/ocr_service.py`

### Other components

- **User**
- **Tesseract OCR**

## Connections

- User → Home screen: uses
- Home screen → Condition selector: renders
- Home screen → Dish and ingredient entry: renders
- Condition selector → User state: updates
- Dish and ingredient entry → User state: reads and updates
- Dish and ingredient entry → API client: requests search and analysis
- API client → FastAPI routes: calls HTTP routes
- FastAPI routes → Dish catalog: reads catalog
- FastAPI routes → Risk analysis: requests analysis
- FastAPI routes → Ingredient extraction: requests extraction
- Risk analysis → Condition risk rules: reads rules
- Ingredient extraction → Tesseract OCR: extracts image text
- FastAPI routes → API client: returns results
- API client → Dish and ingredient entry: returns search and analysis data
- Result screen → User state: reads result
- Result screen → Risk details: renders result
