# rohit318/unstructured-rag architecture

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

## Overview

This is a Streamlit unstructured-document RAG application. Its evidenced workflow is model creation, upload dispatch, file extraction/chunking and enrichment, then graph storage; users can browse model records and manage stored content. The home page describes query retrieval and LLM answers, but `utils/chat_model.py` is empty in the supplied source, so that documented capability is shown without inferred internal wiring. Source excerpts are partial, so omitted links may exist.

Main entry points: [`utils/data_model.py`](https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model.py) (Upload and model view), [`utils/data_model_creation.py`](https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model_creation.py) (Model records), [`utils/neo4j_ingestion.py`](https://github.com/rohit318/unstructured-rag/blob/main/utils/neo4j_ingestion.py) (Graph persistence), [`index.py`](https://github.com/rohit318/unstructured-rag/blob/main/index.py) (Page navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_navigation["Page navigation<br/>[index.py]"]
  node_upload_ui["Upload and model view<br/>[data_model.py]"]
  node_home["Home overview<br/>[home.py]"]
  node_chat["Chat assistant<br/>[chat_model.py]"]
end

subgraph group_ingest["Ingestion"]
  node_ingestion["Upload dispatcher"]
  node_pipeline["File processing<br/>[data_pipeline.py]"]
  node_image_analysis["Image analysis<br/>[img_to_txt.py]"]
end

subgraph group_management["Model management"]
  node_sidebar["Model sidebar"]
  node_details["Model details"]
  node_model_records["Model records"]
end

subgraph group_storage["Persistence"]
  node_graph_access["Graph persistence<br/>[neo4j_ingestion.py]"]
  node_neo4j[("Neo4j graph")]
  node_artifact_files[("Image and table files")]
end

node_user(("User"))

node_user -->|"opens app"| node_navigation
node_navigation -->|"dispatches"| node_home
node_navigation -->|"dispatches"| node_upload_ui
node_navigation -->|"dispatches"| node_chat
node_user -->|"uploads files"| node_upload_ui
node_upload_ui -->|"renders"| node_sidebar
node_upload_ui -->|"renders"| node_details
node_upload_ui -->|"submits files"| node_ingestion
node_upload_ui -->|"records submission"| node_model_records
node_ingestion -->|"dispatches files"| node_pipeline
node_pipeline -->|"enriches images"| node_image_analysis
node_pipeline -->|"stores elements"| node_graph_access
node_graph_access -->|"reads and writes"| node_neo4j
node_graph_access -->|"tracks file paths"| node_artifact_files
node_model_records -->|"updates model metadata"| node_neo4j
node_model_records -->|"manages artifacts"| node_artifact_files
node_sidebar -->|"reads records"| node_model_records
node_sidebar -->|"lists models"| node_graph_access
node_details -->|"reads and edits"| node_model_records
node_details -->|"adds files"| node_ingestion
node_details -->|"reads counts"| node_graph_access
node_user -.->|"asks questions"| node_chat

click node_navigation "https://github.com/rohit318/unstructured-rag/blob/main/index.py"
click node_upload_ui "https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model.py"
click node_home "https://github.com/rohit318/unstructured-rag/blob/main/utils/home.py"
click node_chat "https://github.com/rohit318/unstructured-rag/blob/main/utils/chat_model.py"
click node_sidebar "https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model_sidebar.py"
click node_details "https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model_details.py"
click node_ingestion "https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model_ingestion.py"
click node_pipeline "https://github.com/rohit318/unstructured-rag/blob/main/utils/data_pipeline.py"
click node_image_analysis "https://github.com/rohit318/unstructured-rag/blob/main/utils/img_to_txt.py"
click node_graph_access "https://github.com/rohit318/unstructured-rag/blob/main/utils/neo4j_ingestion.py"
click node_model_records "https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model_creation.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_navigation,node_upload_ui,node_home,node_chat,node_user toneBlue
class node_ingestion,node_pipeline,node_image_analysis toneAmber
class node_sidebar,node_details,node_model_records toneMint
class node_graph_access,node_neo4j,node_artifact_files toneRose
```

## Components

### User interface

- [Page navigation](https://github.com/rohit318/unstructured-rag/blob/main/index.py): `index.py`
- [Upload and model view](https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model.py): `utils/data_model.py`
- [Home overview](https://github.com/rohit318/unstructured-rag/blob/main/utils/home.py): `utils/home.py`
- [Chat assistant](https://github.com/rohit318/unstructured-rag/blob/main/utils/chat_model.py): `utils/chat_model.py`

### Ingestion

- [Upload dispatcher](https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model_ingestion.py): `utils/data_model_ingestion.py`
- [File processing](https://github.com/rohit318/unstructured-rag/blob/main/utils/data_pipeline.py): `utils/data_pipeline.py`
- [Image analysis](https://github.com/rohit318/unstructured-rag/blob/main/utils/img_to_txt.py): `utils/img_to_txt.py`

### Model management

- [Model sidebar](https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model_sidebar.py): `utils/data_model_sidebar.py`
- [Model details](https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model_details.py): `utils/data_model_details.py`
- [Model records](https://github.com/rohit318/unstructured-rag/blob/main/utils/data_model_creation.py): `utils/data_model_creation.py`

### Persistence

- [Graph persistence](https://github.com/rohit318/unstructured-rag/blob/main/utils/neo4j_ingestion.py): `utils/neo4j_ingestion.py`
- **Neo4j graph**
- **Image and table files**

### Other components

- **User**

## Connections

- User → Page navigation: opens app
- Page navigation → Home overview: dispatches
- Page navigation → Upload and model view: dispatches
- Page navigation → Chat assistant: dispatches
- User → Upload and model view: uploads files
- Upload and model view → Model sidebar: renders
- Upload and model view → Model details: renders
- Upload and model view → Upload dispatcher: submits files
- Upload and model view → Model records: records submission
- Upload dispatcher → File processing: dispatches files
- File processing → Image analysis: enriches images
- File processing → Graph persistence: stores elements
- Graph persistence → Neo4j graph: reads and writes
- Graph persistence → Image and table files: tracks file paths
- Model records → Neo4j graph: updates model metadata
- Model records → Image and table files: manages artifacts
- Model sidebar → Model records: reads records
- Model sidebar → Graph persistence: lists models
- Model details → Model records: reads and edits
- Model details → Upload dispatcher: adds files
- Model details → Graph persistence: reads counts
- User → Chat assistant: asks questions
