# kans23-cloud/rag_based_environmental_recommendation_system architecture

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

- Interactive diagram: https://gitdiagram.com/kans23-cloud/rag_based_environmental_recommendation_system
- Repository: https://github.com/kans23-cloud/rag_based_environmental_recommendation_system

## Overview

This is a Streamlit assistant for personalized CO₂-reduction recommendations. A user submits an activity query; the app calls the recommendation agent, which retrieves relevant activity emissions from Chroma and uses an Ollama language model to produce recommendations. Separately, `src/vector_store.py` turns the CSV dataset into embedded documents and stores them in Chroma; the sampled files do not show this preparation step being invoked by the app. The graph reflects those visible relationships; the README is empty.

Main entry points: [`src/agent.py`](https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/src/agent.py) (Recommendation agent), [`src/vector_store.py`](https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/src/vector_store.py) (Vector-store builder), [`app.py`](https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/app.py) (Streamlit app), [`data/dataset.csv`](https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/data/dataset.csv) (Activity dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_streamlit_app["Streamlit app<br/>[app.py]"]
end

subgraph group_recommendations["Recommendation runtime"]
  node_agent["Recommendation agent<br/>[agent.py]"]
  node_query_embeddings["Query embeddings<br/>[agent.py]"]
  node_ollama["Ollama LLM"]
end

subgraph group_knowledge["Emissions knowledge"]
  node_dataset["Activity dataset<br/>[dataset.csv]"]
  node_vector_builder["Vector-store builder<br/>[vector_store.py]"]
  node_chroma[("Chroma collection")]
end

node_user(("User"))

node_user -->|"submits query"| node_streamlit_app
node_streamlit_app -->|"requests recommendations"| node_agent
node_agent -->|"configures encoder"| node_query_embeddings
node_agent -->|"retrieves context"| node_chroma
node_agent -->|"generates answer"| node_ollama
node_vector_builder -->|"reads rows"| node_dataset
node_vector_builder -->|"upserts documents"| node_chroma

click node_streamlit_app "https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/app.py"
click node_agent "https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/src/agent.py"
click node_query_embeddings "https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/src/agent.py"
click node_dataset "https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/data/dataset.csv"
click node_vector_builder "https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/src/vector_store.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_streamlit_app,node_user toneBlue
class node_agent,node_query_embeddings,node_ollama toneAmber
class node_dataset,node_vector_builder,node_chroma toneMint
```

## Components

### User interface

- [Streamlit app](https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/app.py): `app.py`

### Recommendation runtime

- [Recommendation agent](https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/src/agent.py): `src/agent.py`
- [Query embeddings](https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/src/agent.py): `src/agent.py`
- **Ollama LLM**

### Emissions knowledge

- [Activity dataset](https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/data/dataset.csv): `data/dataset.csv`
- [Vector-store builder](https://github.com/kans23-cloud/rag_based_environmental_recommendation_system/blob/main/src/vector_store.py): `src/vector_store.py`
- **Chroma collection**

### Other components

- **User**

## Connections

- User → Streamlit app: submits query (evidence: `app.py`)
- Streamlit app → Recommendation agent: requests recommendations (evidence: `app.py`)
- Recommendation agent → Query embeddings: configures encoder (evidence: `src/agent.py`)
- Recommendation agent → Chroma collection: retrieves context (evidence: `src/agent.py`)
- Recommendation agent → Ollama LLM: generates answer (evidence: `src/agent.py`)
- Vector-store builder → Activity dataset: reads rows (evidence: `src/vector_store.py`)
- Vector-store builder → Chroma collection: upserts documents (evidence: `src/vector_store.py`)
