# sivadhulipala1999/sheetsimplify_with_rag architecture

> Architecture diagram of the GitHub repository sivadhulipala1999/sheetsimplify_with_rag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sivadhulipala1999/sheetsimplify_with_rag
- Repository: https://github.com/sivadhulipala1999/sheetsimplify_with_rag

## Overview

Based on our analysis of the provided file tree and README, “SheetSimplify with RAG LLMs” is a production-grade machine learning project aimed at enabling natural language querying on Excel sheets using Retrieval-Augmented Generation (RAG) with large language models (LLMs). It incorporates several key components—a backend API built with Flask, core ML/model logic for data preparation and RAG-based querying, and a Streamlit frontend for user interaction—all packaged to be deployable via Docker.

##### Main Components
- API Component: Represented by the “api” directory, which contains the Flask application (app.py) exposing endpoints such as the homepage ("/") and the summary endpoint ("/v1/summary"). This component acts as the interface for external requests.
- Model Component: This is the core processing module located under “model”. It includes various functionalities such as data preparation (dataprep.py), LLM invocation (llm.py), alternate functions, and configuration (see the “model/dev” folder with properties.json). These modules form the backbone of the RAG implementation.
- Frontend Component (Streamlit): Housed within the “streamlit” directory and offering an interactive UI via streamlit_app.py. This allows users to interact with the API/model in a user-friendly manner.
- Infrastructure & Deployment: Files like Dockerfile, setup.py, requirements.txt, and .gitignore indicate that the project is containerized and adheres to a production ML project template.

##### Relationships and Interactions
- Optionally, include a containerization layer (Docker) showing that all these components are packaged into a single deployable unit.

##### Architectural Patterns and Design Principles
- Modularization: The separation of concerns (API, Model, Frontend) clearly indicates a modular, layered architecture improving maintainability.
- Microservice-Like Interaction: Even though the project is contained in one repository, the clear boundaries between interfacing layers (Flask API, Streamlit app, and core model) mimic microservice interactions.

##### Additional Encouragement for Detailed Capturing
- Notes to highlight that installing the project via pip and executing modules from the project root are essential steps for proper inter-component communication.
- Don’t hesitate to include minor components if they clarify dependencies or data flows; the goal is to capture as many essential architectural elements as possible for clarity.

## Diagram (Mermaid)

```mermaid
graph TD
    A("User Query"):::user

    subgraph "Containerized Deployment (Docker)"
        direction TB
        B("Streamlit UI"):::frontend
        C("Flask API"):::backend
        subgraph "ML Model"
            direction TB
            D("Data Preparation"):::model
            E("LLM & RAG Engine"):::model
            F("Alternate Functions"):::model
            G("Reference Snippets"):::model
            H("Configuration"):::model
        end
        subgraph "Deployment Files"
            direction TB
            M1("Dockerfile"):::infra
            M2("setup.py"):::infra
            M3("requirements.txt"):::infra
            M4(".gitignore"):::infra
        end
    end

    subgraph "Development & Experimentation"
        direction TB
        J("RAG LLM Learning Notebook"):::notebook
        K("RAG LLM v2 Notebook"):::notebook
    end

    L("Excel Data Source"):::data

    %% Data flow connections
    A --> B
    B --> C
    C --> D
    C --> E
    D --> E
    E --> C
    C --> B
    L --> D

    %% Click Events
    click C "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/api/app.py"
    click D "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/model/dataprep.py"
    click E "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/model/llm.py"
    click F "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/model/alternate_functions.py"
    click G "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/model/reference_codesnippets.py"
    click H "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/model/dev/properties.json"
    click B "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/streamlit/streamlit_app.py"
    click J "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/notebooks/rag_llm_learning.ipynb"
    click K "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/notebooks/rag_llm_v2.ipynb"
    click M1 "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/tree/main/Dockerfile"
    click M2 "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/setup.py"
    click M3 "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/requirements.txt"
    click M4 "https://github.com/sivadhulipala1999/sheetsimplify_with_rag/blob/main/.gitignore"

    %% Styles
    classDef user fill:#FDFD96,stroke:#333,stroke-width:2px;
    classDef frontend fill:#ACE1AF,stroke:#333,stroke-width:2px;
    classDef backend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef model fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef infra fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef notebook fill:#E6E6FA,stroke:#333,stroke-width:2px;
    classDef data fill:#FFB6C1,stroke:#333,stroke-width:2px;
```
