Skip to main content

Crate ripbi_core

Crate ripbi_core 

Source
Expand description

Core library for ripbi: Power BI ingestion, DAX lexing, and dependency-graph analysis.

This crate never prints or exits; all fallible operations return Result.

Analysis starts from a TabularDatabase — the format-agnostic semantic model every source format normalizes into — paired with a ModelIndex for resolving the names that DAX and report bindings refer to objects by:

use ripbi_core::{Measure, ModelIndex, Table, TabularDatabase};

let db = TabularDatabase {
    tables: vec![Table {
        name: "Sales".to_string(),
        measures: vec![Measure {
            name: "Total".to_string(),
            expression: "SUM(Sales[Amount])".to_string(),
            ..Default::default()
        }],
        ..Default::default()
    }],
    ..Default::default()
};

// Names compare case-insensitively, as the Analysis Services engine does.
let index = ModelIndex::build(&db);
assert!(index.resolve_table("SALES").is_some());

// Expressions are enumerated with their owner, ready for the DAX lexer.
let expressions = db.dax_expressions();
assert_eq!(expressions.len(), 1);
assert_eq!(expressions[0].text, "SUM(Sales[Amount])");

The report side is one ReportModel per report sharing the model: its bindings are the reachability roots, and its dax_expressions add report-level measures on top of the model’s own expressions.

Source formats are ingested through ingest: semantic_model parses a TMDL .SemanticModel folder into a TabularDatabase, and report parses a PBIR .Report folder into a ReportModel. Every ingestion entry point returns Ingested, pairing the parsed value with the SkipNotices it recorded — warnings as data, so the CLI decides how to surface them.

Re-exports§

pub use dax::Binding;
pub use dax::RawRef;
pub use dax::Token;
pub use dax::TokenKind;
pub use dax::bind;
pub use dax::references;
pub use dax::tokenize;
pub use dax::unescape_name;
pub use graph::AutoDateTimeStatus;
pub use graph::AutoDateTimeVerdict;
pub use graph::BindingEdge;
pub use graph::BindingSite;
pub use graph::DependencyGraph;
pub use graph::Provenance;
pub use graph::StructuralEdge;
pub use graph::UnusedObject;
pub use graph::UsedBy;
pub use identity::FieldRef;
pub use identity::NameKey;
pub use identity::ObjectId;
pub use ingest::Ingested;
pub use ingest::SkipKind;
pub use ingest::SkipNotice;
pub use model::index::ColumnHandle;
pub use model::index::ExpressionHandle;
pub use model::index::FunctionHandle;
pub use model::index::HierarchyHandle;
pub use model::index::MeasureHandle;
pub use model::index::ModelIndex;
pub use model::index::Resolved;
pub use model::index::TableHandle;
pub use model::index::UnqualifiedMatches;
pub use model::CalculationGroup;
pub use model::CalculationItem;
pub use model::Calendar;
pub use model::Column;
pub use model::ColumnKind;
pub use model::DaxExpressionKind;
pub use model::DaxExpressionRef;
pub use model::ExpressionOwner;
pub use model::Function;
pub use model::Hierarchy;
pub use model::HierarchyLevel;
pub use model::HierarchyRef;
pub use model::Kpi;
pub use model::MExpressionRef;
pub use model::Measure;
pub use model::Partition;
pub use model::PartitionSource;
pub use model::Relationship;
pub use model::Role;
pub use model::SharedExpression;
pub use model::Table;
pub use model::TablePermission;
pub use model::TabularDatabase;
pub use model::Variation;
pub use report::BindingKind;
pub use report::BindingRef;
pub use report::Bookmark;
pub use report::BookmarkSection;
pub use report::BookmarkVisual;
pub use report::DatasetReference;
pub use report::DrillthroughParameter;
pub use report::FieldTarget;
pub use report::FieldWell;
pub use report::Filter;
pub use report::Page;
pub use report::PageBinding;
pub use report::PageBindingKind;
pub use report::Projection;
pub use report::ReportMeasure;
pub use report::ReportModel;
pub use report::Visual;

Modules§

dax
DAX lexing and reference resolution.
graph
The dependency graph: one petgraph DAG over the semantic model and the reports that share it, plus the reachability analysis that isolates dead objects.
identity
Shared object-identity layer for the tabular AST, the report AST, and the DAX lexer.
ingest
Format ingestion: turning Power BI source folders into the crate’s ASTs.
m
M lexing and reference resolution.
model
Format-agnostic tabular AST: the normalized shape every source format (TMDL, TMSL model.bim, .pbix DataModelSchema) is parsed into.
report
Format-agnostic report AST: the normalized shape every report source format (PBIR definition/ folders, PBIR-Legacy report.json Layout) is parsed into.

Enums§

Error
Errors produced by ripbi-core.

Type Aliases§

Result
A result whose error is this crate’s Error.