# dummycodertech/cfpb-powerbi architecture

> Architecture diagram of the GitHub repository dummycodertech/cfpb-powerbi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dummycodertech/cfpb-powerbi
- Repository: https://github.com/dummycodertech/cfpb-powerbi

## Overview

This repository is a CFPB complaints analytics warehouse: download and ingest the public snapshot, transform it through dbt into a tested star schema, then export mart tables for BI consumption. The README documents the full model lineage and Power BI presentation; source excerpts verify the download, DuckDB ingest, and Parquet export mechanics. The SQL model files and configuration were not sampled, so model-to-model links follow the README’s explicit DAG rather than inspected SQL calls.

Main entry points: [`scripts/04_export_parquet.py`](https://github.com/dummycodertech/cfpb-powerbi/blob/master/scripts/04_export_parquet.py) (Parquet export), [`models/intermediate/int_complaints_cleaned.sql`](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/intermediate/int_complaints_cleaned.sql) (Complaint cleaning), [`models/marts/fact_complaints.sql`](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/fact_complaints.sql) (Complaint fact), [`models/marts/dim_state.sql`](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/dim_state.sql) (State dimension)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquire["Data acquisition"]
  node_download["Snapshot download<br/>[01_download.py]"]
  node_rawcsv["Raw CSV snapshot"]
  node_ingest["Raw ingestion<br/>[02_ingest.py]"]
  node_rawdb[("Raw DuckDB table")]
end

subgraph group_transform["Warehouse transforms"]
  node_staging["Complaint staging<br/>[stg_complaints.sql]"]
  node_cleaning["Complaint cleaning"]
  node_fact["Complaint fact"]
  node_company["Company dimension<br/>[dim_company.sql]"]
  node_product["Product dimension<br/>[dim_product.sql]"]
  node_state["State dimension<br/>[dim_state.sql]"]
  node_date["Date dimension<br/>[dim_date.sql]"]
  node_states_seed["US states seed<br/>[us_states.csv]"]
end

subgraph group_present["Analytics delivery"]
  node_export["Parquet export"]
  node_parquet["Mart Parquet files"]
end

node_analyst(("Analytics user"))
node_cfpb[("CFPB database")]
node_powerbi["Power BI"]

node_cfpb -->|"provides data"| node_download
node_download -->|"downloads snapshot"| node_rawcsv
node_rawcsv -->|"loads CSV"| node_ingest
node_ingest -->|"writes raw table"| node_rawdb
node_rawdb -->|"feeds staging"| node_staging
node_staging -->|"feeds cleaning"| node_cleaning
node_cleaning -->|"feeds fact"| node_fact
node_cleaning -->|"feeds dimension"| node_company
node_cleaning -->|"feeds dimension"| node_product
node_cleaning -->|"feeds dimension"| node_state
node_states_seed -->|"seeds states"| node_state
node_date -.->|"joins date dimension"| node_fact
node_export -->|"reads mart"| node_fact
node_export -->|"reads mart"| node_company
node_export -->|"reads mart"| node_product
node_export -->|"reads mart"| node_state
node_export -->|"reads mart"| node_date
node_export -->|"writes files"| node_parquet
node_parquet -->|"loads tables"| node_powerbi
node_analyst -.->|"analyzes trends"| node_powerbi

click node_download "https://github.com/dummycodertech/cfpb-powerbi/blob/master/scripts/01_download.py"
click node_ingest "https://github.com/dummycodertech/cfpb-powerbi/blob/master/scripts/02_ingest.py"
click node_staging "https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/staging/stg_complaints.sql"
click node_cleaning "https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/intermediate/int_complaints_cleaned.sql"
click node_fact "https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/fact_complaints.sql"
click node_company "https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/dim_company.sql"
click node_product "https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/dim_product.sql"
click node_state "https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/dim_state.sql"
click node_date "https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/dim_date.sql"
click node_states_seed "https://github.com/dummycodertech/cfpb-powerbi/blob/master/seeds/us_states.csv"
click node_export "https://github.com/dummycodertech/cfpb-powerbi/blob/master/scripts/04_export_parquet.py"

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_download,node_rawcsv,node_ingest,node_rawdb,node_analyst toneBlue
class node_staging,node_cleaning,node_fact,node_company,node_product,node_state,node_date,node_states_seed,node_cfpb toneAmber
class node_export,node_parquet toneMint
class node_powerbi toneIndigo
```

## Components

### Data acquisition

- [Snapshot download](https://github.com/dummycodertech/cfpb-powerbi/blob/master/scripts/01_download.py): `scripts/01_download.py`
- **Raw CSV snapshot**
- [Raw ingestion](https://github.com/dummycodertech/cfpb-powerbi/blob/master/scripts/02_ingest.py): `scripts/02_ingest.py`
- **Raw DuckDB table**

### Warehouse transforms

- [Complaint staging](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/staging/stg_complaints.sql): `models/staging/stg_complaints.sql`
- [Complaint cleaning](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/intermediate/int_complaints_cleaned.sql): `models/intermediate/int_complaints_cleaned.sql`
- [Complaint fact](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/fact_complaints.sql): `models/marts/fact_complaints.sql`
- [Company dimension](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/dim_company.sql): `models/marts/dim_company.sql`
- [Product dimension](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/dim_product.sql): `models/marts/dim_product.sql`
- [State dimension](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/dim_state.sql): `models/marts/dim_state.sql`
- [Date dimension](https://github.com/dummycodertech/cfpb-powerbi/blob/master/models/marts/dim_date.sql): `models/marts/dim_date.sql`
- [US states seed](https://github.com/dummycodertech/cfpb-powerbi/blob/master/seeds/us_states.csv): `seeds/us_states.csv`

### Analytics delivery

- [Parquet export](https://github.com/dummycodertech/cfpb-powerbi/blob/master/scripts/04_export_parquet.py): `scripts/04_export_parquet.py`
- **Mart Parquet files**

### Other components

- **Analytics user**
- **CFPB database**
- **Power BI**

## Connections

- CFPB database → Snapshot download: provides data (evidence: `scripts/01_download.py`)
- Snapshot download → Raw CSV snapshot: downloads snapshot (evidence: `scripts/01_download.py`)
- Raw CSV snapshot → Raw ingestion: loads CSV (evidence: `scripts/02_ingest.py`)
- Raw ingestion → Raw DuckDB table: writes raw table (evidence: `scripts/02_ingest.py`)
- Raw DuckDB table → Complaint staging: feeds staging (evidence: `README.md`)
- Complaint staging → Complaint cleaning: feeds cleaning (evidence: `README.md`)
- Complaint cleaning → Complaint fact: feeds fact (evidence: `README.md`)
- Complaint cleaning → Company dimension: feeds dimension (evidence: `README.md`)
- Complaint cleaning → Product dimension: feeds dimension (evidence: `README.md`)
- Complaint cleaning → State dimension: feeds dimension (evidence: `README.md`)
- US states seed → State dimension: seeds states (evidence: `README.md`)
- Date dimension → Complaint fact: joins date dimension
- Parquet export → Complaint fact: reads mart (evidence: `scripts/04_export_parquet.py`)
- Parquet export → Company dimension: reads mart (evidence: `scripts/04_export_parquet.py`)
- Parquet export → Product dimension: reads mart (evidence: `scripts/04_export_parquet.py`)
- Parquet export → State dimension: reads mart (evidence: `scripts/04_export_parquet.py`)
- Parquet export → Date dimension: reads mart (evidence: `scripts/04_export_parquet.py`)
- Parquet export → Mart Parquet files: writes files (evidence: `scripts/04_export_parquet.py`)
- Mart Parquet files → Power BI: loads tables (evidence: `README.md`)
- Analytics user → Power BI: analyzes trends
