# eyelevelai/groundx-on-prem architecture

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

- Interactive diagram: https://gitdiagram.com/eyelevelai/groundx-on-prem
- Repository: https://github.com/eyelevelai/groundx-on-prem

## Overview

##### High-Level Components (Top Layer)
a. Client Interface Layer (Load Balancer & API Gateway)
b. Core Services Layer (Processing Pipeline)
c. Infrastructure Services Layer (Data Storage & Message Queue)

##### Core Processing Components (Middle Layer)
- Document Ingestion Pipeline:
- Upload Service
- Pre-process Service
- Process Service
- Layout Service (with OCR and Inference sub-components)
- Queue Service
- Search & Ranking Pipeline:
- Summary Service (with API and Inference sub-components)
- Ranker Service (with API and Inference sub-components)
- GroundX Service
- Layout Webhook Service

##### Infrastructure Services (Bottom Layer)
- Redis Cache (for temporary storage)
- MySQL Database (for persistent storage)
- Kafka (message streaming)
- OpenSearch (search engine)
- MinIO (file storage)
- Neo4j (graph database)

##### Node Groups (Infrastructure Layer)
Compute resource allocation using distinct zones:
- eyelevel-cpu-only
- eyelevel-cpu-memory
- eyelevel-gpu-layout
- eyelevel-gpu-ranker
- eyelevel-gpu-summary

##### Connections and Data Flow
- Resource allocation (dash-dot lines)

##### Kubernetes Components
Essential K8s elements:
- Node pools
- Service accounts
- Role bindings
- Deployments
- Services

##### Additional Elements
- Resource requirements for each node group
- Scaling configurations
- GPU requirements for specific services

Key Considerations:

##### Infrastructure Details
- AWS EKS cluster boundaries
- VPC configuration
- Availability zones
- Security group boundaries

##### High-level architecture overview

This will provide a complete picture of the system while maintaining clarity and usefulness for different audiences and purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef api fill:#6495ED,stroke:#333,stroke-width:2px
    classDef processing fill:#90EE90,stroke:#333,stroke-width:2px
    classDef storage fill:#FFD700,stroke:#333,stroke-width:2px
    classDef infra fill:#FF6B6B,stroke:#333,stroke-width:2px
    classDef gpu fill:#DDA0DD,stroke:#333,stroke-width:2px
    
    %% Client Interface Layer
    subgraph ClientLayer
        LB[Load Balancer]
    end
    click LB "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/load-balancer/load-balancer/helm_chart"

    %% Core Services Layer
    subgraph CoreServices
        %% Document Ingestion Pipeline
        Upload[Upload Service]
        PreProcess[Pre-process Service]
        Process[Process Service]
        Queue[Queue Service]
        
        %% Layout Services
        subgraph LayoutServices
            Layout[Layout Service]
            LayoutOCR[Layout OCR]
            LayoutInf[Layout Inference]
            LayoutAPI[Layout API]
            LayoutWH[Layout Webhook]
        end
        
        %% Search & Ranking Pipeline
        subgraph SearchRanking
            Summary[Summary Service]
            SummaryAPI[Summary API]
            SummaryInf[Summary Inference]
            
            Ranker[Ranker Service]
            RankerAPI[Ranker API]
            RankerInf[Ranker Inference]
            
            GroundX[GroundX Service]
        end
    end

    %% Infrastructure Services Layer
    subgraph InfraServices
        Redis[(Redis Cache)]
        MySQL[(MySQL DB)]
        Kafka{Kafka Stream}
        OpenSearch[(OpenSearch)]
        MinIO[(MinIO Storage)]
        Neo4j[(Neo4j Graph)]
    end

    %% Node Groups
    subgraph NodeGroups
        CPU[eyelevel-cpu-only]
        CPUMEM[eyelevel-cpu-memory]
        GPUL[eyelevel-gpu-layout]
        GPUR[eyelevel-gpu-ranker]
        GPUS[eyelevel-gpu-summary]
    end

    %% Component Mappings
    click Upload "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/upload/helm_chart"
    click PreProcess "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/pre-process/helm_chart"
    click Process "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/process/helm_chart"
    click Layout "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/layout"
    click Queue "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/queue/helm_chart"
    click Summary "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/summary"
    click Ranker "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/ranker"
    click GroundX "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/groundx/helm_chart"
    click LayoutWH "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/layout-webhook/helm_chart"
    click Redis "https://github.com/eyelevelai/groundx-on-prem/tree/main/operator/services/cache"
    click MySQL "https://github.com/eyelevelai/groundx-on-prem/tree/main/operator/services/db"
    click Kafka "https://github.com/eyelevelai/groundx-on-prem/tree/main/operator/services/stream"
    click OpenSearch "https://github.com/eyelevelai/groundx-on-prem/tree/main/operator/services/search"
    click MinIO "https://github.com/eyelevelai/groundx-on-prem/tree/main/operator/services/file"
    click Neo4j "https://github.com/eyelevelai/groundx-on-prem/tree/main/operator/services/graph"
    click LayoutOCR "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/layout/ocr"
    click LayoutInf "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/layout/inference"
    click SummaryInf "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/summary/inference"
    click RankerInf "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/ranker/inference"
    click LayoutAPI "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/layout/api"
    click SummaryAPI "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/summary/api"
    click RankerAPI "https://github.com/eyelevelai/groundx-on-prem/tree/main/modules/ranker/api"

    %% Connections
    LB --> Upload
    Upload --> PreProcess
    PreProcess --> Process
    Process --> Layout
    Layout --> LayoutOCR
    Layout --> LayoutInf
    Layout --> LayoutAPI
    Layout -.-> LayoutWH
    Process --> Queue
    Queue --> Summary
    Summary --> SummaryAPI
    Summary --> SummaryInf
    Queue --> Ranker
    Ranker --> RankerAPI
    Ranker --> RankerInf
    Queue --> GroundX

    %% Infrastructure Connections
    Upload -.-> MinIO
    Process -.-> Redis
    Queue -.-> Kafka
    Summary -.-> OpenSearch
    Ranker -.-> Neo4j
    GroundX -.-> MySQL

    %% Node Group Assignments
    Layout --- GPUL
    Ranker --- GPUR
    Summary --- GPUS
    Upload --- CPU
    Process --- CPUMEM

    %% Style Applications
    class LB api
    class Upload,PreProcess,Process,Queue processing
    class Layout,LayoutOCR,LayoutInf,LayoutAPI gpu
    class Summary,SummaryAPI,SummaryInf gpu
    class Ranker,RankerAPI,RankerInf gpu
    class GroundX processing
    class Redis,MySQL,OpenSearch,MinIO,Neo4j storage
    class Kafka infra
    class CPU,CPUMEM,GPUL,GPUR,GPUS infra
```
