https://github.com/jonathan-pap/powerbi-lineage
Generate documentation from Power BI PBIP projects — runs in your browser (nothing uploaded) or as a local CLI. Outputs a searchable dashboard plus 9 Markdown docs ready for ADO Wiki or GitHub. Measures, pages, lineage, and a model-health audit.
https://github.com/jonathan-pap/powerbi-lineage
azure-devops browser-tool data-dictionary dax documentation file-system-access-api lineage markdown pbip power-bi powerbi semantic-model tmdl typescript wiki zero-dependencies
Last synced: 29 days ago
JSON representation
Generate documentation from Power BI PBIP projects — runs in your browser (nothing uploaded) or as a local CLI. Outputs a searchable dashboard plus 9 Markdown docs ready for ADO Wiki or GitHub. Measures, pages, lineage, and a model-health audit.
- Host: GitHub
- URL: https://github.com/jonathan-pap/powerbi-lineage
- Owner: jonathan-pap
- Created: 2026-04-16T17:13:36.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-24T12:24:46.000Z (about 1 month ago)
- Last Synced: 2026-04-24T12:26:03.262Z (about 1 month ago)
- Topics: azure-devops, browser-tool, data-dictionary, dax, documentation, file-system-access-api, lineage, markdown, pbip, power-bi, powerbi, semantic-model, tmdl, typescript, wiki, zero-dependencies
- Language: TypeScript
- Homepage: https://jonathan-pap.github.io/PowerBI-Lineage/
- Size: 48.7 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Power BI Documenter
> **Lineage · Audit · Wiki-ready Markdown**
Open a PBIP project folder — get a searchable dashboard plus nine Markdown docs ready for ADO Wiki or GitHub. Runs **entirely in your browser** (nothing uploads) or as a **local CLI**.
## What you get
- **Interactive dashboard** — 11 tabs: Sources, Tables, Columns, Relationships, Measures, Calc Groups, Functions, Pages (with layout wireframe), Unused, Lineage (search-driven), Documentation
- **Wiki-ready Markdown** — up to 9 generated docs, paste-ready for ADO Wiki or GitHub. **Lite / Detailed toggle** per doc — paste-into-wiki summary for stakeholders, full reference for engineers. Cross-doc links between them resolve in the dashboard, on GitHub, and on ADO Wiki
- **Improvements audit** — 16 checks across five severity tiers (high / medium / low / info / strengths) including broken-DAX-reference detection
- **Source Map** — flat PBI-column → physical-source lineage with CSV export
- **Page layout wireframe** — SVG thumbnail of each page showing visuals at true canvas positions
- **Privacy by default** — browser-mode files never leave your machine; CLI binds to loopback only
## Tour
### Inspect the model

Measures — DAX dependencies, where-used per visual + page, direct/indirect/unused status, descriptions inline. CSV export honours filters.
Columns — types, usage counts, status, sortable + searchable. Same CSV export pattern.

Tables — grouped by role (Fact / Dimension / Bridge / Calc Group). Per-table stats for columns, measures, keys, FKs.
Tables drill-down — expand any table to see columns, measures, and per-relationship cardinality chips (*:1, ↔ for bidi).
### Relationships, sources & lineage

Relationships — active + inactive, cardinality (one/many on each side), cross-filter direction (single → / both ↔). CSV export.
Sources — connection buckets, partition modes, physical-source index (what breaks if this source goes away?), hand-written SQL from Value.NativeQuery, M-step breakdown classifying every ETL step, raw M expressions on demand.

Lineage — search any measure or column from the tab itself, or click an entity from any other tab. Shows upstream DAX dependencies + source tables + functions, and downstream visuals + measures that feed into it.
Unused — orphan measures, dead-chain measures, indirect-use detection. Pairs with the Improvements audit's broken-reference detection.
### Pages, functions, calc groups

Pages overview — every page in the report with visual count, slicers, measure / column bindings.
SVG wireframe — each page's visuals at true canvas positions. Charts, cards, slicers, tables, maps — shapes and buttons deliberately filtered.

Per-visual bindings — every measure + column each visual consumes, with type chips. Hover the wireframe for field-well tooltips.
UDF reference — parameters, body, and every measure that calls each function. Tabular 1702+.

