# thuylt185411/web_lor_tracy architecture

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

- Interactive diagram: https://gitdiagram.com/thuylt185411/web_lor_tracy
- Repository: https://github.com/thuylt185411/web_lor_tracy

## Overview

##### Main Components

A. Frontend Layer:
- Streamlit Web Interface
- User Input Components (File uploads, text inputs)
- Results Display Components
- Interactive Elements

B. Backend Services:
- File Processing Service
- Data Conversion Service
- YouGlish Integration Service
- PDF Processing Service

C. Data Storage:
- Redis Database
- File Storage System
- Temporary Storage for Processing

**[Client Layer] → [Application Layer] → [Data Layer]**

##### Specific Components and Flows

A. File Processing Flow:
**[File Upload] → [File Processor] → [Format Converter] → [Download Handler]**

B. YouGlish Integration Flow:
**[Search Input] → [YouGlish Service] → [YouTube API] → [Results Display]**

C. Data Storage Flow:
**[Processing Services] ↔ [Redis Cache] ↔ [File Storage]**

##### Important Elements to Highlight

a) Core Features:
- TXT to CSV Conversion Pipeline
- B1 File Processing System
- YouGlish Search Integration
- PDF Processing Tools

b) Data Flow Directions:
- User Input Flows
- Processing Flows
- Storage Flows
- Output Flows

##### Technical Details

- Python 3.10 Runtime
- Streamlit Framework
- Redis Database
- File Storage System
- External API Connections

##### Architectural Patterns to Emphasize

- Service-Oriented Architecture
- Event-Driven Processing
- Caching Strategy
- File Processing Pipeline

##### Error handling paths

- Diamonds for decision points
- Clear labels for all components

Remember to maintain a balance between detail and clarity, focusing on the core architectural components while avoiding excessive implementation details.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI[Streamlit Web Interface]
        Upload[File Upload Component]
        Search[Search Component]
        Results[Results Display]
    end

    subgraph Processing
        FP[File Processing Service]
        DC[Data Conversion Service]
        YG[YouGlish Integration]
        PP[PDF Processing]
        B64[Base64 Processing]
        AP[Audio Processing]
    end

    subgraph Storage
        RD[(Redis Database)]
        FS[File Storage]
        TS[Temporary Storage]
    end

    %% Client Layer Connections
    UI --> Upload
    UI --> Search
    UI --> Results

    %% Processing Layer Connections
    Upload --> FP
    FP --> DC
    Search --> YG
    FP --> PP
    FP --> B64
    B64 --> AP

    %% Storage Layer Connections
    DC --> RD
    DC --> FS
    YG --> FS
    PP --> TS
    AP --> FS

    %% Results Flow
    DC --> Results
    YG --> Results
    PP --> Results
    AP --> Results

    %% Styling
    classDef frontend fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef processing fill:#90EE90,stroke:#333,stroke-width:2px
    classDef storage fill:#FFB6C1,stroke:#333,stroke-width:2px

    class UI,Upload,Search,Results frontend
    class FP,DC,YG,PP,B64,AP processing
    class RD,FS,TS storage

    %% Click Events
    click UI "https://github.com/Thuylt185411/web_lor_tracy/blob/main/web/app.py"
    click FP "https://github.com/Thuylt185411/web_lor_tracy/blob/main/web/backend.py"
    click RD "https://github.com/Thuylt185411/web_lor_tracy/blob/main/web/data/crawl_db.py"
    click FS "https://github.com/Thuylt185411/web_lor_tracy/tree/main/web/data/"
    click DC "https://github.com/Thuylt185411/web_lor_tracy/blob/main/web/txt_to_csv.ipynb"
    click B64 "https://github.com/Thuylt185411/web_lor_tracy/tree/main/web/base64/"
    click AP "https://github.com/Thuylt185411/web_lor_tracy/blob/main/web/base64/output_audio.mp3"
    click YG "https://github.com/Thuylt185411/web_lor_tracy/blob/main/web/data/youglish_data.csv"
```
