# sofianechehboune/-greenboost---analyse-par-google-gemini architecture

> Architecture diagram of the GitHub repository sofianechehboune/-greenboost---analyse-par-google-gemini, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sofianechehboune/-greenboost---analyse-par-google-gemini
- Repository: https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini

## Overview

##### Project Type and Purpose
- This is a single‐page/multi‐page interactive Streamlit application (“GreenBoost Gemini App”) that leverages Google’s Generative AI (Gemini) to perform text summarization, keyword extraction, and related‐prompt generation. Users interact via a web UI, the app calls AI services, processes results, and renders them back in dashboards and visualisations.

##### File Structure Analysis
- Top‐Level Files
- streamlit_app.py: main entry point launching the Streamlit server and routing to pages.
- header.py, style.css: global UI elements and styling.
- requirements.txt, .gitignore: dependencies and ignore rules.
- .devcontainer/, .streamlit/: development configuration (VS Code dev container, Streamlit theming via config.toml).
- Directories
- modules/: core logic and helper classes
– gemini_utils.py: API wrappers for Google Gemini
– prompt_templates.py: prompt‐engineering templates
– analysis_tools.py: post‐processing, text analysis functions
– ui_components.py: custom Streamlit UI widgets
- pages/: Streamlit pages
– 🎨 Visualisations.py
– 📊 Tableau de bord.py
- assets/: static images or resources

##### Key README Insights
- Features: Summaries, keyword extraction, prompt generation, theming, secure API key (.env).
- Tech Stack: Streamlit (web UI), Google Generative AI, Pandas, Pillow, python‐dotenv.
- Deployment: Streamlit Cloud; must include requirements.txt, config.toml, set GOOGLE_API_KEY.

a. Main Components
1. Client Browser / User
2. Streamlit Server (streamlit_app.py + pages + header + style)
3. UI Components Layer (ui_components.py, header.py)
4. Business Logic Layer (modules/analysis_tools.py, prompt_templates.py)
5. API Wrapper Layer (modules/gemini_utils.py)
6. External Service: Google Gemini Generative AI API
7. Configuration & Secrets (.env, .streamlit/config.toml)
8. Assets (assets folder)
b. Relationships & Data Flow
- User enters text in UI → Streamlit server forwards to UI components → Business logic transforms input → Prompt templates assemble requests → API wrapper calls Google Gemini → Results returned → Analysis tools post‐process output → UI components render summaries/keywords/dashboards → Browser displays results.
- Configuration is loaded at startup (API keys, theme settings).
c. Architectural Patterns & Principles
- Layered Architecture (Presentation → Application Logic → API Integration → External Service)
- Separation of Concerns: UI code vs. prompt engineering vs. API calls vs. data processing
- Modular Design: each module focused on a single responsibility
d. Technologies & Frameworks
- Python & Streamlit for UI
- Google Generative AI (Gemini) for NLP tasks
- Pandas & Pillow for data/image handling
- python‐dotenv for secret management

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    User["User / Browser"]:::external

    %% Configuration & Assets
    subgraph "Configuration & Assets"
        Env[".env"]:::config
        ConfigToml[".streamlit/config.toml"]:::config
        Assets["assets/"]:::config
    end

    %% Streamlit Server
    subgraph "Streamlit Server"
        SS["streamlit_app.py"]:::server
        subgraph "Streamlit Pages"
            Visualisations["🎨 Visualisations.py"]:::server
            Tableau["📊 Tableau de bord.py"]:::server
        end
        SS --> Visualisations
        SS --> Tableau
        SS --> UIComp
        SS --> Header
        SS --> StyleCSS
    end

    %% UI Components Layer
    subgraph "UI Components Layer"
        UIComp["modules/ui_components.py"]:::ui
        Header["header.py"]:::ui
        StyleCSS["style.css"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        PromptTemplates["modules/prompt_templates.py"]:::logic
        AnalysisTools["modules/analysis_tools.py"]:::logic
    end

    %% API Wrapper
    APILayer["modules/gemini_utils.py"]:::api

    %% External Service
    GoogleGemini["Google Gemini API"]:::externalService

    %% Data Flow
    User -->|interacts| SS
    UIComp -->|captures input| PromptTemplates
    PromptTemplates -->|builds prompt| APILayer
    APILayer -->|sends request| GoogleGemini
    GoogleGemini -->|returns response| APILayer
    APILayer -->|raw output| AnalysisTools
    AnalysisTools -->|processed data| UIComp
    UIComp -->|renders results| User
    ConfigToml -->|theme settings| SS
    Env -->|API key| APILayer
    Assets -->|static resources| UIComp

    %% Click Events
    click SS "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/streamlit_app.py"
    click Visualisations "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/pages/🎨  Visualisations.py"
    click Tableau "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/pages/📊  Tableau de bord.py"
    click Header "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/header.py"
    click StyleCSS "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/style.css"
    click UIComp "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/modules/ui_components.py"
    click PromptTemplates "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/modules/prompt_templates.py"
    click AnalysisTools "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/modules/analysis_tools.py"
    click APILayer "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/modules/gemini_utils.py"
    click ConfigToml "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/blob/main/.streamlit/config.toml"
    click Assets "https://github.com/sofianechehboune/-greenboost---analyse-par-google-gemini/tree/main/assets/"

    %% Styles
    classDef external fill:#AED6F1,stroke:#2980B9,color:#154360
    classDef server fill:#F0F0F0,stroke:#B3B6B7,color:#2C3E50
    classDef ui fill:#D6EAF8,stroke:#5DADE2,color:#1B4F72
    classDef logic fill:#D5F5E3,stroke:#58D68D,color:#186A3B
    classDef api fill:#ABEBC6,stroke:#52BE80,color:#145A32
    classDef externalService fill:#FAD7A0,stroke:#EB984E,color:#7E5109
    classDef config fill:#EBEDEF,stroke:#CCD1D1,color:#566573
```