Calc Groups — items, precedence, format-string expressions per item.
### Wiki-ready Markdown
Nine Markdown documents — paste-ready for ADO Wiki or GitHub, anchor-stable, with cross-doc links that resolve everywhere.
| Doc | What's in it |
|---|---|
| **Model** | Technical spec — front matter, schema summary, per-table breakdown, relationships, pages roll-up |
| **Data Dictionary** | Per-table column catalog with PK / FK / CALC / HIDDEN badges + textual star-schema fragments (FK targets, role tags) |
| **Sources** | Data-sources catalog, partition modes, field parameters, composite-model proxies |
| **Measures** | A–Z reference with DAX, dependencies (Depends on / Used by), per-visual + per-page bindings |
| **Functions** | UDF reference — parameters, description, body |
| **Calc Groups** | Calculation-group reference with per-item descriptions |
| **Pages** | Per-page visual catalog — type, title, field bindings for every visual |
| **Improvements** | Prioritised action list — severity-tiered with rationale |
| **Index** | Alphabetical glossary — every named entity links to its full reference in the companion docs |
Plus a **Changelog** tab exposing the project's release history.
## Try it
### Browser (no install)
**[→ Open the browser build](https://jonathan-pap.github.io/PowerBI-Lineage/)** — requires Chrome, Edge, or Opera (File System Access API).
1. Click **Open folder** — pick the PBIP project parent folder (the one that contains both `.Report` and `.SemanticModel`). Or click **Try a sample** for a one-click demo.
2. When multiple project pairs exist under one parent, a pair-picker lets you choose which Report + Semantic Model to load. Report-only and Model-only modes are also supported.
3. Dashboard renders in the same page.
Firefox / Safari users: run the CLI ([see below](#running)) — the File System Access API is Chromium-only.
### Running — CLI mode
Requires Node.js 18+ and a `.Report` folder with its `.SemanticModel` sibling.
**Double-click (Windows):**
```
launch.bat
```
First run does `npm install` + `npm run build`, then starts the app and opens your browser.
**From the terminal:**
```sh
npm install
npm run build
node dist/app.js
```
The app listens on `http://127.0.0.1:5679` (loopback only — nothing leaves your machine). Paste the `.Report` path or use the picker. Recent reports are remembered.
## How it works
### Browser mode
The same parser + data-builder that power the CLI run client-side via three small shims:
- `src/browser/fs-shim.ts` — pretends to be `fs` but reads from an in-memory Map
- `src/browser/path-shim.ts` — POSIX-style `path` replacement
- `src/browser/fsa-walk.ts` — walks a `FileSystemDirectoryHandle` into the Map
An import-map in `docs/index.html` redirects bare `import … from "fs"` / `"path"` to the shims. The parser never knows the difference.
### Build + deploy
```sh
npm run build:browser # → ./docs/
npm run serve:browser # → 127.0.0.1:5700
```
`.github/workflows/pages.yml` auto-publishes `docs/` to GitHub Pages on every push to `main`.
## Project layout
```
src/
pbir-reader.ts Read-only access to PBIR report/page/visual JSON
model-parser.ts findSemanticModelPath + TMDL + BIM parsers
report-scanner.ts Walks visuals/filters/objects to extract field bindings + positions
data-builder.ts Cross-references model + report into FullData
md-generator.ts 9 MD docs (Lite + Detailed modes), ADO Wiki-safe anchors, cross-doc xref links
improvements.ts 16-check audit (incl. broken-ref detection) — severity-tiered
html-generator.ts Dashboard HTML template
client/ Dashboard runtime (tabs, search, sort, lineage view, wireframe)
main.ts · render/escape.ts · render/md.ts · globals.d.ts
render/ Shared server-side escape helpers
app.ts CLI HTTP server + landing page
browser/ FSA walker + shims + entry shell + pair-picker logic
entry.ts · fsa-walk.ts · fs-shim.ts · path-shim.ts · pair-picker.ts
scripts/
build-browser.mjs Assembles docs/ from dist/ + browser TS output
bake-sample.mjs Bakes a sample PBIP into docs/sample-data.json
serve-browser.mjs Tiny static server for local testing
changelog/ Per-version release notes (one file per release)
tests/ node:test suites — 276 tests, zero framework deps
```
## Zero runtime dependencies
Runtime deps: none. Only Node builtins (`fs`, `path`, `http`, `crypto`, `child_process`). Dev-deps are `typescript` + `@types/node` only — needed to build.
## Developing
```sh
npm run typecheck # tsc --noEmit
npm test # compile + run Node's built-in test runner
npm run build # compile CLI to dist/
npm run build:browser # compile + assemble docs/ + bake sample
```
Tests use the stdlib `node:test` module. `.github/workflows/ci.yml` runs typecheck + tests + build on every push and PR across Node 18 / 20 / 22.
## Publishing to Azure DevOps Wiki
Each of the nine generated MDs starts with an HTML comment suggesting its wiki page name:
```markdown
# Measures Reference
```
**To publish:**
1. Open the dashboard for your report, switch to the **Documentation** tab
2. For each doc (Model / Data Dictionary / Sources / Measures / Functions / Calc Groups / Pages / Improvements / Index):
- Click **⎘ Copy** to copy the markdown
- In ADO Wiki, create a new page with the name from the `` hint
- Paste
3. If you want ADO's auto-TOC instead of the hand-rolled one, type `[[_TOC_]]` at the top of the page
### Compatibility
| Feature | ADO Wiki | GitHub | Dashboard |
|---|---|---|---|
| Anchors (jump-to nav, cross-references) | ✅ via `adoSlug` algorithm | ✅ | ✅ |
| Same-doc anchor links (`[text](#anchor)`) | ✅ | ✅ | ✅ scrolls within doc |
| Cross-doc links (`[text](DocName.md#anchor)`) | ⚠ rename `.md` → page-path on paste | ✅ if files share a folder | ✅ tab-switches + scrolls |
| `` / `` collapsibles | ✅ native | ✅ native | ✅ native |
| Pipe tables | ✅ | ✅ | ✅ |
| Fenced `dax` code blocks | ✅ syntax-highlighted | ✅ | ✅ syntax-highlighted |
| ```` ```mermaid ```` lineage / star fragments | ⛔ not emitted (render-quality wasn't reliable across targets) | ⛔ not emitted | ⛔ not emitted |
| Badge `` styling | ⚠ CSS stripped — emoji-prefixed plain text (`🔑 PK`) | ⚠ same fallback | ✅ styled pill |
| Auto-anchor from heading | ✅ | ✅ | ✅ |
Every anchor link is verified by `tests/md-anchors.test.ts` — drift fires CI.
## Changelog
[`changelog/`](changelog/) — one file per release. Full index in [`changelog/README.md`](changelog/README.md). Future direction is open-ended; feature requests welcome via Issues.
Latest release: **[v0.11.7](changelog/0.11.7.md)** — Default tab on first load is now **Sources** (was Measures), and Measures + Columns sort no longer flips to ascending on report reload. Small UX defaults that were quietly wrong.