# anjishnu-mukherjee/arethos architecture

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

- Interactive diagram: https://gitdiagram.com/anjishnu-mukherjee/arethos
- Repository: https://github.com/anjishnu-mukherjee/arethos

## Overview

1. Frontend (react-app): A React.js application that serves the user interface. It includes components like the landing page, upload screen, and BlobStorage integration, with configurations (Tailwind, PostCSS) and standard React files.

2. Backend (arethos-back): A Python-based API and AI logic hosted using Azure Functions. It includes the main function_app.py, configuration files (host.json), and a utilities folder containing modules for blob storage operations, image analysis, embedding generation, question parsing, and PDF evaluation.

##### Main Components
- Frontend: Represent the React app as one component. Emphasize its role as the client interface which interacts with users, manages file uploads, and calls backend endpoints. Components like LandingPage, UploadScreen, and BlobStorage should be highlighted.
- Backend: Represent the Python API (hosted as Azure Functions) that processes requests. This includes:
- The core function (function_app.py) that likely orchestrates request handling.
- The various utility modules (e.g., blob_storage, embedding, imageAnalysis, parse_question, pdf_eval) that encapsulate the business logic.
- External Services: Clearly mark the integration with external dependencies:
- Google Gemini API for grading.
- Pinecone Vector Database.
- Azure Storage (as referenced by environment variables and usage in blob_storage utilities).

##### Out Relationships and Data Flow
- Google Gemini API (for processing and grading assessments).
- Pinecone (for handling vector storage and retrieval).
- Azure Storage (for storing and retrieving files or blobs).

##### Architectural Patterns and Components
- Since it’s a full-stack application, clearly denote the separation between the UI (React) and the business/AI logic (Python Azure Functions) as the primary division.
- That the backend follows a modular design by breaking out different functionalities into utility modules (e.g., image analysis, embedding generation) which helps in adhering to separation of concerns.
- Optionally, incorporate symbols or annotations to indicate that asynchronous processing or external API communication is happening in the backend.

##### Relevant Technologies and Frameworks
- For the Frontend: React.js, Tailwind CSS, and supporting libraries from package.json.
- For the Backend: Python 3.10+, Azure Functions (indicated by host.json and function_app.py), and dependencies listed in requirements.txt.
- External technology labels: Google Gemini API, Pinecone, and Azure components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        F_R["React Frontend (FlipBit UI)"]:::frontend
        Landing["LandingPage (UI)"]:::frontend
        Upload["UploadScreen (UI)"]:::frontend
        Blob["BlobStorage (UI)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        B["Python Azure Functions Backend"]:::backend
        Function["function_app.py"]:::backend
        Util_blob["Blob Storage Utility"]:::backend
        Util_embed["Embedding Utility"]:::backend
        Util_img["Image Analysis Utility"]:::backend
        Util_parse["Question Parsing Utility"]:::backend
        Util_pdf["PDF Evaluation Utility"]:::backend
    end

    %% External Services
    subgraph "External Services"
        Gemini["Google Gemini API"]:::external
        Pinecone["Pinecone Vector DB"]:::external
        AzureStrg["Azure Storage"]:::external
    end

    %% Connections from Frontend to Backend
    F_R -->|"APICall"| B
    Upload -->|"APICall"| B
    Blob -->|"APICall"| B

    %% Backend orchestration
    B -->|"orchestrates"| Function
    Function -->|"calls"| Util_blob
    Function -->|"calls"| Util_embed
    Function -->|"calls"| Util_img
    Function -->|"calls"| Util_parse
    Function -->|"calls"| Util_pdf

    %% Connections from Backend to External Services
    Function -->|"calls"| Gemini
    Function -->|"calls"| Pinecone
    Function -->|"calls"| AzureStrg
    Util_blob -->|"stores"| AzureStrg

    %% Click Events for Frontend Components
    click F_R "https://github.com/anjishnu-mukherjee/arethos/tree/main/react-app/"
    click Landing "https://github.com/anjishnu-mukherjee/arethos/blob/main/react-app/src/LandingPage.jsx"
    click Upload "https://github.com/anjishnu-mukherjee/arethos/blob/main/react-app/src/UploadScreen.jsx"
    click Blob "https://github.com/anjishnu-mukherjee/arethos/blob/main/react-app/src/BlobStorage.js"

    %% Click Events for Backend Components
    click B "https://github.com/anjishnu-mukherjee/arethos/tree/main/arethos-back/"
    click Function "https://github.com/anjishnu-mukherjee/arethos/blob/main/arethos-back/function_app.py"
    click Util_blob "https://github.com/anjishnu-mukherjee/arethos/blob/main/arethos-back/utils/blob_storage.py"
    click Util_embed "https://github.com/anjishnu-mukherjee/arethos/blob/main/arethos-back/utils/embedding.py"
    click Util_img "https://github.com/anjishnu-mukherjee/arethos/blob/main/arethos-back/utils/imageAnalysis.py"
    click Util_parse "https://github.com/anjishnu-mukherjee/arethos/blob/main/arethos-back/utils/parse_question.py"
    click Util_pdf "https://github.com/anjishnu-mukherjee/arethos/blob/main/arethos-back/utils/pdf_eval.py"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef backend fill:#c8e6c9,stroke:#1b5e20,stroke-width:2px;
    classDef external fill:#ffe0b2,stroke:#e65100,stroke-width:2px;
```
