Skip to main content

aibi-toolkit

aibi — CLI + library for cleaning up Power BI / Tableau semantic-model metadata. Companion to aibi-dax: where aibi-dax checks the DAX expressions inside your measures, aibi-toolkit checks the model around them — naming conventions, format strings, duplicate measures, empty tables, relationships, hygiene.

CI Lint Python Types Ruff Docs License

Runnable walkthroughs live in examples/.

Why this exists

A semantic model is a shared asset, and it always drifts. Measure names pick up stray spaces, missing format strings, duplicate definitions that nobody deletes, and DAX smells that pass casual review. Nobody catches it, because each file is small but the model is large, and nobody wants to be the one recounting the measures by hand.

That is the failure mode aibi-toolkit was built for. It reads the dump, runs the checks, gives you a score, and names the findings. The first pass usually looks like: score 38, a dozen missing format strings, six duplicate measures.

What it does

  • aibi audit — measure hygiene findings and a 0-100 score. Checks format strings, case-insensitive duplicate names, and measure name length. Exit 1 when anything is found, 0 when the model is clean, so a CI gate is one command.
  • aibi lint — static checks on the DAX expressions: raw / without DIVIDE, no-argument ALLSELECTED(), CALCULATE([]), and IFERROR masking.
  • aibi fix — applies naming and format-string fixes with --dry-run so you always see what would change before it changes.
  • aibi summary — object counts; aibi tables — table list.
  • aibi report — markdown audit report: score, finding counts, examples, for your own paper trail or a PR description.
  • aibi diagram — mermaid ER diagram straight from the model.
  • aibi profile — expression complexity: count, average, max weight, and the heaviest measures named.
  • aibi synth — generate a sample model for trying the tool.
  • aibi export — measures to CSV for external row-checks.

Full module map:

Area Module
TMDL/PBIP loading tmdl
Naming naming
Format strings measure
DAX snippets dax, filters
Model inspection metadata
Auditing + linting audit, lint
Integrity integrity
Autofixes autofix
Diagrams diagram
Reports report
Demo data sample
Renderers tables
Configuration config
Profiling profile
CSV round-trip csvio

Input formats

aibi summary path — path may be either:

  • a shared-schema JSON dump (model.json from your model tool), or
  • a TMDL folder (a .pbip project root, a *.Dataset folder, or the definition/ directory itself). Tables are read from definition/tables/*.tmdl, relationships from definition/relationships.tmdl; every command works unchanged on either shape.

Full details and layout diagram: docs/input.md.

Install

Install from PyPI and check the binary works:

pip install aibi-toolkit
aibi --help

Or install from the source tree: git clone https://github.com/SourinRakshit-ai/aibi-toolkit.git && cd aibi-toolkit && pip install ..

Quick start

Generate a sample model, then check it:

aibi synth model.json          # write a sample model
aibi summary model.json        # object counts
aibi audit model.json          # hygiene findings + 0-100 score
aibi lint model.json           # DAX rule findings
aibi audit model.json --json   # machine-readable output (also: lint, profile)
aibi report model.json out.md  # markdown audit report
aibi fix --dry-run model.json  # preview fixes before writing anything

Audit returns exit 1 when findings exist, 0 when clean, so a pipeline that already has set -e fails immediately. Pass --json to audit, lint or profile when you want a machine-readable result. Any loader failure (missing path, not valid JSON, wrong top-level shape) exits 2 with a one-line reason on stderr — never a traceback.

How it helps

  • One number first. The 0–100 score tells you whether the model deserves attention before you read a single measure. Score 38 usually means "regenerate formats and delete the dead duplicates"; score 92 means "quick answer, move on".
  • Names and formats are the fix. Around 90% of findings in real models are missing_format and duplicates after a bulk edit; both are auto-fixable by aibi fix with --dry-run for confirmation.
  • Exit codes mean CI. aibi audit model.json returns 1 with any finding and 0 clean, so the release pipeline it belongs in fails where the merge should wait for you.
  • The report is the artifact. aibi report gives a reviewer the score and a short list of examples, which is usually enough for the release meeting.

What it is not

  • Not an aibi-dax substitute. It lints DAX for narrowly-scoped patterns (raw /, no-arg ALLSELECTED(), CALCULATE([]), IFERROR hiding). For deep complexity scoring and anti-pattern detection, that is what aibi-dax is for.
  • Not a TMDL/PBIP authoring tool. It reads TMDL folders and JSON dumps, but does not write TMDL back to disk; editing stays in your model tool.
  • Not a bug finder for DAX logic. It checks static patterns; it cannot tell you your total is wrong. That still needs EVALUATE checks and your eyes.
  • Not a performance tool. It has no cost model for queries; it flags patterns, not benchmarks.

Commands

Command Purpose
aibi summary model.json object counts
aibi tables model.json list tables
aibi audit model.json hygiene findings + 0-100 score
aibi lint model.json DAX rule findings
aibi fix --dry-run model.json preview naming/format fixes (omit --dry-run to apply)
aibi profile model.json expression complexity: count, avg, max, heavy
aibi diagram model.json mermaid ER diagram
aibi export model.json out.csv measures to CSV
aibi report model.json out.md markdown audit report
aibi synth model.json generate a sample model

Docs and support

Development

make install        # pip install -e ".[dev]"
make test           # pytest -q
make typecheck      # mypy --strict src/aibi_toolkit/
make lint           # ruff check src/ tests/
make serve-docs     # mkdocs serve

MIT licensed. Roadmap lives in the issue tracker.

Metadata

Release files for aibi-toolkit 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aibi-toolkit 1.3.0
File Size Uploaded Provenance Actions
aibi_toolkit-1.3.0.tar.gz 32.8 kB With provenance Details for aibi_toolkit-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aibi-toolkit 1.3.0
File Interpreter ABI Platform Actions
aibi_toolkit-1.3.0-py3-none-any.whl Python 3 none any Details for aibi_toolkit-1.3.0-py3-none-any.whl

Total release size: 61.7 kB

Release files / aibi_toolkit-1.3.0.tar.gz

Download URL aibi_toolkit-1.3.0.tar.gz
Size 32.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f858c7d1ddc9efe13c06c1547c9d6e35e737b9ca7b2cc1cb336c1aee1fa66663
BLAKE2b-256 checksum
How to use checksums
57971df7dd1220a556850bcec8b81c9eee9fdfe9447cc0fb2ed05c0a2ec226ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / aibi_toolkit-1.3.0-py3-none-any.whl

Download URL aibi_toolkit-1.3.0-py3-none-any.whl
Size 28.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afaa76622314fbbda3ea5be73ca83e9fa4e7066ee668f0d9cb9a021f1288b3c4
BLAKE2b-256 checksum
How to use checksums
584d913d5631f802123ff412536863d6f2f9d9f59bff0df27aaa2da6fd61d12a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for aibi-toolkit 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aibi_toolkit-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page