# arjun1372000/edgerag architecture

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

- Interactive diagram: https://gitdiagram.com/arjun1372000/edgerag
- Repository: https://github.com/arjun1372000/edgerag

## Overview

EdgeRAG is a local predictive-maintenance application: an operator submits machine sensor readings, receives a condition and fault assessment, and gets a maintenance report grounded in retrieved procedures. The separate corpus-ingestion path loads and chunks the maintenance documents into a persistent vector store used during analysis. The supplied tree omits the imported predictor implementation and configured data directory, so their internal behavior and the sample-data path are not mapped; the predictor is shown only as a dependency of the condition builder.

Main entry points: [`docs`](https://github.com/arjun1372000/edgerag/tree/master/docs) (Maintenance corpus), [`api/main.py`](https://github.com/arjun1372000/edgerag/blob/master/api/main.py) (FastAPI service), [`frontend/script.js`](https://github.com/arjun1372000/edgerag/blob/master/frontend/script.js) (Web interface), [`src/ingestion/indexer.py`](https://github.com/arjun1372000/edgerag/blob/master/src/ingestion/indexer.py) (Chunk and index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Operator interface"]
  node_frontend["Web interface<br/>[script.js]"]
  node_api["FastAPI service<br/>[main.py]"]
end

subgraph group_analysis["Condition analysis"]
  node_condition["Condition builder"]
  node_predictor["Predictive model"]
end

subgraph group_knowledge["Maintenance knowledge"]
  node_ingest["Corpus ingestion<br/>[ingest.py]"]
  node_loader["Document loader<br/>[loader.py]"]
  node_indexer["Chunk and index<br/>[indexer.py]"]
  node_corpus["Maintenance corpus"]
  node_sops["Failure procedures"]
  node_diagnostics["Diagnostics guides"]
  node_safety["Safety guidance"]
  node_maintenance["Maintenance guides"]
  node_restart["Restart procedures"]
  node_embeddings["Ollama embeddings"]
  node_vectorstore[("Chroma vector store")]
  node_retriever["Evidence retriever<br/>[retriever.py]"]
end

subgraph group_reporting["Evidence and reporting"]
  node_generator["Report generator<br/>[generator.py]"]
  node_llm["Ollama language model"]
  node_report["Maintenance report<br/>[main.py]"]
end

node_operator(("Operator"))

node_operator -->|"enters readings"| node_frontend
node_frontend -->|"submits analysis"| node_api
node_api -->|"analyzes sensors"| node_condition
node_condition -->|"predicts faults"| node_predictor
node_api -->|"requests evidence"| node_retriever
node_api -->|"supplies condition and evidence"| node_generator
node_generator -->|"generates report"| node_llm
node_api -->|"returns report and evidence"| node_report
node_frontend -->|"renders results"| node_operator
node_ingest -->|"loads documents"| node_loader
node_loader -->|"reads files"| node_corpus
node_corpus -->|"includes"| node_sops
node_corpus -->|"includes"| node_diagnostics
node_corpus -->|"includes"| node_safety
node_corpus -->|"includes"| node_maintenance
node_corpus -->|"includes"| node_restart
node_ingest -->|"chunks and indexes"| node_indexer
node_indexer -->|"creates vectors"| node_embeddings
node_indexer -->|"stores chunks"| node_vectorstore
node_retriever -->|"embeds queries"| node_embeddings
node_retriever -->|"searches vectors"| node_vectorstore

click node_frontend "https://github.com/arjun1372000/edgerag/blob/master/frontend/script.js"
click node_api "https://github.com/arjun1372000/edgerag/blob/master/api/main.py"
click node_condition "https://github.com/arjun1372000/edgerag/blob/master/src/pipeline/machine_condition.py"
click node_predictor "https://github.com/arjun1372000/edgerag/tree/master/src"
click node_ingest "https://github.com/arjun1372000/edgerag/blob/master/src/ingestion/ingest.py"
click node_loader "https://github.com/arjun1372000/edgerag/blob/master/src/ingestion/loader.py"
click node_indexer "https://github.com/arjun1372000/edgerag/blob/master/src/ingestion/indexer.py"
click node_corpus "https://github.com/arjun1372000/edgerag/tree/master/docs"
click node_sops "https://github.com/arjun1372000/edgerag/tree/master/docs/sops"
click node_diagnostics "https://github.com/arjun1372000/edgerag/tree/master/docs/diagnostics"
click node_safety "https://github.com/arjun1372000/edgerag/tree/master/docs/safety"
click node_maintenance "https://github.com/arjun1372000/edgerag/tree/master/docs/maintenance"
click node_restart "https://github.com/arjun1372000/edgerag/tree/master/docs/restart"
click node_retriever "https://github.com/arjun1372000/edgerag/blob/master/src/retrieval/retriever.py"
click node_generator "https://github.com/arjun1372000/edgerag/blob/master/src/generation/generator.py"
click node_report "https://github.com/arjun1372000/edgerag/blob/master/api/main.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_frontend,node_api toneBlue
class node_condition,node_predictor toneAmber
class node_ingest,node_loader,node_indexer,node_corpus,node_sops,node_diagnostics,node_safety,node_maintenance,node_restart,node_embeddings,node_vectorstore,node_retriever toneMint
class node_generator,node_llm,node_report toneRose
class node_operator toneIndigo
```

## Components

### Operator interface

- [Web interface](https://github.com/arjun1372000/edgerag/blob/master/frontend/script.js): `frontend/script.js`
- [FastAPI service](https://github.com/arjun1372000/edgerag/blob/master/api/main.py): `api/main.py`

### Condition analysis

- [Condition builder](https://github.com/arjun1372000/edgerag/blob/master/src/pipeline/machine_condition.py): `src/pipeline/machine_condition.py`
- [Predictive model](https://github.com/arjun1372000/edgerag/tree/master/src): `src`

### Maintenance knowledge

- [Corpus ingestion](https://github.com/arjun1372000/edgerag/blob/master/src/ingestion/ingest.py): `src/ingestion/ingest.py`
- [Document loader](https://github.com/arjun1372000/edgerag/blob/master/src/ingestion/loader.py): `src/ingestion/loader.py`
- [Chunk and index](https://github.com/arjun1372000/edgerag/blob/master/src/ingestion/indexer.py): `src/ingestion/indexer.py`
- [Maintenance corpus](https://github.com/arjun1372000/edgerag/tree/master/docs): `docs`
- [Failure procedures](https://github.com/arjun1372000/edgerag/tree/master/docs/sops): `docs/sops`
- [Diagnostics guides](https://github.com/arjun1372000/edgerag/tree/master/docs/diagnostics): `docs/diagnostics`
- [Safety guidance](https://github.com/arjun1372000/edgerag/tree/master/docs/safety): `docs/safety`
- [Maintenance guides](https://github.com/arjun1372000/edgerag/tree/master/docs/maintenance): `docs/maintenance`
- [Restart procedures](https://github.com/arjun1372000/edgerag/tree/master/docs/restart): `docs/restart`
- **Ollama embeddings**
- **Chroma vector store**
- [Evidence retriever](https://github.com/arjun1372000/edgerag/blob/master/src/retrieval/retriever.py): `src/retrieval/retriever.py`

### Evidence and reporting

- [Report generator](https://github.com/arjun1372000/edgerag/blob/master/src/generation/generator.py): `src/generation/generator.py`
- **Ollama language model**
- [Maintenance report](https://github.com/arjun1372000/edgerag/blob/master/api/main.py): `api/main.py`

### Other components

- **Operator**

## Connections

- Operator → Web interface: enters readings
- Web interface → FastAPI service: submits analysis
- FastAPI service → Condition builder: analyzes sensors
- Condition builder → Predictive model: predicts faults
- FastAPI service → Evidence retriever: requests evidence
- FastAPI service → Report generator: supplies condition and evidence
- Report generator → Ollama language model: generates report
- FastAPI service → Maintenance report: returns report and evidence
- Web interface → Operator: renders results
- Corpus ingestion → Document loader: loads documents
- Document loader → Maintenance corpus: reads files
- Maintenance corpus → Failure procedures: includes
- Maintenance corpus → Diagnostics guides: includes
- Maintenance corpus → Safety guidance: includes
- Maintenance corpus → Maintenance guides: includes
- Maintenance corpus → Restart procedures: includes
- Corpus ingestion → Chunk and index: chunks and indexes
- Chunk and index → Ollama embeddings: creates vectors
- Chunk and index → Chroma vector store: stores chunks
- Evidence retriever → Ollama embeddings: embeds queries
- Evidence retriever → Chroma vector store: searches vectors
