# bnovik0v/company_search_rag architecture

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

- Interactive diagram: https://gitdiagram.com/bnovik0v/company_search_rag
- Repository: https://github.com/bnovik0v/company_search_rag

## Overview

##### Main Components

a. Frontend Layer:
- Streamlit Web Interface (Primary user interaction point)
- Filter Controls Component
- Search Interface Component
- Results Display Component

b. Application Layer:
- Python Backend (app.py)
- Authentication Module (password protection)
- Data Processing Module

c. External Services:
- Pinecone Vector Database Service

d. Data Storage:
- Local CSV Data Store (data/sample_with_descriptions.csv)

e. Container Infrastructure:
- Docker Container
- Docker Compose Environment

##### Component Relationships and Flow

- User → Streamlit Interface
- Streamlit Interface → Authentication Module (for protected searches)
- Streamlit Interface → Data Processing Module
- Data Processing Module → Local CSV Data Store
- Data Processing Module → Pinecone Service
- Pinecone Service → Results → Streamlit Interface

##### Additional Elements

a. Environment Variables Section:
- PINECONE_API_KEY
- PINECONE_INDEX_NAME
- APP_PASSWORD

b. Port Mapping:
- Container Port 8501 → Host Port 8501

##### Key Architectural Patterns to Highlight

- Containerized Application Pattern
- External Service Integration Pattern
- Protected API Pattern (password authentication)
- Data Processing Pipeline Pattern

##### Technical Stack Callouts

- Streamlit (Web Framework)
- Python (Backend Language)
- Pinecone (Vector Database)
- Docker (Containerization)
- CSV (Data Storage)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef container fill:none,stroke:#95a5a6,stroke-width:2px
    classDef env fill:#e74c3c,stroke:#c0392b,color:white

    %% Container boundary
    subgraph DockerContainer
        %% Frontend Layer
        subgraph FrontendLayer
            UI[Streamlit Web Interface]:::frontend
            FC[Filter Controls]:::frontend
            SI[Search Interface]:::frontend
            RD[Results Display]:::frontend
        end

        %% Application Layer
        subgraph ApplicationLayer
            BE[Python Backend]:::backend
            AUTH[Authentication Module]:::backend
            DPM[Data Processing Module]:::backend
        end

        %% Data Storage
        CSV[(Local CSV Store)]:::storage

        %% Environment Variables
        subgraph EnvVars
            ENV1[PINECONE_API_KEY]:::env
            ENV2[PINECONE_INDEX_NAME]:::env
            ENV3[APP_PASSWORD]:::env
        end
    end

    %% External Services
    PINE[(Pinecone Vector DB)]:::external

    %% Relationships
    UI --> AUTH
    UI --> FC
    UI --> SI
    UI --> RD
    FC --> BE
    SI --> BE
    BE --> AUTH
    BE --> DPM
    DPM --> CSV
    DPM --> PINE
    PINE --> RD

    %% Component Mappings with Click Events
    click UI "https://github.com/bnovik0v/company_search_rag/blob/main/app.py"
    click CSV "https://github.com/bnovik0v/company_search_rag/blob/main/data/sample_with_descriptions.csv"
    click DockerContainer "https://github.com/bnovik0v/company_search_rag/blob/main/docker-compose.yml"
    click DockerContainer "https://github.com/bnovik0v/company_search_rag/tree/main/Dockerfile"
    click BE "https://github.com/bnovik0v/company_search_rag/blob/main/requirements.txt"
    click DockerContainer "https://github.com/bnovik0v/company_search_rag/blob/main/.dockerignore"
    click DockerContainer "https://github.com/bnovik0v/company_search_rag/blob/main/.gitignore"

    %% Legend
    subgraph Legend
        L1[Frontend Components]:::frontend
        L2[Backend Components]:::backend
        L3[(Storage Components)]:::storage
        L4[(External Services)]:::external
        L5[Environment Variables]:::env
    end
```
