# ralo93/customeranalyticsdashboard architecture

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

- Interactive diagram: https://gitdiagram.com/ralo93/customeranalyticsdashboard
- Repository: https://github.com/ralo93/customeranalyticsdashboard

## Overview

##### Project type and purpose
- This is a full-stack, microservices-based data processing and visualization platform (“Customer Conversation Analytics”).
- It ingests raw text snippets, extracts features, classifies them via AI, stores all results, caches for quick access, and presents an interactive dashboard.

##### File structure
- Top-level folders and files:
- data/ – raw JSON knowledgebase files
- images/ – static assets
- main.py – entry script (likely ties into honcho Procfile)
- docker-compose.yml & Procfile – orchestration configs
- ml_insights_system/ – root for all microservices
◦ api_gateway/ – Nginx + Python REST API
◦ dashboard_service/ – Streamlit dashboard
◦ db_service/ – handles PostgreSQL operations & models
◦ feature_service/ – extracts features from sentences
◦ queue_service/ – abstracts RabbitMQ enqueue logic
◦ worker_service/ – consumes queue, calls OpenAI, writes back
- tests/ – EDA scripts, ingestion scripts, unit tests for each service

##### README for additional insights
- Architecture described as flowchart: User → API Gateway → Feature Extractor + Queue Service + DB Service → RabbitMQ → Worker → OpenAI → DB → Redis → Dashboard
- Tech stack: Python 3.12, Nginx, Poetry, Streamlit, OpenAI API, PostgreSQL, RabbitMQ, RESTful API, Docker
- Emphasis on microservices, fast iterations, cheap scalable MVP

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Actors and External
    User["User"]:::user
    OpenAI["OpenAI API"]:::external

    %% Orchestration
    Orchestrator["Docker Compose & Procfile"]:::orchestrator

    %% Microservices Layer
    subgraph "Microservices" 
        direction TB
        APIGateway["API Gateway"]:::service
        FeatureService["Feature Service"]:::service
        QueueService["Queue Service"]:::service
        WorkerService["Worker Service"]:::service
        DBService["DB Service"]:::service
        DashboardService["Dashboard Service"]:::service
    end

    %% Data Stores and Broker
    RabbitMQ["RabbitMQ"]:::broker
    Postgres["PostgreSQL"]:::database
    Redis["Redis Cache"]:::cache

    %% Flow Connections
    User -->|HTTP Request| APIGateway
    APIGateway -->|HTTP POST sentences| FeatureService
    APIGateway -->|HTTP POST raw data| DBService
    APIGateway -->|AMQP enqueue| QueueService
    QueueService -->|AMQP publish| RabbitMQ
    FeatureService -->|HTTP POST features| DBService
    RabbitMQ -->|AMQP subscribe| WorkerService
    WorkerService -->|HTTP call| OpenAI
    WorkerService -->|HTTP POST labels&embeddings| DBService
    DBService -->|SQL operations| Postgres
    Postgres -->|Replication/cache warming| Redis
    DashboardService -->|Read| Redis
    DashboardService -->|UI| User

    %% Orchestration link
    Orchestrator --> APIGateway
    Orchestrator --> FeatureService
    Orchestrator --> QueueService
    Orchestrator --> WorkerService
    Orchestrator --> DBService
    Orchestrator --> DashboardService

    %% Click Events
    click APIGateway "https://github.com/ralo93/customeranalyticsdashboard/blob/origin/ml_insights_system/api_gateway/src/api_gateway/app.py"
    click FeatureService "https://github.com/ralo93/customeranalyticsdashboard/blob/origin/ml_insights_system/feature_service/src/feature_service/service.py"
    click QueueService "https://github.com/ralo93/customeranalyticsdashboard/blob/origin/ml_insights_system/queue_service/src/queue_service/service.py"
    click WorkerService "https://github.com/ralo93/customeranalyticsdashboard/blob/origin/ml_insights_system/worker_service/src/worker_service/worker.py"
    click DBService "https://github.com/ralo93/customeranalyticsdashboard/blob/origin/ml_insights_system/db_service/src/db_service/service.py"
    click DashboardService "https://github.com/ralo93/customeranalyticsdashboard/blob/origin/ml_insights_system/dashboard_service/src/dashboard_service/app.py"
    click Orchestrator "https://github.com/ralo93/customeranalyticsdashboard/blob/origin/docker-compose.yml"

    %% Styles
    classDef service fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef database fill:#E2F0D9,stroke:#2E7D32,stroke-width:1px
    classDef cache fill:#E2F0D9,stroke:#2E7D32,stroke-width:1px
    classDef broker fill:#FFF4E5,stroke:#FF8C00,stroke-width:1px
    classDef external fill:#F3E5F5,stroke:#6A1B9A,stroke-width:1px
    classDef user fill:#FFEBEE,stroke:#C62828,stroke-width:1px
    classDef orchestrator fill:#ECEFF1,stroke:#455A64,stroke-width:1px
```
