# amirlayegh/procurement-ai-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/amirlayegh/procurement-ai-assistant
- Repository: https://github.com/amirlayegh/procurement-ai-assistant

## Overview

Procurement AI Assistant lets retail buyers search a product catalog in natural language and evaluate results using cost, margin, supplier reliability, return, sales, and revenue signals. The primary path is buyer query through a frontend to a backend search executor, which interprets the query, applies semantic and numeric/categorical criteria, and returns product results. The repository also includes a Streamlit interface and dashboard analytics. Backend wiring is supported by sampled source; frontend-to-API behavior and some documented capabilities are not shown in the excerpts.

Main entry points: [`superlinked_app/app.py`](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/app.py) (Search API Runtime), [`superlinked_app/query.py`](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/query.py) (Query Definition), [`frontend/src/app/(main_app_layout)/page.tsx`](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/app/(main_app_layout)/page.tsx) (Next.js Search UI), [`frontend/src/components/search/results-list.tsx`](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/components/search/results-list.tsx) (Product Results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Buyer Interfaces"]
  node_next_ui["Next.js Search UI<br/>[page.tsx]"]
  node_search_bar["Search Bar<br/>[search-bar.tsx]"]
  node_filters["Search Filters"]
  node_results["Product Results<br/>[results-list.tsx]"]
  node_product_card["Product Card<br/>[product-card.tsx]"]
  node_dashboard["Analytics Dashboard<br/>[page.tsx]"]
  node_streamlit["Streamlit Interface<br/>[app.py]"]
end

subgraph group_backend["Backend Runtime"]
  node_api_runtime["Search API Runtime<br/>[app.py]"]
  node_product_ingest["Product Ingestion<br/>[app.py]"]
  node_settings["Runtime Settings<br/>[configs.py]"]
end

subgraph group_search["Search &amp; Ranking"]
  node_query_definition["Query Definition<br/>[query.py]"]
  node_natural_language["Query Interpretation<br/>[nlq.py]"]
  node_search_index["Semantic &amp; Metric Index<br/>[index.py]"]
end

subgraph group_catalog["Catalog &amp; Storage"]
  node_product_schema["Product Schema<br/>[schema.py]"]
  node_csv_catalog["Product CSV"]
  node_vector_store[("Vector Store")]
end

node_buyer(("Retail Buyer"))
node_qdrant[("Qdrant")]

node_buyer -->|"searches"| node_next_ui
node_buyer -->|"searches"| node_streamlit
node_next_ui -.->|"submits queries"| node_api_runtime
node_streamlit -.->|"uses backend"| node_api_runtime
node_search_bar -.->|"captures query"| node_next_ui
node_filters -.->|"sets criteria"| node_next_ui
node_api_runtime -->|"registers sources"| node_product_ingest
node_api_runtime -->|"registers query"| node_query_definition
node_api_runtime -->|"registers index"| node_search_index
node_product_ingest -->|"parses products"| node_product_schema
node_product_ingest -->|"loads CSV"| node_csv_catalog
node_api_runtime -->|"configures storage"| node_settings
node_api_runtime -->|"selects database"| node_vector_store
node_vector_store -.->|"connects optionally"| node_qdrant
node_query_definition -->|"queries index"| node_search_index
node_query_definition -->|"filters products"| node_product_schema
node_query_definition -->|"uses prompt guidance"| node_natural_language
node_query_definition -->|"reads model config"| node_settings
node_api_runtime -.->|"serves search"| node_vector_store
node_api_runtime -.->|"returns products"| node_results
node_results -->|"renders products"| node_product_card
node_dashboard -.->|"reads analytics"| node_api_runtime

click node_next_ui "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/app/(main_app_layout)/page.tsx"
click node_search_bar "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/components/search/search-bar.tsx"
click node_filters "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/components/filters/filters-panel-content.tsx"
click node_results "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/components/search/results-list.tsx"
click node_product_card "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/components/search/product-card.tsx"
click node_dashboard "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/app/(main_app_layout)/dashboard/page.tsx"
click node_streamlit "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/st_app/app.py"
click node_api_runtime "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/app.py"
click node_product_ingest "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/app.py"
click node_query_definition "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/query.py"
click node_natural_language "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/nlq.py"
click node_search_index "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/index.py"
click node_product_schema "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/schema.py"
click node_settings "https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/configs.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_next_ui,node_search_bar,node_filters,node_results,node_product_card,node_dashboard,node_streamlit toneBlue
class node_api_runtime,node_product_ingest,node_settings,node_qdrant toneAmber
class node_query_definition,node_natural_language,node_search_index toneMint
class node_product_schema,node_csv_catalog,node_vector_store toneRose
class node_buyer toneIndigo
```

## Components

### Buyer Interfaces

- [Next.js Search UI](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/app/(main_app_layout)/page.tsx): `frontend/src/app/(main_app_layout)/page.tsx`
- [Search Bar](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/components/search/search-bar.tsx): `frontend/src/components/search/search-bar.tsx`
- [Search Filters](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/components/filters/filters-panel-content.tsx): `frontend/src/components/filters/filters-panel-content.tsx`
- [Product Results](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/components/search/results-list.tsx): `frontend/src/components/search/results-list.tsx`
- [Product Card](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/components/search/product-card.tsx): `frontend/src/components/search/product-card.tsx`
- [Analytics Dashboard](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/frontend/src/app/(main_app_layout)/dashboard/page.tsx): `frontend/src/app/(main_app_layout)/dashboard/page.tsx`
- [Streamlit Interface](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/st_app/app.py): `st_app/app.py`

### Backend Runtime

- [Search API Runtime](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/app.py): `superlinked_app/app.py`
- [Product Ingestion](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/app.py): `superlinked_app/app.py`
- [Runtime Settings](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/configs.py): `superlinked_app/configs.py`

### Search & Ranking

- [Query Definition](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/query.py): `superlinked_app/query.py`
- [Query Interpretation](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/nlq.py): `superlinked_app/nlq.py`
- [Semantic & Metric Index](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/index.py): `superlinked_app/index.py`

### Catalog & Storage

- [Product Schema](https://github.com/amirlayegh/procurement-ai-assistant/blob/master/superlinked_app/schema.py): `superlinked_app/schema.py`
- **Product CSV**
- **Vector Store**

### Other components

- **Retail Buyer**
- **Qdrant**

## Connections

- Retail Buyer → Next.js Search UI: searches (evidence: `README.md`)
- Retail Buyer → Streamlit Interface: searches (evidence: `README.md`)
- Next.js Search UI → Search API Runtime: submits queries
- Streamlit Interface → Search API Runtime: uses backend (evidence: `README.md`)
- Search Bar → Next.js Search UI: captures query
- Search Filters → Next.js Search UI: sets criteria
- Search API Runtime → Product Ingestion: registers sources (evidence: `superlinked_app/app.py`)
- Search API Runtime → Query Definition: registers query (evidence: `superlinked_app/app.py`)
- Search API Runtime → Semantic & Metric Index: registers index (evidence: `superlinked_app/app.py`)
- Product Ingestion → Product Schema: parses products (evidence: `superlinked_app/app.py`)
- Product Ingestion → Product CSV: loads CSV (evidence: `superlinked_app/app.py`)
- Search API Runtime → Runtime Settings: configures storage (evidence: `superlinked_app/app.py`)
- Search API Runtime → Vector Store: selects database (evidence: `superlinked_app/app.py`)
- Vector Store → Qdrant: connects optionally
- Query Definition → Semantic & Metric Index: queries index (evidence: `superlinked_app/query.py`)
- Query Definition → Product Schema: filters products (evidence: `superlinked_app/query.py`)
- Query Definition → Query Interpretation: uses prompt guidance (evidence: `superlinked_app/query.py`)
- Query Definition → Runtime Settings: reads model config (evidence: `superlinked_app/query.py`)
- Search API Runtime → Vector Store: serves search (evidence: `README.md`)
- Search API Runtime → Product Results: returns products (evidence: `README.md`)
- Product Results → Product Card: renders products (evidence: `frontend/src/components/search/results-list.tsx`)
- Analytics Dashboard → Search API Runtime: reads analytics (evidence: `README.md`)
