# edoardopilla/ecb_sma_dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/edoardopilla/ecb_sma_dashboard
- Repository: https://github.com/edoardopilla/ecb_sma_dashboard

## Overview

##### Project Type & Purpose
- This is a Python-based dashboard (“full-stack-lite” monolith) built with Plotly Dash.
- It scrapes the ECB’s Survey of Monetary Analysts (SMA) data using Selenium/Chromedriver, transforms it via Pandas, and serves interactive visualizations at localhost:8050.

##### File Structure Breakdown
- app.py
– Dash/Flask server, defines layout, callbacks, orchestrates scraping & data prep at startup
- ecb_sma_dash_user_params.py
– User‐editable config: scrape_data_flag, Chromedriver path, etc.
- ecb_sma_dash_utils.py
– Scraping logic: Selenium driver initialization, fetch raw tables from ECB site
- prepare_data_static_functions.py
– Data‐prep/transformation functions, returns cleaned DataFrames for plotting
- assets/style.css
– Custom CSS for Dash components
- ecb_sma_dashboard.yml
– Conda environment spec (Dash, Selenium, Pandas, etc.)
- README.md/.gitignore/LICENSE
– Docs, license, ignore rules

##### Key README Insights
- Workflow:
1. Activate Conda env
2. Download Chromedriver, set path in user_params
3. Run app.py ➔ if scrape_data_flag=True, pull & prep data ➔ launch dashboard
- No external database: data lives in memory or temporary artifacts during runtime.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["User Browser"]:::client
        Assets["Static Assets\n(assets/style.css)"]:::presentation
        click Assets "https://github.com/edoardopilla/ecb_sma_dashboard/blob/main/assets/style.css"
    end

    %% Application Layer
    subgraph "Application Layer"
        Server["Dash App Server\n(app.py)"]:::server
        click Server "https://github.com/edoardopilla/ecb_sma_dashboard/blob/main/app.py"
    end

    %% Configuration Layer
    subgraph "Configuration Layer"
        Config["Configuration Module\n(ecb_sma_dash_user_params.py)"]:::config
        click Config "https://github.com/edoardopilla/ecb_sma_dashboard/blob/main/ecb_sma_dash_user_params.py"
    end

    %% Ingestion / Scraping Layer
    subgraph "Ingestion Layer"
        Scraper["Scraper Module\n(ecb_sma_dash_utils.py)"]:::ingestion
        click Scraper "https://github.com/edoardopilla/ecb_sma_dashboard/blob/main/ecb_sma_dash_utils.py"
        Chromedriver["Chromedriver"]:::ingestion
        ECB["ECB SMA Website"]:::external
    end

    %% Processing / Data Layer
    subgraph "Processing Layer"
        DataPrep["Data Prep Module\n(prepare_data_static_functions.py)"]:::processing
        click DataPrep "https://github.com/edoardopilla/ecb_sma_dashboard/blob/main/prepare_data_static_functions.py"
        Storage["In-Memory Data\n(or temp artifacts)"]:::storage
    end

    %% Repository Files
    subgraph "Repository Metadata"
        EnvSpec["Environment Spec\n(ecb_sma_dashboard.yml)"]:::metadata
        click EnvSpec "https://github.com/edoardopilla/ecb_sma_dashboard/blob/main/ecb_sma_dashboard.yml"
        Readme["Documentation\n(README.md)"]:::metadata
        click Readme "https://github.com/edoardopilla/ecb_sma_dashboard/blob/main/README.md"
        GitIgnore["Ignore Rules\n(.gitignore)"]:::metadata
        click GitIgnore "https://github.com/edoardopilla/ecb_sma_dashboard/blob/main/.gitignore"
        License["License File\n(LICENSE)"]:::metadata
        click License "https://github.com/edoardopilla/ecb_sma_dashboard/tree/main/LICENSE"
    end

    %% Flows
    Browser -->|"HTTP/WebSocket"| Server
    Server -->|"reads config"| Config
    Server -->|"launches scrape() call"| Scraper
    Scraper -->|"uses"| Chromedriver
    Scraper -->|"HTTP request"| ECB
    ECB -->|"raw HTML tables"| Scraper
    Scraper -->|"raw data"| DataPrep
    DataPrep -->|"cleaned DataFrame"| Storage
    Storage -->|"DataFrame"| Server
    Server -->|"serves UI with data"| Browser
    Server -->|"serves CSS"| Assets

    %% Styles
    classDef client fill:#FFD580,stroke:#CC9A00,color:#000;
    classDef server fill:#B3E5FC,stroke:#039BE5,color:#000;
    classDef config fill:#E1BEE7,stroke:#8E24AA,color:#000;
    classDef ingestion fill:#FFCDD2,stroke:#E53935,color:#000;
    classDef processing fill:#C8E6C9,stroke:#43A047,color:#000;
    classDef presentation fill:#FFE0B2,stroke:#FB8C00,color:#000;
    classDef external fill:#E0E0E0,stroke:#9E9E9E,color:#000;
    classDef storage fill:#D1C4E9,stroke:#5E35B1,color:#000;
    classDef metadata fill:#F5F5F5,stroke:#BDBDBD,color:#000;
```
