# ramasamy-24-t/precision-farming-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/ramasamy-24-t/precision-farming-assistant
- Repository: https://github.com/ramasamy-24-t/precision-farming-assistant

## Overview

Agricultural RAG Assistant ingests agricultural PDFs into a persistent vector store, then answers crop-advisory questions using multi-query retrieval and GPT-generated responses. Users can query through the notebook chat loop or the Flask REST API; the documented API also provides a health check. All application components are implemented in RAG.ipynb. Relationships below follow the README’s architecture and feature descriptions; no notebook source excerpts were available to verify finer control flow.

Main entry points: [`RAG.ipynb`](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb) (Query Paraphrases)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["PDF Ingestion"]
  node_partition["PDF Partitioning<br/>[RAG.ipynb]"]
  node_chunking["Title Chunking<br/>[RAG.ipynb]"]
  node_enrichment["Chunk Summaries<br/>[RAG.ipynb]"]
  node_embedding["Text Embeddings<br/>[RAG.ipynb]"]
end

subgraph group_knowledge["Knowledge Store"]
  node_chroma[("ChromaDB Store<br/>[RAG.ipynb]")]
end

subgraph group_answering["Answering"]
  node_paraphrases["Query Paraphrases<br/>[RAG.ipynb]"]
  node_rrf["RRF Retrieval<br/>[RAG.ipynb]"]
  node_generation["Answer Generation<br/>[RAG.ipynb]"]
  node_history["Conversation History<br/>[RAG.ipynb]"]
end

subgraph group_interfaces["User Interfaces"]
  node_chat["Notebook Chat<br/>[RAG.ipynb]"]
  node_api["Flask API<br/>[RAG.ipynb]"]
  node_health["Health Check<br/>[RAG.ipynb]"]
end

node_pdfs["Agricultural PDFs"]
node_openai["OpenAI API"]
node_query(("Question"))
node_client(("API Client"))

node_pdfs -->|"provides documents"| node_partition
node_partition -->|"partitions into elements"| node_chunking
node_chunking -->|"creates chunks"| node_enrichment
node_enrichment -->|"requests summaries"| node_openai
node_enrichment -->|"enriches chunks"| node_embedding
node_embedding -->|"requests embeddings"| node_openai
node_embedding -->|"stores vectors"| node_chroma
node_query -->|"provides question"| node_paraphrases
node_paraphrases -->|"generates queries"| node_openai
node_paraphrases -->|"supplies query variants"| node_rrf
node_rrf -->|"searches vectors"| node_chroma
node_rrf -->|"provides retrieved context"| node_generation
node_generation -->|"generates answer"| node_openai
node_history -->|"supports multi-turn chat"| node_chat
node_query -->|"asks question"| node_chat
node_chat -->|"runs retrieval"| node_paraphrases
node_generation -->|"returns answer"| node_chat
node_client -->|"sends question"| node_api
node_api -->|"runs retrieval"| node_paraphrases
node_generation -->|"returns answer"| node_api
node_client -->|"checks status"| node_health

click node_partition "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_chunking "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_enrichment "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_embedding "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_chroma "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_paraphrases "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_rrf "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_generation "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_history "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_chat "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_api "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"
click node_health "https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb"

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_partition,node_chunking,node_enrichment,node_embedding,node_client toneBlue
class node_chroma toneAmber
class node_paraphrases,node_rrf,node_generation,node_history,node_openai toneMint
class node_chat,node_api,node_health toneRose
class node_pdfs,node_query toneIndigo
```

## Components

### PDF Ingestion

- [PDF Partitioning](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`
- [Title Chunking](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`
- [Chunk Summaries](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`
- [Text Embeddings](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`

### Knowledge Store

- [ChromaDB Store](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`

### Answering

- [Query Paraphrases](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`
- [RRF Retrieval](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`
- [Answer Generation](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`
- [Conversation History](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`

### User Interfaces

- [Notebook Chat](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`
- [Flask API](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`
- [Health Check](https://github.com/ramasamy-24-t/precision-farming-assistant/blob/main/RAG.ipynb): `RAG.ipynb`

### Other components

- **Agricultural PDFs**
- **OpenAI API**
- **Question**
- **API Client**

## Connections

- Agricultural PDFs → PDF Partitioning: provides documents (evidence: `README.md`)
- PDF Partitioning → Title Chunking: partitions into elements (evidence: `README.md`)
- Title Chunking → Chunk Summaries: creates chunks (evidence: `README.md`)
- Chunk Summaries → OpenAI API: requests summaries (evidence: `README.md`)
- Chunk Summaries → Text Embeddings: enriches chunks (evidence: `README.md`)
- Text Embeddings → OpenAI API: requests embeddings (evidence: `README.md`)
- Text Embeddings → ChromaDB Store: stores vectors (evidence: `README.md`)
- Question → Query Paraphrases: provides question (evidence: `README.md`)
- Query Paraphrases → OpenAI API: generates queries (evidence: `README.md`)
- Query Paraphrases → RRF Retrieval: supplies query variants (evidence: `README.md`)
- RRF Retrieval → ChromaDB Store: searches vectors (evidence: `README.md`)
- RRF Retrieval → Answer Generation: provides retrieved context (evidence: `README.md`)
- Answer Generation → OpenAI API: generates answer (evidence: `README.md`)
- Conversation History → Notebook Chat: supports multi-turn chat (evidence: `README.md`)
- Question → Notebook Chat: asks question (evidence: `README.md`)
- Notebook Chat → Query Paraphrases: runs retrieval (evidence: `README.md`)
- Answer Generation → Notebook Chat: returns answer (evidence: `README.md`)
- API Client → Flask API: sends question (evidence: `README.md`)
- Flask API → Query Paraphrases: runs retrieval (evidence: `README.md`)
- Answer Generation → Flask API: returns answer (evidence: `README.md`)
- API Client → Health Check: checks status (evidence: `README.md`)
