# levavasseuryann/dbt-bigquery architecture

> Architecture diagram of the GitHub repository levavasseuryann/dbt-bigquery, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/levavasseuryann/dbt-bigquery
- Repository: https://github.com/levavasseuryann/dbt-bigquery
- Video tour (about a minute): https://gitdiagram.com/levavasseuryann/dbt-bigquery/video

## Overview

This is a dbt project for transforming BigQuery HR data into tested, consumer-ready employee and department analytics. Its principal workflow cleans declared employee sources, enriches them with department targets, and materializes department and employee marts; a separate snapshot captures employee history. The project also documents source freshness, model contracts, business-rule tests, reusable macros, and an ad-hoc analysis query. The README documents model and seed relationships, but source excerpts were unavailable, so links beyond those documented are omitted.

Main entry points: [`models/intermediate/int_employees_enriched.sql`](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/intermediate/int_employees_enriched.sql) (Employee Enrichment), [`models/marts/dim_departments.sql`](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/dim_departments.sql) (Department Dimension), [`models/marts/fct_employees_active.sql`](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/fct_employees_active.sql) (Active Employees), [`models/marts/fct_employee_headcount_monthly.sql`](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/fct_employee_headcount_monthly.sql) (Monthly Headcount)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Warehouse Inputs"]
  node_bigquery[("BigQuery Sources")]
  node_targets["Department Targets"]
  node_source_defs["Source Definitions<br/>[_sources.yml]"]
end

subgraph group_transform["Data Models"]
  node_staging["Employee Staging<br/>[stg_employees.sql]"]
  node_enriched["Employee Enrichment"]
  node_departments[("Department Dimension")]
  node_active_employees[("Active Employees")]
  node_monthly_headcount[("Monthly Headcount")]
end

subgraph group_quality["Quality and History"]
  node_snapshot[("Employee SCD2 History<br/>[snp_employees.sql]")]
  node_seed_validation["Seed Validation<br/>[_schema.yml]"]
  node_source_freshness["Source Freshness<br/>[_sources.yml]"]
  node_model_tests["Model Tests<br/>[_schema.yml]"]
  node_business_tests["Business Rule Tests"]
  node_freshness_test["Recent Update Test"]
  node_custom_test["Custom Generic Test"]
end

subgraph group_operations["Project Capabilities"]
  node_run_start["Run Start Hook"]
  node_run_end["Run Results Summary"]
  node_analysis["Employee KPI Analysis<br/>[employee_kpis.sql]"]
end

node_consumer(("Analytics Consumers"))

node_bigquery -->|"reads"| node_staging
node_source_defs -->|"declares sources"| node_bigquery
node_staging -->|"feeds"| node_enriched
node_targets -->|"enriches"| node_enriched
node_enriched -->|"feeds"| node_departments
node_enriched -->|"feeds"| node_active_employees
node_enriched -->|"feeds"| node_monthly_headcount
node_bigquery -->|"captures history"| node_snapshot
node_targets -->|"validated by"| node_seed_validation
node_bigquery -->|"freshness checked"| node_source_freshness
node_departments -->|"contracted and tested"| node_model_tests
node_active_employees -->|"contracted and tested"| node_model_tests
node_monthly_headcount -->|"contracted and tested"| node_model_tests
node_bigquery -->|"checked for future hires"| node_business_tests
node_bigquery -->|"checked for stale updates"| node_freshness_test
node_analysis -->|"supports analysis"| node_consumer
node_departments -->|"serves"| node_consumer
node_active_employees -->|"serves"| node_consumer
node_monthly_headcount -->|"serves"| node_consumer

