# haswinai/recommendation-and-negotiation architecture

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

- Interactive diagram: https://gitdiagram.com/haswinai/recommendation-and-negotiation
- Repository: https://github.com/haswinai/recommendation-and-negotiation

## Overview

##### Main Components

A. Frontend Layer:
- Web Interface (HTML/CSS/JavaScript)
- User Interaction Components:
- Analysis Section
- Negotiation Interface
- Post-Call Summary View

B. Backend Layer (Flask Application):
- Main Application Server (app.py)
- Integration Services:
- GROQ API Integration (groq_integration2.py)
- Google Sheets Integration (google_sheets_util.py)
- Data Processing Components:
- Text Recognition System
- Mutual Funds Dataset Handler

C. External Services:
- GROQ API (LLM Service)
- Google Sheets API (Data Storage)
- OAuth2 Authentication Service

**[Client Tier] → [Application Tier] → [External Services Tier]**

##### Component Relationships to Highlight

A. Data Flow Paths:
- User Interface → Flask Server → GROQ API
- → Google Sheets

B. Authentication Flow:
- App → OAuth2 → Google Services

C. Processing Pipeline:
- Input → Text Recognition → LLM Processing → Recommendations

##### Technical Details to Note

- HTTP/HTTPS endpoints
- API integration points
- Data persistence locations
- Authentication checkpoints
- Load balancing points (if any)

##### Specific Implementation Notes

- Real-time processing capabilities
- Integration with LLM services
- Data storage mechanisms
- Security implementation
- User interaction flows

Remember to:
- Use consistent styling
- Version information
- Notes for critical components
- System boundaries

## 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 external fill:#f1c40f,stroke:#f39c12,color:black
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white
    classDef storage fill:#9b59b6,stroke:#8e44ad,color:white

    %% Frontend Layer
    subgraph Frontend
        UI["Web Interface"]
        CSS["Static CSS"]
        JS["Static JS"]
        Analysis["Analysis Section"]
        Negotiation["Negotiation Interface"]
        Summary["Post-Call Summary View"]
    end

    %% Backend Layer
    subgraph Backend
        Server["Main Application Server"]
        GROQ["GROQ Integration Service"]
        Sheets["Google Sheets Integration"]
        TextRec["Text Recognition System"]
        MFData["Mutual Funds Dataset Handler"]
    end

    %% External Services
    subgraph External
        GROQAPI["GROQ API"]
        GSheetsAPI["Google Sheets API"]
        OAuth["OAuth2 Service"]
    end

    %% Relationships
    UI --> Server
    CSS --> UI
    JS --> UI
    Analysis --> Server
    Negotiation --> Server
    Summary --> Server

    Server --> GROQ
    Server --> Sheets
    Server --> TextRec
    Server --> MFData

    GROQ --> GROQAPI
    Sheets --> GSheetsAPI
    Sheets --> OAuth
    GSheetsAPI --> OAuth

    %% Storage Connections
    TextRec --> MFData
    MFData --> Sheets

    %% Styling
    class UI,CSS,JS,Analysis,Negotiation,Summary frontend
    class Server,GROQ,Sheets,TextRec,MFData backend
    class GROQAPI,GSheetsAPI external
    class OAuth auth

    %% Click Events
    click UI "https://github.com/HaswinAI/Recommendation-and-negotiation/blob/main/templates/index.html"
    click CSS "https://github.com/HaswinAI/Recommendation-and-negotiation/blob/main/static/style.css"
    click JS "https://github.com/HaswinAI/Recommendation-and-negotiation/blob/main/static/script.js"
    click Server "https://github.com/HaswinAI/Recommendation-and-negotiation/blob/main/app.py"
    click GROQ "https://github.com/HaswinAI/Recommendation-and-negotiation/blob/main/groq_integration2.py"
    click Sheets "https://github.com/HaswinAI/Recommendation-and-negotiation/blob/main/google_sheets_util.py"
    click TextRec "https://github.com/HaswinAI/Recommendation-and-negotiation/blob/main/recognized_text.txt"
    click MFData "https://github.com/HaswinAI/Recommendation-and-negotiation/blob/main/mutual_funds_dataset.csv"
    click Summary "https://github.com/HaswinAI/Recommendation-and-negotiation/blob/main/post_call_summary.txt"
```
