# amantes/greekonomics architecture

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

- Interactive diagram: https://gitdiagram.com/amantes/greekonomics
- Repository: https://github.com/amantes/greekonomics

## Overview

##### Project Type and Purpose
- This is a data‐analysis and visualization script written in R.
- It extracts economic indicators from Eurostat, transforms them with tidyverse tools, and plots them via ggplot2 and related packages.

##### Break Down the Main Architectural Components
a. External Data Source
– Eurostat REST API endpoints (various datasets like tepsr_wc310, sdg_10_10, etc.)
b. R Execution Environment
– R interpreter/runtime installed on the user’s machine or server
– Internet connection for data fetch and font retrieval
c. R Packages (Dependencies)
– Data retrieval: eurostat
– Data wrangling: tidyverse (dplyr, tidyr, scales)
– Plotting: ggplot2
– Typography: showtext, ggtext (Google Fonts “Roboto” families)
d. Core Script
– Greekonomics_51_public.R – orchestrates data fetch, cleaning, transformation, and plotting
e. Output Layer
– Generated plots (PNG, PDF or interactive graphics)
– Possible intermediate data objects

##### Relationships and Data Flow
1. Extract (eurostat)
2. Transform (dplyr/tidyr)

##### Architectural Patterns and Design Principles
- Modular dependency management: each R package has a single responsibility.
- Reproducibility principle: single-file script that, when run, replicates the entire analysis.

##### Details
- That the script requires an active internet connection.
- That fonts are pulled at runtime via showtext.
- Intermediate transformation steps if desired (e.g., filtering, summarization).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Sources
    Eurostat["Eurostat API"]:::dataSource
    GoogleFonts["Google Fonts Service"]:::dataSource
    Internet["Internet Connection"]:::external

    %% Compute Environment
    RRuntime["R Interpreter & Runtime"]:::processing

    %% Core Script and Stages
    subgraph "Core Script Pipeline"
        direction TB
        Script["Greekonomics_51_public.R"]:::processing
        Extract["1. Extract (eurostat)"]:::processing
        Transform["2. Transform (dplyr/tidyr)"]:::processing
        Visualize["3. Load/Visualize (ggplot2 + showtext)"]:::processing
    end

    %% R Packages
    subgraph "R Packages"
        direction TB
        EuroPkg["eurostat"]:::deps
        TidyPkg["tidyverse"]:::deps
        GgplotPkg["ggplot2"]:::deps
        ShowtextPkg["showtext/ggtext"]:::deps
    end

    %% Outputs
    Outputs["Output: Visualizations (PNG, PDF)"]:::outputs

    %% Documentation
    README["README.md"]:::external
    License["LICENCE.md"]:::external

    %% Connections
    Internet -->|"network access"| Script
    RRuntime -->|"execute script"| Script

    Script --> Extract
    Eurostat -->|"GET JSON"| Extract
    Internet -->|"network access"| Extract
    EuroPkg -->|"data retrieval"| Extract

    Extract -->|"tidy data frame"| Transform
    TidyPkg -->|"data wrangling"| Transform

    Transform -->|"clean data"| Visualize
    GgplotPkg -->|"plotting"| Visualize
    ShowtextPkg -->|"typography"| Visualize
    GoogleFonts -->|"download fonts"| Visualize
    Internet -->|"network access"| Visualize

    Visualize -->|"render plots"| Outputs

    %% Click Events
    click Script "https://github.com/amantes/greekonomics/blob/main/Greekonomics_51_public.R"
    click README "https://github.com/amantes/greekonomics/blob/main/README.md"
    click License "https://github.com/amantes/greekonomics/blob/main/LICENCE.md"

    %% Styles
    classDef dataSource fill:#D0E7FF,stroke:#005B96;
    classDef processing fill:#E0FFE0,stroke:#2E8B57;
    classDef deps fill:#FFD8B1,stroke:#FF8C00;
    classDef outputs fill:#F0F0F0,stroke:#A9A9A9;
    classDef external fill:#E8E8E8,stroke:#696969;
```