click node_targets "https://github.com/levavasseuryann/dbt-bigquery/blob/master/seeds/department_targets.csv"
click node_staging "https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/staging/stg_employees.sql"
click node_source_defs "https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/staging/_sources.yml"
click node_enriched "https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/intermediate/int_employees_enriched.sql"
click node_departments "https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/dim_departments.sql"
click node_active_employees "https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/fct_employees_active.sql"
click node_monthly_headcount "https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/fct_employee_headcount_monthly.sql"
click node_snapshot "https://github.com/levavasseuryann/dbt-bigquery/blob/master/snapshots/snp_employees.sql"
click node_seed_validation "https://github.com/levavasseuryann/dbt-bigquery/blob/master/seeds/_schema.yml"
click node_source_freshness "https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/staging/_sources.yml"
click node_model_tests "https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/_schema.yml"
click node_business_tests "https://github.com/levavasseuryann/dbt-bigquery/blob/master/tests/assert_no_future_hires.sql"
click node_freshness_test "https://github.com/levavasseuryann/dbt-bigquery/blob/master/tests/assert_recent_source_updates.sql"
click node_custom_test "https://github.com/levavasseuryann/dbt-bigquery/blob/master/macros/test_non_negative.sql"
click node_run_start "https://github.com/levavasseuryann/dbt-bigquery/blob/master/macros/log_project_context.sql"
click node_run_end "https://github.com/levavasseuryann/dbt-bigquery/blob/master/macros/summarize_run_results.sql"
click node_analysis "https://github.com/levavasseuryann/dbt-bigquery/blob/master/analyses/employee_kpis.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bigquery,node_targets,node_source_defs toneBlue
class node_staging,node_enriched,node_departments,node_active_employees,node_monthly_headcount toneAmber
class node_snapshot,node_seed_validation,node_source_freshness,node_model_tests,node_business_tests,node_freshness_test,node_custom_test toneMint
class node_run_start,node_run_end,node_analysis toneRose
class node_consumer toneIndigo
```

## Components

### Warehouse Inputs

- **BigQuery Sources**
- [Department Targets](https://github.com/levavasseuryann/dbt-bigquery/blob/master/seeds/department_targets.csv): `seeds/department_targets.csv`
- [Source Definitions](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/staging/_sources.yml): `models/staging/_sources.yml`

### Data Models

- [Employee Staging](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/staging/stg_employees.sql): `models/staging/stg_employees.sql`
- [Employee Enrichment](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/intermediate/int_employees_enriched.sql): `models/intermediate/int_employees_enriched.sql`
- [Department Dimension](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/dim_departments.sql): `models/marts/dim_departments.sql`
- [Active Employees](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/fct_employees_active.sql): `models/marts/fct_employees_active.sql`
- [Monthly Headcount](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/fct_employee_headcount_monthly.sql): `models/marts/fct_employee_headcount_monthly.sql`

### Quality and History

- [Employee SCD2 History](https://github.com/levavasseuryann/dbt-bigquery/blob/master/snapshots/snp_employees.sql): `snapshots/snp_employees.sql`
- [Seed Validation](https://github.com/levavasseuryann/dbt-bigquery/blob/master/seeds/_schema.yml): `seeds/_schema.yml`
- [Source Freshness](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/staging/_sources.yml): `models/staging/_sources.yml`
- [Model Tests](https://github.com/levavasseuryann/dbt-bigquery/blob/master/models/marts/_schema.yml): `models/marts/_schema.yml`
- [Business Rule Tests](https://github.com/levavasseuryann/dbt-bigquery/blob/master/tests/assert_no_future_hires.sql): `tests/assert_no_future_hires.sql`
- [Recent Update Test](https://github.com/levavasseuryann/dbt-bigquery/blob/master/tests/assert_recent_source_updates.sql): `tests/assert_recent_source_updates.sql`
- [Custom Generic Test](https://github.com/levavasseuryann/dbt-bigquery/blob/master/macros/test_non_negative.sql): `macros/test_non_negative.sql`

### Project Capabilities

- [Run Start Hook](https://github.com/levavasseuryann/dbt-bigquery/blob/master/macros/log_project_context.sql): `macros/log_project_context.sql`
- [Run Results Summary](https://github.com/levavasseuryann/dbt-bigquery/blob/master/macros/summarize_run_results.sql): `macros/summarize_run_results.sql`
- [Employee KPI Analysis](https://github.com/levavasseuryann/dbt-bigquery/blob/master/analyses/employee_kpis.sql): `analyses/employee_kpis.sql`

### Other components

- **Analytics Consumers**

## Connections

- BigQuery Sources → Employee Staging: reads
- Source Definitions → BigQuery Sources: declares sources
- Employee Staging → Employee Enrichment: feeds
- Department Targets → Employee Enrichment: enriches
- Employee Enrichment → Department Dimension: feeds
- Employee Enrichment → Active Employees: feeds
- Employee Enrichment → Monthly Headcount: feeds
- BigQuery Sources → Employee SCD2 History: captures history
- Department Targets → Seed Validation: validated by
- BigQuery Sources → Source Freshness: freshness checked
- Department Dimension → Model Tests: contracted and tested
- Active Employees → Model Tests: contracted and tested
- Monthly Headcount → Model Tests: contracted and tested
- BigQuery Sources → Business Rule Tests: checked for future hires
- BigQuery Sources → Recent Update Test: checked for stale updates
- Employee KPI Analysis → Analytics Consumers: supports analysis
- Department Dimension → Analytics Consumers: serves
- Active Employees → Analytics Consumers: serves
- Monthly Headcount → Analytics Consumers: serves
