# akisavujel/world-life-expectancy-2024 architecture

> Architecture diagram of the GitHub repository akisavujel/world-life-expectancy-2024, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akisavujel/world-life-expectancy-2024
- Repository: https://github.com/akisavujel/world-life-expectancy-2024

## Overview

##### Project type and purpose (what you’re diagramming)
This is a **data analytics workflow / data pipeline project**, not a running service. The “system” is a **sequence of data transformations and analysis artifacts**:

- **External data source website** → **Python scraping/cleaning** → **clean CSV dataset** → **SQL analysis** → **Tableau dashboard** (published to Tableau Public)
- Supporting artifacts: notebook (`.ipynb`), SQL script (`.sql`), Tableau workbook (`.twb`), exported report (`.pdf`)

##### File tree mapping → components
From the repo structure:

- `world_life_expectancy_2024..ipynb`
**Core ETL/ELT logic**: web scraping + cleaning + export. (Execution environment: Jupyter/Colab)
- `world_life_expectancy_2024.csv`
**Canonical cleaned dataset** used downstream (SQL + Tableau).
- `world_life_expectancy_2024..sql`
**Analysis layer**: aggregates, top/bottom, thresholds, gender gap, max-min difference.
- `world_life_expectancy_2024.twb`
**Visualization layer**: Tableau workbook connecting to CSV (or to extracted data) and defining KPIs/charts/map.
- `world_life_expectancy_2024..pdf`
**Static deliverable** (exported report / snapshot).
- `README.md`
**Documentation + links** to Kaggle notebook and Tableau Public dashboard.

This structure strongly suggests a **pipeline architecture** with well-defined “artifact boundaries” (HTML → DataFrame → CSV → SQL result sets → Tableau viz → published dashboard/PDF).

##### World Population Review website
- Data accessed via HTTP GET
- HTML table is the raw input

##### Python scraping module (Requests + BeautifulSoup) (implemented inside the notebook)
- Fetch HTML
- Parse table headers/rows

##### Data cleaning & preprocessing (Pandas) (also in notebook)
- Normalize column names
- Drop empty/irrelevant rows/columns
- Convert types to numeric
- Handle nulls/duplicates

##### Clean dataset artifact: CSV (`world_life_expectancy_2024.csv`)
- This is the handoff contract between processing and analytics/BI

##### SQL analysis script (`world_life_expectancy_2024..sql`)
- Reads from CSV *conceptually* (or from an imported table if the user loads CSV into a DB)
- Produces: averages, max/min, thresholds (>80, <60), gender gap, delta max-min

> Important: because the repo does not include a DB (no Docker, no schema/migrations, no DB config), model SQL as either:
> - “Local SQL engine” (SQLite/MySQL/Postgres—unspecified), or
> - “SQL layer” that runs after importing CSV into a database.

##### Tableau workbook (`world_life_expectancy_2024.twb`)
- Data source: CSV (or Tableau extract derived from it)
- Contains KPI calculations + charts + map

##### Publishing target: Tableau Public (external service)
- Published interactive dashboard
- Downstream consumers: recruiters, stakeholders, viewers

##### Static output: PDF
- Export of results/dashboard for offline viewing

##### Kaggle notebook page
- Optional execution/distribution environment for the notebook (not required for pipeline correctness)

- protocol (HTTP), format (HTML/CSV), and transformation type (parse/clean/aggregate)

Recommended flows:

##### Tableau workbook → PDF

Adding **feedback loops** if they exist in practice:
- “If scraping schema changes → update notebook parsing/cleaning”
- “If KPI definitions change → update SQL and/or Tableau calcs”

##### Architectural patterns / principles to highlight
- **Pipeline / staged architecture**: each stage produces a durable artifact (CSV, workbook, PDF).
- **Separation of concerns**:
- Ingestion (requests/bs4)
- Cleaning (pandas)
- Analysis (SQL)
- Visualization (Tableau)
- **Contract-driven handoff**: the CSV is the “data contract” (schema: Country, overall, female, male life expectancy).
- **Reproducibility**:
- Notebook acts as executable documentation for acquisition + transformation steps.

##### “Don’t overthink it” decomposition (separate into as many components as possible)
To maximize detail without inventing infrastructure that isn’t in the repo, split along *real boundaries*:

**Notebook boundary (split into components):**
- HTTP fetch (Requests)
- HTML parsing (BeautifulSoup)
- Structuring (table → rows/cols)
- Cleaning (Pandas: rename/drop/type cast)
- Validation checks (null/dupes)
- Export (CSV write)

