# alisonpezzott/pbi-docs architecture

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

- Interactive diagram: https://gitdiagram.com/alisonpezzott/pbi-docs
- Repository: https://github.com/alisonpezzott/pbi-docs

## Overview

PBI-DOCS is a local Power BI tenant documentation extractor. Its principal workflow authenticates to the tenant, collects artifact metadata, extracts semantic-model details through DAX Studio, and generates Word documentation. PRO datasets follow a distinct report-export and local Power BI Desktop route before the same kind of extraction. The README also documents dataflow JSON exports. Source excerpts establish these stages, but omit portions of the scripts; edges for the documented but unsampled orchestration are therefore not asserted.

Main entry points: [`src/pbi_docs.py`](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py) (Tenant metadata), [`src/pbi_docs_pbix_local.py`](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs_pbix_local.py) (Local model extraction), [`results/exported_pbix`](https://github.com/alisonpezzott/pbi-docs/tree/main/results/exported_pbix) (Exported PBIX files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tenant["Tenant discovery"]
  node_token["Token acquisition<br/>[pbi_docs.py]"]
  node_tenant_metadata["Tenant metadata<br/>[pbi_docs.py]"]
  node_dataflow_export["Dataflow export<br/>[pbi_docs.py]"]
  node_metadata_files["Metadata JSON"]
  node_dataflow_files["Dataflow JSON files"]
end

subgraph group_extract["Model extraction"]
  node_datasets["Dedicated dataset details<br/>[pbi_docs.py]"]
  node_dataset_csv["Dataset detail CSVs"]
end

subgraph group_pro["PRO local extraction"]
  node_pro_filter_export["PRO PBIX export<br/>[pbi_docs.py]"]
  node_pbix_files["Exported PBIX files"]
  node_local_extraction["Local model extraction"]
  node_local_runtime["Desktop connection handling"]
end

subgraph group_output["Documentation outputs"]
  node_doc_generator["Word documentation generator<br/>[pbi_docs.py]"]
  node_docx_files["DOCX documentation"]
end

node_operator(("Operator"))
node_powerbi{{"Power BI tenant"}}
node_desktop["Power BI Desktop"]
node_daxstudio["DAX Studio CLI"]

node_operator -.->|"starts run"| node_token
node_token -->|"requests token"| node_powerbi
node_token -.->|"provides token"| node_tenant_metadata
node_tenant_metadata -->|"fetches metadata"| node_powerbi
node_tenant_metadata -->|"writes JSON"| node_metadata_files
node_tenant_metadata -.->|"provides metadata"| node_dataflow_export
node_dataflow_export -->|"fetches dataflows"| node_powerbi
node_dataflow_export -->|"writes JSON"| node_dataflow_files
node_tenant_metadata -.->|"provides metadata"| node_datasets
node_datasets -->|"runs DAX queries"| node_daxstudio
node_datasets -->|"writes CSVs"| node_dataset_csv
node_tenant_metadata -.->|"provides metadata"| node_pro_filter_export
node_pro_filter_export -->|"exports reports"| node_powerbi
node_pro_filter_export -->|"writes PBIX"| node_pbix_files
node_pbix_files -.->|"opens for extraction"| node_local_extraction
node_local_extraction -->|"uses connection handling"| node_local_runtime
node_local_runtime -->|"opens and connects"| node_desktop
node_local_extraction -->|"runs DAX queries"| node_daxstudio
node_local_extraction -->|"writes CSVs"| node_dataset_csv
node_dataset_csv -.->|"provides extracted data"| node_doc_generator
node_doc_generator -->|"writes DOCX"| node_docx_files

click node_token "https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py"
click node_tenant_metadata "https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py"
click node_dataflow_export "https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py"
click node_datasets "https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py"
click node_pro_filter_export "https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py"
click node_pbix_files "https://github.com/alisonpezzott/pbi-docs/tree/main/results/exported_pbix"
click node_local_extraction "https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs_pbix_local.py"
click node_local_runtime "https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs_pbix_local.py"
click node_doc_generator "https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.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_token,node_tenant_metadata,node_dataflow_export,node_metadata_files,node_dataflow_files toneBlue
class node_datasets,node_dataset_csv toneAmber
class node_pro_filter_export,node_pbix_files,node_local_extraction,node_local_runtime toneMint
class node_doc_generator,node_docx_files toneRose
class node_operator,node_powerbi,node_desktop,node_daxstudio toneIndigo
```

## Components

### Tenant discovery

- [Token acquisition](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py): `src/pbi_docs.py`
- [Tenant metadata](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py): `src/pbi_docs.py`
- [Dataflow export](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py): `src/pbi_docs.py`
- **Metadata JSON**
- **Dataflow JSON files**

### Model extraction

- [Dedicated dataset details](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py): `src/pbi_docs.py`
- **Dataset detail CSVs**

### PRO local extraction

- [PRO PBIX export](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py): `src/pbi_docs.py`
- [Exported PBIX files](https://github.com/alisonpezzott/pbi-docs/tree/main/results/exported_pbix): `results/exported_pbix`
- [Local model extraction](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs_pbix_local.py): `src/pbi_docs_pbix_local.py`
- [Desktop connection handling](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs_pbix_local.py): `src/pbi_docs_pbix_local.py`

### Documentation outputs

- [Word documentation generator](https://github.com/alisonpezzott/pbi-docs/blob/main/src/pbi_docs.py): `src/pbi_docs.py`
- **DOCX documentation**

### Other components

- **Operator**
- **Power BI tenant**
- **Power BI Desktop**
- **DAX Studio CLI**

## Connections

- Operator → Token acquisition: starts run
- Token acquisition → Power BI tenant: requests token (evidence: `src/pbi_docs.py`)
- Token acquisition → Tenant metadata: provides token (evidence: `src/pbi_docs.py`)
- Tenant metadata → Power BI tenant: fetches metadata (evidence: `src/pbi_docs.py`)
- Tenant metadata → Metadata JSON: writes JSON (evidence: `src/pbi_docs.py`)
- Tenant metadata → Dataflow export: provides metadata (evidence: `src/pbi_docs.py`)
- Dataflow export → Power BI tenant: fetches dataflows (evidence: `src/pbi_docs.py`)
- Dataflow export → Dataflow JSON files: writes JSON (evidence: `src/pbi_docs.py`)
- Tenant metadata → Dedicated dataset details: provides metadata (evidence: `src/pbi_docs.py`)
- Dedicated dataset details → DAX Studio CLI: runs DAX queries (evidence: `src/pbi_docs.py`)
- Dedicated dataset details → Dataset detail CSVs: writes CSVs (evidence: `README.md`)
- Tenant metadata → PRO PBIX export: provides metadata (evidence: `src/pbi_docs.py`)
- PRO PBIX export → Power BI tenant: exports reports (evidence: `src/pbi_docs.py`)
- PRO PBIX export → Exported PBIX files: writes PBIX (evidence: `src/pbi_docs.py`)
- Exported PBIX files → Local model extraction: opens for extraction
- Local model extraction → Desktop connection handling: uses connection handling (evidence: `src/pbi_docs_pbix_local.py`)
- Desktop connection handling → Power BI Desktop: opens and connects (evidence: `src/pbi_docs_pbix_local.py`)
- Local model extraction → DAX Studio CLI: runs DAX queries (evidence: `src/pbi_docs_pbix_local.py`)
- Local model extraction → Dataset detail CSVs: writes CSVs (evidence: `README.md`)
- Dataset detail CSVs → Word documentation generator: provides extracted data
- Word documentation generator → DOCX documentation: writes DOCX (evidence: `README.md`)
