# aryankb/e_saarthi architecture

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

- Interactive diagram: https://gitdiagram.com/aryankb/e_saarthi
- Repository: https://github.com/aryankb/e_saarthi

## Overview

- User → Frontend → Route Handlers → Services
- Services → Database → Frontend → User

- Complaint Submission → Translation Service
- Translated Text → BERT Model
- Location Data → Geographical Analysis
- Results → Frontend Display

- BERT Model → Spam Classification
- Geographical Data → Map Visualization

##### Technical Details to Highlight

- BERT model integration for spam detection
- Bilingual support (Hindi/English)
- Geographical data processing
- Real-time complaint analysis

##### Architectural Patterns

- MVC pattern implementation
- Service-oriented architecture
- Data processing pipeline
- AI model integration

##### Data Storage Layer

Use clear spacing and grouping to show related components, and include annotations for important features like spam detection, language translation, and geographical analysis capabilities.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface Layer"
        UI_Web[Web Browser]
        ComplaintForm["Complaint Form"]:::frontend
        DashView["Dashboard View"]:::frontend
        StatusView["Status View"]:::frontend
        GeoView["Geographical Analysis View"]:::frontend
    end

    subgraph "Application Layer"
        Flask["Flask Server"]:::backend
        Routes["Route Handlers"]:::backend
        Static["Static Assets"]:::frontend
    end

    subgraph "Service Layer"
        TransService["Translation Service"]:::service
        SpamService["Spam Detection Service"]:::service
        GeoService["Geographical Analysis Engine"]:::service
        ExtServices["External Services"]:::service
    end

    subgraph "AI/ML Layer"
        BERT["BERT Model"]:::ai
        SpamModel["Spam Detection Model"]:::ai
        ModelArtifacts["Model Artifacts"]:::storage
    end

    subgraph "Data Storage Layer"
        MySQL[(MySQL Database)]:::storage
        LocationData["Location Data CSV"]:::storage
        MasterData["Master Data CSV"]:::storage
        HistoricalData["Historical Complaints"]:::storage
    end

    %% Connections
    UI_Web --> ComplaintForm & DashView & StatusView & GeoView
    ComplaintForm & DashView & StatusView & GeoView --> Flask
    Flask --> Routes
    Routes --> TransService & SpamService & GeoService
    TransService & SpamService --> BERT
    GeoService --> LocationData
    BERT --> SpamModel
    SpamModel --> ModelArtifacts
    Routes --> MySQL
    MySQL --> Routes

    %% External Service Connections
    ExtServices --> TransService
    ExtServices --> GeoService

    %% Click Events
    click ComplaintForm "https://github.com/Aryankb/E_Saarthi/blob/master/templates/complain.html"
    click DashView "https://github.com/Aryankb/E_Saarthi/blob/master/templates/dashboard.html"
    click StatusView "https://github.com/Aryankb/E_Saarthi/blob/master/templates/show_status.html"
    click Static "https://github.com/Aryankb/E_Saarthi/tree/master/static/"
    click Flask "https://github.com/Aryankb/E_Saarthi/blob/master/application.py"
    click SpamModel "https://github.com/Aryankb/E_Saarthi/tree/master/models/aryan_spam_detector/"
    click ModelArtifacts "https://github.com/Aryankb/E_Saarthi/blob/master/models/aryan_spam_detector/model.safetensors"
    click LocationData "https://github.com/Aryankb/E_Saarthi/blob/master/dataset/gram_panchayat.csv"
    click MasterData "https://github.com/Aryankb/E_Saarthi/blob/master/dataset/mas_aavedan.csv"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef service fill:#e74c3c,stroke:#c0392b,color:white
    classDef ai fill:#9b59b6,stroke:#8e44ad,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        Service["Service Component"]:::service
        AI["AI/ML Component"]:::ai
        Storage["Storage Component"]:::storage
    end
```