**SQL boundary (split into query groups):**
- Averages (overall/male/female)
- Extremes (max/min by country)
- Threshold filters (>80, <60)
- Gender gap calculations
- Max–min difference KPI

**Tableau boundary (split into dashboard parts):**
- Data connection (CSV)
- KPI tiles (5)
- Bar charts (4)
- (1)
- Interactions (filters/hover tooltips)
- Publishing (Tableau Public)
- Export (PDF)

##### Bottom-right: Tableau assembly (optional)

That combination will be the “best and most accurate” architecture representation for this specific project.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% TOP: High-level pipeline
  %% =========================
  subgraph "High-level Data Pipeline (Context)"
    direction TB

    SRC["World Population Review Website\n(HTML table)"]:::external
    NB["Jupyter/Colab Notebook\nScrape + Clean + Export"]:::process
    CSV[("Clean CSV Dataset\n(world_life_expectancy_2024.csv)")]:::data
    SQL["SQL Analysis Script\n(world_life_expectancy_2024..sql)"]:::analytics
    TBL["Tableau Workbook\n(world_life_expectancy_2024.twb)"]:::bi
    TPUB["Tableau Public\n(Published dashboard)"]:::external
    PDF["Exported Report\n(world_life_expectancy_2024..pdf)"]:::artifact
    USERS["Viewers / Recruiters / Stakeholders"]:::users
    KAG["Kaggle Notebook Page\n(optional distribution)"]:::external
    DOC["README\n(links + documentation)"]:::doc

    SRC -->|"HTTP_GET(HTML)"| NB
    NB -->|"export_cleaned_dataset(CSV)"| CSV
    CSV -->|"load_or_import(table/virtual_table)"| SQL
    CSV -->|"Tableau_data_connection(CSV/extract)"| TBL
    TBL -->|"publish_dashboard"| TPUB
    TPUB -->|"view_interactive"| USERS
    TBL -->|"export_snapshot(PDF)"| PDF
    PDF -->|"offline_view"| USERS

    DOC -.->|"references"| KAG
    DOC -.->|"references"| TPUB
    KAG -.->|"hosts_copy_of_notebook"| NB
  end

  %% ===================================
  %% MIDDLE: Detailed ETL + analytics
  %% ===================================
  subgraph "Detailed ETL + Data Lineage (Most Important)"
    direction TB

    subgraph "Notebook: Ingestion + Processing (world_life_expectancy_2024..ipynb)"
      direction TB
      RQ["HTTP Fetch\nRequests"]:::process
      BS["HTML Parsing\nBeautifulSoup"]:::process
      ST["Structuring\nTable → rows/columns"]:::process
      CL["Cleaning & Preprocessing\nPandas"]:::process
      VA["Validation Checks\nnulls/duplicates/types"]:::process
      EX["Export\nwrite CSV"]:::process

      RQ -->|"raw_HTML"| BS
      BS -->|"parsed_headers+rows"| ST
      ST -->|"DataFrame"| CL
      CL -->|"cleaned_DataFrame"| VA
      VA -->|"validated_DataFrame"| EX
    end

    SRC2["World Population Review Website\n(HTML table)"]:::external
    CSV2[("Clean CSV Dataset\n(world_life_expectancy_2024.csv)\nData contract: Country, Overall, Female, Male")]:::data

    SRC2 -->|"HTTP_GET(HTML)"| RQ
    EX -->|"CSV_artifact"| CSV2

    subgraph "SQL Layer (world_life_expectancy_2024..sql)"
      direction TB
      ASSUMP["Assumption:\nCSV is queried after being loaded into a local SQL engine\n(SQLite/MySQL/Postgres—unspecified)"]:::note
      QAVG["Query Group: Averages\n(overall/male/female)"]:::analytics
      QEXT["Query Group: Extremes\n(max/min by country)"]:::analytics
      QTHR["Query Group: Thresholds\n(>80, <60 segments)"]:::analytics
      QGAP["Query Group: Gender Gap\n(female - male)"]:::analytics
      QDEL["Query Group: Max–Min Difference KPI"]:::analytics

      ASSUMP --> QAVG --> QEXT --> QTHR --> QGAP --> QDEL
    end

    CSV2 -->|"load_into_DB_or_query_as_table"| ASSUMP

    subgraph "Derived Result Sets (conceptual outputs)"
      direction TB
      RS1[("Result Set: KPI Metrics\navg, gap, max-min delta")]:::data
      RS2[("Result Set: Rankings\nTop/Bottom countries")]:::data
      RS3[("Result Set: Threshold Segments\n>80, <60")]:::data
    end

    QAVG -->|"produces"| RS1
    QGAP -->|"produces"| RS1
    QDEL -->|"produces"| RS1
    QEXT -->|"produces"| RS2
    QTHR -->|"produces"| RS3
  end

  %% ===================================
  %% BOTTOM-RIGHT: Tableau semantic layer
  %% ===================================
  subgraph "Tableau Assembly (Workbook → Dashboard)"
    direction TB

    TDS["Tableau Data Source\n(connect to CSV / extract)"]:::bi
    CALC["Calculated Fields\n(KPI formulas)"]:::bi
    KPI["KPI Tiles\n(5)"]:::bi
    BAR["Bar Charts\n(4)"]:::bi
    MAP["Map\n(1)"]:::bi
    INT["Interactions\n(filters/tooltips/hover)"]:::bi
    DASH["Dashboard Layout\n(combine sheets)"]:::bi
    PUB["Publish to Tableau Public"]:::external
    EXP["Export PDF Snapshot"]:::artifact

    CSV3[("Clean CSV Dataset\n(world_life_expectancy_2024.csv)")]:::data

    CSV3 -->|"connect"| TDS
    TDS -->|"define"| CALC
    CALC -->|"power"| KPI
    CALC -->|"power"| BAR
    TDS -->|"geographic_by_country"| MAP
    KPI -->|"compose"| DASH
    BAR -->|"compose"| DASH
    MAP -->|"compose"| DASH
    INT -->|"enhance"| DASH
    DASH -->|"publish"| PUB
    DASH -->|"export"| EXP
  end

  %% =========================
  %% Legend + notes
  %% =========================
  subgraph "Legend & Notes"
    direction TB
    L1["External Systems\nWebsite / Tableau Public / Kaggle"]:::external
    L2["Processing\nNotebook steps"]:::process
    L3["Analytics\nSQL script + query groups"]:::analytics
    L4["Data Artifacts\nCSV / Result sets"]:::data
    L5["Deliverables\nPDF / Docs"]:::artifact
    L6["Documentation\nREADME"]:::doc
    L7["Assumption Notes\n(Optional components)"]:::note
  end

  %% =========================
  %% Click Events (from mapping)
  %% =========================
  click NB "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..ipynb"
  click RQ "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..ipynb"
  click BS "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..ipynb"
  click ST "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..ipynb"
  click CL "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..ipynb"
  click VA "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..ipynb"
  click EX "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..ipynb"

  click CSV "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.csv"
  click CSV2 "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.csv"
  click CSV3 "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.csv"

  click SQL "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..sql"
  click QAVG "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..sql"
  click QEXT "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..sql"
  click QTHR "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..sql"
  click QGAP "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..sql"
  click QDEL "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..sql"

  click TBL "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.twb"
  click TDS "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.twb"
  click CALC "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.twb"
  click KPI "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.twb"
  click BAR "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.twb"
  click MAP "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.twb"
  click INT "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.twb"
  click DASH "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024.twb"

  click PDF "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..pdf"
  click EXP "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/world_life_expectancy_2024..pdf"

  click DOC "https://github.com/akisavujel/world-life-expectancy-2024/blob/main/README.md"

  %% =========================
  %% Styles
  %% =========================
  classDef external fill:#ECEFF1,stroke:#607D8B,stroke-width:1.5px,color:#263238
  classDef process fill:#E3F2FD,stroke:#1E88E5,stroke-width:1.5px,color:#0D47A1
  classDef analytics fill:#F3E5F5,stroke:#8E24AA,stroke-width:1.5px,color:#4A148C
  classDef bi fill:#E8F5E9,stroke:#43A047,stroke-width:1.5px,color:#1B5E20
  classDef data fill:#FFF8E1,stroke:#FFB300,stroke-width:1.5px,color:#6D4C41
  classDef artifact fill:#FCE4EC,stroke:#D81B60,stroke-width:1.5px,color:#880E4F
  classDef users fill:#FFF3E0,stroke:#FB8C00,stroke-width:1.5px,color:#E65100
  classDef doc fill:#E0F7FA,stroke:#00ACC1,stroke-width:1.5px,color:#004D40
  classDef note fill:#FFFDE7,stroke:#9E9D24,stroke-width:1.5px,color:#33691E
```
