# chorockuin/find-books architecture

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

- Interactive diagram: https://gitdiagram.com/chorockuin/find-books
- Repository: https://github.com/chorockuin/find-books

## Overview

##### Main Components

a. User Interface Layer:
- Streamlit Frontend (app.py)
- This as the top-level component that users interact with

b. Core Processing Components:
- Book Management System (book.py)
- Publication Handler (publication.py)
- Web Scraping Engine (webdriver.py)

c. Data Storage:
- CSV Storage (book.csv, paper.csv)
- State Management (state.py, publication_scrap_state.py)

d. Utility Components:

##### Component Relationships

**[User] → [Streamlit Interface (app.py)]**
- ↓
**[Core Processing Layer]**
- → [Book Manager (book.py)]
- → [Publication Handler (publication.py)]
- → [Web Scraper (webdriver.py)]
- ↓
**[Data Layer]**
- → [CSV Storage]
- → [State Management]

##### Specific Elements

a. Main Process Flow:
##### Results display back to user

b. Key Interactions:
- How webdriver.py interfaces with external websites
- How state management maintains application state
- Demonstrate data flow between CSV storage and processing components

##### Technical Notes

Technical aspects:
- Streamlit framework as the primary UI technology
- Web scraping capabilities
- CSV-based data persistence
- State management approach

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef process fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef critical fill:#e74c3c,stroke:#c0392b,color:white

    %% User and Interface Layer
    User((User))
    UI[Streamlit Interface]:::ui
    click UI "https://github.com/chorockuin/find-books/blob/main/app.py"

    %% Core Processing Layer
    subgraph ProcessingLayer["Core Processing Layer"]
        BookMgr[Book Manager]:::process
        PubHandler[Publication Handler]:::process
        WebScraper[Web Scraping Engine]:::process
        click BookMgr "https://github.com/chorockuin/find-books/blob/main/book.py"
        click PubHandler "https://github.com/chorockuin/find-books/blob/main/publication.py"
        click WebScraper "https://github.com/chorockuin/find-books/blob/main/webdriver.py"
    end

    %% Data Storage Layer
    subgraph DataLayer["Data Layer"]
        subgraph Storage["CSV Storage"]
            BookCSV[(Book Data)]:::data
            PaperCSV[(Publication Data)]:::data
            click BookCSV "https://github.com/chorockuin/find-books/blob/main/book.csv"
            click PaperCSV "https://github.com/chorockuin/find-books/blob/main/paper.csv"
        end
        
        subgraph StateManagement["State Management"]
            MainState[Main State]:::data
            PubState[Publication State]:::data
            click MainState "https://github.com/chorockuin/find-books/blob/main/state.py"
            click PubState "https://github.com/chorockuin/find-books/blob/main/publication_scrap_state.py"
        end
        
        ColorDB[(Color Database)]:::data
        click ColorDB "https://github.com/chorockuin/find-books/blob/main/colors_names_db.py"
    end

    %% External Services
    ExternalSites{{"External Websites"}}:::external

    %% Configuration
    Config[("Streamlit Config")]:::data
    click Config "https://github.com/chorockuin/find-books/blob/main/.streamlit/config.toml"

    %% Relationships
    User --> UI
    UI --> ProcessingLayer
    UI --> Config
    
    BookMgr --> Storage
    PubHandler --> Storage
    WebScraper --> ExternalSites
    
    ProcessingLayer --> StateManagement
    ProcessingLayer --> ColorDB
    
    StateManagement --> UI
    Storage --> UI

    %% Legend
    subgraph Legend
        L1[UI Components]:::ui
        L2[Processing Components]:::process
        L3[(Data Storage)]:::data
        L4{{External Services}}:::external
        L5[Critical Components]:::critical
    end
```
