# virgo-alpha/linkedin_job_posts_insights architecture

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

- Interactive diagram: https://gitdiagram.com/virgo-alpha/linkedin_job_posts_insights
- Repository: https://github.com/virgo-alpha/linkedin_job_posts_insights

## Overview

##### Project type and purpose
- This is a full-stack Data Engineering pipeline on Google Cloud: it provisions infra via Terraform, ingests raw LinkedIn job posting data with Airflow into GCS, builds a data warehouse in BigQuery, transforms data with dbt, and visualizes insights in Looker Studio. The README clearly outlines these stages and the business questions it answers.

##### File structure
- Top-level directories map directly to architectural layers:
- `0_cloud_infra/terraform` – IaC modules for GCP project, IAM, APIs, GCS, BigQuery
- `1_airflow_wf_orchestration` – Dockerized Airflow DAGs and entrypoint
- `2_dbt_transformations` – dbt project (models, staging, marts, macros, tests)
- `3_looker_studio_dashboard` – exported dashboard artifact
- Root files: `docker-compose.yaml`, `Dockerfile`, `Makefile`, `requirements.txt`, `project.sh`, `scripts.sh` support local orchestration, container builds, and CLI shortcuts.

##### README for additional insights
- Confirms use of Terraform outputs for Airflow config (project_id, bucket, service account).
- Describes data partitioning/clustering in BigQuery and dbt multi-layer modeling.
- Shows run commands for each stage, emphasizing containerization, cloud resources, and dbt Cloud IDE.

##### Elements
- Clear, descriptive labels for each component (e.g., “Airflow Scheduler & Worker (Docker)”).
- Orchestration (orange trapezoids)
- Processing (rectangles for Airflow, dbt)
- Presentation (green for Looker Studio)
- Inline callouts for key config points (Terraform outputs feeding Airflow, dbt profiles using service account).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Control Plane
    subgraph "Control Plane"
        Terraform["Terraform IaC Layer"]:::infra
        subgraph "Terraform Modules"
            ProjectModule["GCP Project Module"]:::infra
            IAMModule["IAM Module"]:::infra
            SAModule["Service Account Module"]:::infra
            StorageModule["Storage (GCS Bucket) Module"]:::infra
            BQModule["BigQuery Module"]:::infra
            APIsModule["APIs Module"]:::infra
        end
    end

    %% Orchestration Layer
    subgraph "Orchestration Layer"
        DockerCompose["Docker Compose Configuration"]:::orchestration
        AirflowDockerfile["Airflow Dockerfile"]:::orchestration
        AirflowEntrypoint["Airflow Entrypoint Script"]:::orchestration
        AirflowDAG["Airflow DAG: extract_and_upload_to_gcs.py"]:::orchestration
    end

    %% Data Plane Storage
    subgraph "Data Plane"
        GCS["GCS Data Lake"]:::storage
        BigQueryExt["BigQuery External Tables"]:::storage
    end

    %% Data Processing
    subgraph "Data Processing"
        dbtProject["dbt Project Configuration"]:::processing
        subgraph "dbt Macros"
            Macro1["create_all_externals.sql"]:::processing
            Macro2["safe_parse_timestamp.sql"]:::processing
        end
        subgraph "dbt External Sources Models"
            ExternalSQL["postings.sql"]:::processing
            ExternalYML["sources.yml"]:::processing
        end
        subgraph "dbt Staging Models & Tests"
            StagingModels["Staging Models (*.sql)"]:::processing
            StagingSchema["staging/schema.yml"]:::processing
            StagingTests["Staging Tests (*.sql)"]:::processing
        end
        subgraph "dbt Core & Marts Models"
            CoreModels["Core & Marts Models"]:::processing
        end
    end

    %% Presentation Layer
    LookerStudio["Looker Studio Dashboard"]:::presentation

    %% Local Dev Utilities & Docs
    LocalDev["Local Development Utilities"]:::tools
    Docs["Documentation & README"]:::docs

    %% Connections
    Terraform --> ProjectModule
    Terraform --> IAMModule
    Terraform --> SAModule
    Terraform --> StorageModule
    Terraform --> BQModule
    Terraform --> APIsModule

    Terraform --> DockerCompose
    DockerCompose --> AirflowDockerfile
    DockerCompose --> AirflowEntrypoint
    AirflowEntrypoint --> AirflowDAG

    AirflowDAG -->|"uploads raw data"| GCS
    GCS -->|"external table reference"| BigQueryExt
    BigQueryExt -->|"feeds"| ExternalSQL
    ExternalSQL --> ExternalYML
    ExternalSQL --> StagingModels
    StagingModels --> StagingSchema
    StagingModels --> StagingTests
    StagingTests --> CoreModels
    CoreModels --> LookerStudio

    LocalDev --> AirflowDAG
    LocalDev --> dbtProject
    Docs --> Terraform

    dbtProject --> Macro1
    dbtProject --> Macro2
    dbtProject --> ExternalSQL
    dbtProject --> StagingModels
    dbtProject --> StagingTests
    dbtProject --> CoreModels

    %% Click Events
    click Terraform "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/0_cloud_infra/terraform"
    click ProjectModule "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/0_cloud_infra/terraform/modules/project"
    click IAMModule "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/0_cloud_infra/terraform/modules/iam"
    click SAModule "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/0_cloud_infra/terraform/modules/service_account"
    click StorageModule "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/0_cloud_infra/terraform/modules/storage"
    click BQModule "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/0_cloud_infra/terraform/modules/bigquery"
    click APIsModule "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/0_cloud_infra/terraform/modules/apis"
    click DockerCompose "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/docker-compose.yaml"
    click AirflowDockerfile "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/Dockerfile"
    click AirflowEntrypoint "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/1_airflow_wf_orchestration/scripts/entrypoint.sh"
    click AirflowDAG "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/1_airflow_wf_orchestration/dags/extract_and_upload_to_gcs.py"
    click dbtProject "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/2_dbt_transformations/dbt_project.yml"
    click Macro1 "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/2_dbt_transformations/macros/create_all_externals.sql"
    click Macro2 "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/2_dbt_transformations/macros/safe_parse_timestamp.sql"
    click ExternalSQL "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/2_dbt_transformations/models/external_sources/postings.sql"
    click ExternalYML "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/2_dbt_transformations/models/external_sources/sources.yml"
    click StagingModels "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/2_dbt_transformations/models/staging"
    click StagingSchema "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/2_dbt_transformations/models/staging/schema.yml"
    click StagingTests "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/2_dbt_transformations/models/staging/tests"
    click CoreModels "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/2_dbt_transformations/models/marts/core"
    click LookerStudio "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/3_looker_studio_dashboard/LinkedIn_Job_Insights.pdf"
    click LocalDev "https://github.com/virgo-alpha/linkedin_job_posts_insights/tree/main/Makefile"
    click Docs "https://github.com/virgo-alpha/linkedin_job_posts_insights/blob/main/README.md"

    %% Styles
    classDef infra fill:#D6EAF8,stroke:#1B4F72,color:#1B2631;
    classDef orchestration fill:#FDEBD0,stroke:#B9770E,color:#1C2833;
    classDef storage fill:#D5F5E3,stroke:#196F3D,color:#145A32;
    classDef processing fill:#F9E79F,stroke:#B7950B,color:#7D6608;
    classDef presentation fill:#D4EFDF,stroke:#196F3D,color:#1D8348;
    classDef tools fill:#F5B7B1,stroke:#943126,color:#641E16;
    classDef docs fill:#E8DAEF,stroke:#6C3483,color:#4A235A;
```
