# jordantgh/income_le_analysis architecture

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

- Interactive diagram: https://gitdiagram.com/jordantgh/income_le_analysis
- Repository: https://github.com/jordantgh/income_le_analysis

## Overview

##### Main Components

a. Data Layer:
- Raw Data Store (Chetty's study tables)
- External Data (industry data, shapefiles)
- Derived Tables

b. Processing Layer:
- Create three main processing blocks:
- Data Initialization (init_db.r)
- Industry Processing Pipeline
- Table Processing Pipeline
Use rectangular blocks with rounded corners for processing components

c. Application Layer:
- Shiny Dashboard Component
- Visualization Layer
Use a web interface symbol for the Shiny app

##### Flow and Relationships

**Raw Data → Data Initialization → Processed Tables**
**External Data → Industry Processing → Processed Tables**
**Processed Tables → Table Processing Pipeline → Dashboard**

##### Component Details

a. Data Sources (Bottom Layer):
- County-level data
- Commuting Zone (CZ) data
- State-level data
- National data
- Geographic data (shapefiles)
- Industry data

b. Processing Pipeline (Middle Layer):
- Parallel processing streams:
- Industry data processing
- Regional assignment
- Table processing
- Data cleanup

c. Application Layer (Top Layer):
- Shiny Dashboard
- CSS styling
- Interactive visualizations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        style Legend fill:#f5f5f5,stroke:#333,stroke-width:2px
        L1[Raw Data]:::raw
        L2[Processing Component]:::processing
        L3[External Data]:::external
        L4[Application Component]:::application
        L5[(Database)]:::database
    end

    subgraph "Data Sources Layer"
        RawStore[(Raw Data Store)]:::database
        ExtInd[(Industry Data)]:::database
        ExtGeo[(Geographic Data)]:::database
        DerivedDB[(Derived Tables)]:::database
    end

    subgraph "Processing Layer"
        Init[Data Initialization]:::processing
        IndProc[Industry Processing]:::processing
        TableProc[Table Processing]:::processing
        RegAssign[Region Assignment]:::processing
    end

    subgraph "Application Layer"
        ShinyApp[Shiny Dashboard]:::application
        Styling[CSS Styling]:::application
        Viz[Interactive Visualizations]:::application
    end

    %% Data Flow
    RawStore --> Init
    ExtInd --> IndProc
    ExtGeo --> RegAssign
    Init --> DerivedDB
    IndProc --> DerivedDB
    RegAssign --> DerivedDB
    DerivedDB --> TableProc
    TableProc --> ShinyApp
    Styling --> ShinyApp
    ShinyApp --> Viz

    %% Click Events
    click RawStore "https://github.com/jordantgh/income_le_analysis/tree/main/data/chetty_online_tables/"
    click ExtInd "https://github.com/jordantgh/income_le_analysis/tree/main/data/external_data/industry/"
    click ExtGeo "https://github.com/jordantgh/income_le_analysis/tree/main/data/external_data/shapefiles/"
    click DerivedDB "https://github.com/jordantgh/income_le_analysis/tree/main/data/derived_tables/"
    click Init "https://github.com/jordantgh/income_le_analysis/blob/main/code/db/init_db.r"
    click IndProc "https://github.com/jordantgh/income_le_analysis/tree/main/code/add_industries/"
    click TableProc "https://github.com/jordantgh/income_le_analysis/tree/main/code/process_tables/"
    click RegAssign "https://github.com/jordantgh/income_le_analysis/blob/main/code/region/assign_region.r"
    click ShinyApp "https://github.com/jordantgh/income_le_analysis/blob/main/code/shinyapp/app.r"
    click Styling "https://github.com/jordantgh/income_le_analysis/blob/main/code/shinyapp/custom.css"

    %% Styling
    classDef raw fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef processing fill:#98FB98,stroke:#333,stroke-width:2px
    classDef external fill:#FFA07A,stroke:#333,stroke-width:2px
    classDef application fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef database fill:#f9f9f9,stroke:#333,stroke-width:2px
```
