# alexchen666/goodreads-summariser architecture

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

- Interactive diagram: https://gitdiagram.com/alexchen666/goodreads-summariser
- Repository: https://github.com/alexchen666/goodreads-summariser

## Overview

##### Main Components
- User Interface/Input Component: Although there isn’t a full web UI, the user interaction happens by copying the book URL from GoodReads and pasting it for the summariser (effectively the entry point to demo.py).
- URL Ingestion Module: Represent the part where the URL is received.
- Web Scraper Module: This component is responsible for fetching and parsing the GoodReads page to extract review content.
- Summarization Module: The core area where the scraped review content is fed into the LLM (specifically, the [llama3.2:3b] model via Ollama) for generating the summary.
- Output Display/Result Component: The final summarized text shown as output.
- Environment & Configuration: While not a runtime block in the application flow, indicate that the Python environment (via pyproject.toml and .python-version) is pre-configured for ensuring the correct dependencies and versions.

##### Relationships and Interactions
- The user initiates the process by providing a GoodReads URL.
- The URL Ingestion Module passes the URL to the Web Scraper.
- The Web Scraper retrieves the page data and extracts reviews.
- Extracted review data is sent to the Summarization Module.
- The Summarization Module calls the external LLM service (Ollama’s llama3.2:3b) to generate a summary.
- The LLM returns the summary, which is then output to the user.

##### Architectural Patterns and Technologies
- Modularity: The design isolates scraping from summarization. Although contained in demo.py, conceptually separate these concerns.
- External Integration: The LLM service represents an external dependency integrated into the workflow.
- Lightweight Architecture: The project is simple and script-based with minimal components, but clearly delineate the data flow among them.
- Python Environment Setup: Indicate that the project uses a dedicated Python environment (as specified in pyproject.toml and .python-version).

##### Additional Elements
- All component labels should be clear (e.g., “GoodReads URL Input”, “Web Scraping Component”, “LLM Summarization Module”, “Ollama LLM Service”, “Summary Output”).

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Application Flow"
        A["GoodReads URL Input"]:::internal
        B["URL Ingestion Module"]:::internal
        C["Web Scraper Module"]:::internal
        D["Summarization Module"]:::internal
        E["Ollama LLM Service"]:::external
        F["Summary Output"]:::internal

        A -->|"provides"| B
        B -->|"passesURL"| C
        C -->|"scrapesReviews"| D
        D -->|"callsLLM"| E
        E -->|"returnsSummary"| D
        D -->|"outputsSummary"| F
    end

    subgraph "Configuration"
        G["pyproject.toml"]:::config
        H[".python-version"]:::config
    end

    G --- A
    H --- A

    click A "https://github.com/alexchen666/goodreads-summariser/blob/main/demo.py"
    click B "https://github.com/alexchen666/goodreads-summariser/blob/main/demo.py"
    click C "https://github.com/alexchen666/goodreads-summariser/blob/main/demo.py"
    click D "https://github.com/alexchen666/goodreads-summariser/blob/main/demo.py"
    click E "https://github.com/alexchen666/goodreads-summariser/blob/main/demo.py"
    click F "https://github.com/alexchen666/goodreads-summariser/blob/main/demo.py"
    click G "https://github.com/alexchen666/goodreads-summariser/blob/main/pyproject.toml"
    click H "https://github.com/alexchen666/goodreads-summariser/blob/main/.python-version"

    classDef internal fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef external fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef config fill:#ffcccb,stroke:#333,stroke-width:2px;
```
