# aakash-test7/docx architecture

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

- Interactive diagram: https://gitdiagram.com/aakash-test7/docx
- Repository: https://github.com/aakash-test7/docx

## Overview

##### File structure
- Top-level directories and files:
- .streamlit/ – Streamlit configuration (theme, UI) and secrets (GCP credentials, MySQL credentials, Gemini API key)
- Pages/ – Each Python module is one Streamlit page (Home, Logic, Wizard, Source_Code, Tutorial, Security_Login)
- app.py – The Streamlit multipage app launcher and router
- backend.py – Core business-logic service for PDF extraction, Google Cloud Storage operations, and Gemini API calls
- requirements.txt – Python dependencies (streamlit, pdfplumber, google-cloud, mysql connector, plotting libs, etc.)
- README.md – Project documentation

- Architectural clues: a single monolithic codebase split into UI (Streamlit pages) and a service layer (backend.py). External integrations include GCS, Gemini API, and MySQL (optional).

##### README for additional insights
- Tech stack: Python 3.7+, Streamlit for UI, Google Cloud Storage for file uploads, Google Gemini for LLM summarization, pdfplumber for PDF parsing, MySQL for summary storage.
- Features: interactive visualizations (word frequency, highlights), Q&A engine, drag-and-drop PDF upload.
- Deployment notes: currently on Streamlit Cloud/Railway; secrets stored in .streamlit/secrets.toml.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User["User Browser"]:::external

    %% Frontend: Streamlit Server
    subgraph "Frontend - Streamlit Server"
        direction TB
        App["Streamlit App Launcher (Router)"]:::internal
        subgraph "Pages (UI Layer)"
            direction TB
            Home["Home Page"]:::internal
            Logic["Logic Page"]:::internal
            Wizard["Wizard Page"]:::internal
            SrcCode["Source Code Page"]:::internal
            Tutorial["Tutorial Page"]:::internal
            Security["Security/Login Page"]:::internal
        end
    end

    %% Backend Service Layer
    subgraph "Backend - Business Logic Service"
        direction TB
        BackendCore["Business Logic Service"]:::internal
        subgraph "Backend Components"
            direction TB
            PDFParser["PDF Parser (pdfplumber)"]:::internal
            StorageClient["Storage Client"]:::internal
            APIClient["Gemini API Client"]:::internal
            DBClient["MySQL Client"]:::internal
        end
    end

    %% External Services & Persistence
    GCS["Google Cloud Storage"]:::persistent
    GEMINI["Gemini API"]:::external
    MySQL["MySQL Database"]:::persistent

    %% Configuration & Documentation
    subgraph "Config & Docs"
        direction TB
        Config[".streamlit/config.toml"]:::config
        Requirements["requirements.txt"]:::config
        Readme["README.md"]:::config
    end

    %% Data Flows
    User -->|"Interacts with"| App
    App -->|"Renders pages"| Home
    App -->|"Renders pages"| Logic
    App -->|"Renders pages"| Wizard
    App -->|"Renders pages"| SrcCode
    App -->|"Renders pages"| Tutorial
    App -->|"Renders pages"| Security

    Home -->|"Function call"| BackendCore
    Logic -->|"Function call"| BackendCore
    Wizard -->|"Function call"| BackendCore
    SrcCode -->|"Function call"| BackendCore
    Tutorial -->|"Function call"| BackendCore
    Security -->|"Function call"| BackendCore

    BackendCore -->|"Extract text"| PDFParser
    PDFParser -->|"Parsed text"| BackendCore
    BackendCore -->|"Upload file or summary"| StorageClient
    StorageClient -->|"Stored files"| GCS
    BackendCore -->|"Call LLM"| APIClient
    APIClient -->|"Summary/Q&A"| GEMINI
    BackendCore -->|"Write summary/history"| DBClient
    DBClient -->|"Stored data"| MySQL
    BackendCore -->|"Return data"| App

    %% Click Events
    click App "https://github.com/aakash-test7/docx/blob/main/app.py"
    click Home "https://github.com/aakash-test7/docx/blob/main/Pages/home.py"
    click Logic "https://github.com/aakash-test7/docx/blob/main/Pages/logic.py"
    click Wizard "https://github.com/aakash-test7/docx/blob/main/Pages/wizard.py"
    click SrcCode "https://github.com/aakash-test7/docx/blob/main/Pages/src_code.py"
    click Tutorial "https://github.com/aakash-test7/docx/blob/main/Pages/tutorial.py"
    click Security "https://github.com/aakash-test7/docx/blob/main/Pages/security_login.py"
    click BackendCore "https://github.com/aakash-test7/docx/blob/main/backend.py"
    click Config "https://github.com/aakash-test7/docx/blob/main/.streamlit/config.toml"
    click Requirements "https://github.com/aakash-test7/docx/blob/main/requirements.txt"
    click Readme "https://github.com/aakash-test7/docx/blob/main/README.md"

    %% Styles
    classDef internal fill:#D6E5FF,stroke:#4A6FA5,stroke-width:1px
    classDef persistent fill:#D6FFD6,stroke:#4A6F4A,stroke-width:1px
    classDef external fill:#FFE5B4,stroke:#A55A1A,stroke-width:1px
    classDef config fill:#E0E0E0,stroke:#888888,stroke-width:1px
```
